How to give the object back upon failure? : I have the following code in Rust:

```rust
pub struct PropertySet
{
    color: Color,
    properties: Vec<Box<dyn Property>>,
}

impl PropertySet
{
    // ...

    /// This function will panic if a card is added and the set is already full, so
    /// you should always check the set size first.
    fn add<T: Property>(&mut self, card: T)
    {
        if self.properties.len() + 1 < self.color.set_size() {
            self.properties.push(Box::new(property))
        } else {
            panic!("The card could not be added to the set; it is full.")
        }
    }

    // ...
}
```

This `impl` is for a struct which is intended to hold a list of cards, but has a maximum number of cards that can be added to it. Panicking seems like an unnecessarily drastic response to the error of trying to add a card to a full set, so I would like to return an `Err` instead, but that presents a problem because this method moves `card`. `card` has to be passed by value because this is the only way I can add it to the `Vec`.

Is there a way to simply give `card` back to the caller if the method fails, instead of panicking?