pub fn build(self) -> Result<UserConfig, UserConfigError> {
        let name = self
            .name
            .filter(|s| validate_name(s))
            .ok_or(UserConfigError::InvalidName)?;

        let token = self
            .token
            .filter(|s| validate_token(s))
            .ok_or(UserConfigError::InvalidToken)?;

        match (name.as_str(), token.as_str()) {
            (crate::JUSTINFAN1234, crate::JUSTINFAN1234) => {
                // both are allowed
            }
            (crate::JUSTINFAN1234, ..) | (.., crate::JUSTINFAN1234) => {
                return Err(UserConfigError::PartialAnonymous)
            }
            _ => {}
        }

        Ok(UserConfig {
            name,
            token,
            capabilities: self.capabilities.into_iter().collect(),
        })
    }
/// Tries to build the UserConfig
///
/// This returns an error if the name or token are invalid
///
/// If the anonymous `name` OR `token` is used without the other matching one this will return an [error].
///
/// [error]: UserConfigError
Tries to build the UserConfig
This returns an error if the name or token are invalid

If the anonymous `name` OR `token` is used without the other matching one this will return an [error].


Tries to build the UserConfig This returns an error if the name or token are invalid If the anonymous ` name ` OR ` token ` is used without the other matching one this will return an [ error ] .
pub fn build(self) -> Result<UserConfig, UserConfigError> {
        let name = self
            .name
            .filter(|s| validate_name(s))
            .ok_or(UserConfigError::InvalidName)?;
        let token = self
            .token
            .filter(|s| validate_token(s))
            .ok_or(UserConfigError::InvalidToken)?;
        match (name.as_str(), token.as_str()) {
            (crate::JUSTINFAN1234, crate::JUSTINFAN1234) => {
                // both are allowed
            }
            (crate::JUSTINFAN1234, ..) | (.., crate::JUSTINFAN1234) => {
                return Err(UserConfigError::PartialAnonymous)
            }
            _ => {}
        }
        Ok(UserConfig {
            name,
            token,
            capabilities: self.capabilities.into_iter().collect(),
        })
    }
pub fn build ( self ) -> Result < UserConfig , UserConfigError > { let name = self . name . filter ( | s | validate_name ( s ) ) . ok_or ( UserConfigError :: InvalidName ) ? ; let token = self . token . filter ( | s | validate_token ( s ) ) . ok_or ( UserConfigError :: InvalidToken ) ? ; match ( name . as_str ( ) , token . as_str ( ) ) { ( crate :: JUSTINFAN1234 , crate :: JUSTINFAN1234 ) => { // both are allowed } ( crate :: JUSTINFAN1234 , .. ) | ( .. , crate :: JUSTINFAN1234 ) => { return Err ( UserConfigError :: PartialAnonymous ) } _ => { } } Ok ( UserConfig { name , token , capabilities : self . capabilities . into_iter ( ) . collect ( ) , } ) }
Tries to build the UserConfig
This returns an error if the name or token are invalid
Tries to build the UserConfig This returns an error if the name or token are invalid
self
self