fn add_property(&mut self, prop: Property) -> Option<Property> {
        let properties = self.properties.get_or_insert(Vec::new());
        if let Some(i) = properties.iter().position(|old_prop| old_prop.key == prop.key) {
            properties.push(prop);
            Some(properties.swap_remove(i))
        } else {
            properties.push(prop);
            None
        }
    }
/// Adds the given property to the given Object. If a property with this key already exists, it is
/// replaced and the old value is returned.
Adds the given property to the given Object. If a property with this key already exists, it is
replaced and the old value is returned.
Adds the given property to the given Object . If a property with this key already exists it is replaced and the old value is returned .
fn add_property(&mut self, prop: Property) -> Option<Property> {
        let properties = self.properties.get_or_insert(Vec::new());
        if let Some(i) = properties.iter().position(|old_prop| old_prop.key == prop.key) {
            properties.push(prop);
            Some(properties.swap_remove(i))
        } else {
            properties.push(prop);
            None
        }
    }
fn add_property ( & mut self , prop : Property ) -> Option < Property > { let properties = self . properties . get_or_insert ( Vec :: new ( ) ) ; if let Some ( i ) = properties . iter ( ) . position ( | old_prop | old_prop . key == prop . key ) { properties . push ( prop ) ; Some ( properties . swap_remove ( i ) ) } else { properties . push ( prop ) ; None } }
Adds the given property to the given Object.
Adds the given property to the given Object .
&mut self
prop
Property
&mut self
prop
Property