pub fn attribute<T: Into<AttributeValue>>(
        &mut self,
        key: &str,
        value: T,
    ) -> Result<(), TypeError> {
        let value: AttributeValue = value.into();
        match key {
            "key" => {
                self._key = value
                    .as_str()
                    .ok_or_else(|| TypeError::new("key", "String", &value))?
                    .to_string()
            }
            "secondary" => {
                self._secondary = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("secondary", "String", &value))?
                        .to_string(),
                )
            }
            "ip" => {
                self._ip = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("ip", "String", &value))?
                        .to_string(),
                )
            }
            "country" => {
                self._country = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("country", "String", &value))?
                        .to_string(),
                )
            }
            "email" => {
                self._email = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("email", "String", &value))?
                        .to_string(),
                )
            }
            "firstName" => {
                self._first_name = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("firstName", "String", &value))?
                        .to_string(),
                )
            }
            "lastName" => {
                self._last_name = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("lastName", "String", &value))?
                        .to_string(),
                )
            }
            "avatar" => {
                self._avatar = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("avatar", "String", &value))?
                        .to_string(),
                )
            }
            "name" => {
                self._name = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("name", "String", &value))?
                        .to_string(),
                )
            }
            "anonymous" => {
                self._anonymous = Some(
                    value
                        .as_bool()
                        .ok_or_else(|| TypeError::new("anonymous", "Bool", &value))?,
                )
            }
            _ => {
                let _ = self.custom.insert(key.to_string(), value);
            }
        }
        Ok(())
    }
/// Set the attributed named `key` to the value `value`.
///
/// If there is a type conversion issue when setting the attribute, return an error of type
/// [TypeError].
Set the attributed named `key` to the value `value`.
If there is a type conversion issue when setting the attribute, return an error of type
[TypeError].
Set the attributed named ` key ` to the value ` value ` . If there is a type conversion issue when setting the attribute return an error of type [ TypeError ] .
pub fn attribute<T: Into<AttributeValue>>(
        &mut self,
        key: &str,
        value: T,
    ) -> Result<(), TypeError> {
        let value: AttributeValue = value.into();
        match key {
            "key" => {
                self._key = value
                    .as_str()
                    .ok_or_else(|| TypeError::new("key", "String", &value))?
                    .to_string()
            }
            "secondary" => {
                self._secondary = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("secondary", "String", &value))?
                        .to_string(),
                )
            }
            "ip" => {
                self._ip = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("ip", "String", &value))?
                        .to_string(),
                )
            }
            "country" => {
                self._country = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("country", "String", &value))?
                        .to_string(),
                )
            }
            "email" => {
                self._email = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("email", "String", &value))?
                        .to_string(),
                )
            }
            "firstName" => {
                self._first_name = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("firstName", "String", &value))?
                        .to_string(),
                )
            }
            "lastName" => {
                self._last_name = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("lastName", "String", &value))?
                        .to_string(),
                )
            }
            "avatar" => {
                self._avatar = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("avatar", "String", &value))?
                        .to_string(),
                )
            }
            "name" => {
                self._name = Some(
                    value
                        .as_str()
                        .ok_or_else(|| TypeError::new("name", "String", &value))?
                        .to_string(),
                )
            }
            "anonymous" => {
                self._anonymous = Some(
                    value
                        .as_bool()
                        .ok_or_else(|| TypeError::new("anonymous", "Bool", &value))?,
                )
            }
            _ => {
                let _ = self.custom.insert(key.to_string(), value);
            }
        }
        Ok(())
    }
pub fn attribute < T : Into < AttributeValue > > ( & mut self , key : & str , value : T , ) -> Result < ( ) , TypeError > { let value : AttributeValue = value . into ( ) ; match key { " " => { self . _key = value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) } " " => { self . _secondary = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _ip = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _country = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _email = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _first_name = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _last_name = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _avatar = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _name = Some ( value . as_str ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? . to_string ( ) , ) } " " => { self . _anonymous = Some ( value . as_bool ( ) . ok_or_else ( | | TypeError :: new ( " " , " " , & value ) ) ? , ) } _ => { let _ = self . custom . insert ( key . to_string ( ) , value ) ; } } Ok ( ( ) ) }
Set the attributed named `key` to the value `value`.
Set the attributed named ` key ` to the value ` value ` .
&mut self
key
&str
value
T
&mut self
key
&str
value
T