pub fn user_exists(&self, username: &str) -> Result<bool, u8> {
        match self
            .client
            .post("https://training.olinfo.it/api/check")
            .json(&serde_json::json!({"type":"username","value":username}))
            .send()
        {
            Ok(mut response) => match response.json::<CheckResponse>() {
                Ok(resp) => match resp.success {
                    1 => Ok(false),
                    _ => match resp.error {
                        Some(x) => {
                            if x == String::from("This username is not available") {
                                Ok(true)
                            } else {
                                Ok(false)
                            }
                        }
                        _ => Err(3),
                    },
                },
                _ => Err(2),
            },
            _ => Err(1),
        }
    }
/// check if there is an user with username = username
///
/// [example is `Username` input](https://training.olinfo.it/#/signup)
check if there is an user with username = username
[example is `Username` input]
check if there is an user with username = username [ example is ` Username ` input ]
pub fn user_exists(&self, username: &str) -> Result<bool, u8> {
        match self
            .client
            .post("https://training.olinfo.it/api/check")
            .json(&serde_json::json!({"type":"username","value":username}))
            .send()
        {
            Ok(mut response) => match response.json::<CheckResponse>() {
                Ok(resp) => match resp.success {
                    1 => Ok(false),
                    _ => match resp.error {
                        Some(x) => {
                            if x == String::from("This username is not available") {
                                Ok(true)
                            } else {
                                Ok(false)
                            }
                        }
                        _ => Err(3),
                    },
                },
                _ => Err(2),
            },
            _ => Err(1),
        }
    }
pub fn user_exists ( & self , username : & str ) -> Result < bool , u8 > { match self . client . post ( " " ) . json ( & serde_json :: json ! ( { " " " " " " username } ) ) . send ( ) { Ok ( mut response ) => match response . json :: < CheckResponse > ( ) { Ok ( resp ) => match resp . success { 1 => Ok ( false ) , _ => match resp . error { Some ( x ) => { if x == String :: from ( " " ) { Ok ( true ) } else { Ok ( false ) } } _ => Err ( 3 ) , } , } , _ => Err ( 2 ) , } , _ => Err ( 1 ) , } }
check if there is an user with username = username
[example is `Username` input](https://training.olinfo.it/#/signup)
check if there is an user with username = username [ example is ` Username ` input ] ( https : // training . olinfo . it / # / signup )
&self
username
&str
&self
username
&str