pub fn parse(command: Vec<&str>) -> Result<Self, CommandParseError> {
        use CommandParseError::*;
        if command.len() != 2 {
            return Err(WrongNumberOfArgsError(SendCommand::usage()));
        } else {
            let url = match Url::parse(command[1]) {
                Ok(url) => url,
                Err(_) => return Err(UrlParseError),
            };
            let amount = match command[0].parse::<f64>() {
                Ok(amount) => amount,
                Err(_) => return Err(AmountParseError),
            };
            Ok(SendCommand {
                amount,
                destination: Some(url),
            })
        }
    }
/// Convert string tokens of user command parameters to valid Url and float.
Convert string tokens of user command parameters to valid Url and float.
Convert string tokens of user command parameters to valid Url and float .
pub fn parse(command: Vec<&str>) -> Result<Self, CommandParseError> {
        use CommandParseError::*;
        if command.len() != 2 {
            return Err(WrongNumberOfArgsError(SendCommand::usage()));
        } else {
            let url = match Url::parse(command[1]) {
                Ok(url) => url,
                Err(_) => return Err(UrlParseError),
            };
            let amount = match command[0].parse::<f64>() {
                Ok(amount) => amount,
                Err(_) => return Err(AmountParseError),
            };
            Ok(SendCommand {
                amount,
                destination: Some(url),
            })
        }
    }
pub fn parse ( command : Vec < & str > ) -> Result < Self , CommandParseError > { use CommandParseError :: * ; if command . len ( ) != 2 { return Err ( WrongNumberOfArgsError ( SendCommand :: usage ( ) ) ) ; } else { let url = match Url :: parse ( command [ 1 ] ) { Ok ( url ) => url , Err ( _ ) => return Err ( UrlParseError ) , } ; let amount = match command [ 0 ] . parse :: < f64 > ( ) { Ok ( amount ) => amount , Err ( _ ) => return Err ( AmountParseError ) , } ; Ok ( SendCommand { amount , destination : Some ( url ) , } ) } }
Convert string tokens of user command parameters to valid Url and float.
Convert string tokens of user command parameters to valid Url and float .
command
Vec<&str>
command
Vec<&str>