pub fn add_value(&mut self, item: T) -> Result<(), VCardError> {
        if self.0.len() == 0 {
            self.0.push(item);
            return Ok(());
        }
        let prev_altid = self.0.get(0).unwrap().get_alt_id();
        if prev_altid != item.get_alt_id() {
            return Err(VCardError::InvalidAltID {
                expected_altid: prev_altid.to_string(),
                actual_altid: item.get_alt_id().to_owned(),
            });
        }

        self.0.push(item);

        Ok(())
    }
/// Adds a new value to this container.
///
/// This will fail if `item` has a different `altid` than previous elements of this container.
/// In case the container does not have any elemts, it will simply be added to the collection.
Adds a new value to this container.
This will fail if `item` has a different `altid` than previous elements of this container.
In case the container does not have any elemts, it will simply be added to the collection.
Adds a new value to this container . This will fail if ` item ` has a different ` altid ` than previous elements of this container . In case the container does not have any elemts it will simply be added to the collection .
pub fn add_value(&mut self, item: T) -> Result<(), VCardError> {
        if self.0.len() == 0 {
            self.0.push(item);
            return Ok(());
        }
        let prev_altid = self.0.get(0).unwrap().get_alt_id();
        if prev_altid != item.get_alt_id() {
            return Err(VCardError::InvalidAltID {
                expected_altid: prev_altid.to_string(),
                actual_altid: item.get_alt_id().to_owned(),
            });
        }
        self.0.push(item);
        Ok(())
    }
pub fn add_value ( & mut self , item : T ) -> Result < ( ) , VCardError > { if self . 0 . len ( ) == 0 { self . 0 . push ( item ) ; return Ok ( ( ) ) ; } let prev_altid = self . 0 . get ( 0 ) . unwrap ( ) . get_alt_id ( ) ; if prev_altid != item . get_alt_id ( ) { return Err ( VCardError :: InvalidAltID { expected_altid : prev_altid . to_string ( ) , actual_altid : item . get_alt_id ( ) . to_owned ( ) , } ) ; } self . 0 . push ( item ) ; Ok ( ( ) ) }
Adds a new value to this container.
Adds a new value to this container .
&mut self
item
T
&mut self
item
T