// This terrible helper is converting `fib 50` into a tuple ("fib", 50)
// we might want to use actual serializable / deserializable structures
// in the real world
This terrible helper is converting `fib 50` into a tuple ("fib", 50)
we might want to use actual serializable / deserializable structures
in the real world
This terrible helper is converting ` fib 50 ` into a tuple ( " fib " 50 ) we might want to use actual serializable / deserializable structures in the real world
fn deserialize_into_fib_command(message: String) -> (String, usize) {
    let arguments: Vec<&str> = message.split(' ').collect();
    let command = arguments.first().map(|s| s.to_string()).unwrap_or_default();
    let number = usize::from_str_radix(arguments.get(1).unwrap_or(&"0"), 10).unwrap_or(0);
    (command, number)
}
fn deserialize_into_fib_command ( message : String ) -> ( String , usize ) { let arguments : Vec < & str > = message . split ( ' ' ) . collect ( ) ; let command = arguments . first ( ) . map ( | s | s . to_string ( ) ) . unwrap_or_default ( ) ; let number = usize :: from_str_radix ( arguments . get ( 1 ) . unwrap_or ( & " " ) , 10 ) . unwrap_or ( 0 ) ; ( command , number ) }
This terrible helper is converting `fib 50` into a tuple ("fib", 50)
we might want to use actual serializable / deserializable structures
in the real world
This terrible helper is converting ` fib 50 ` into a tuple ( " fib " 50 ) we might want to use actual serializable / deserializable structures in the real world
message
String