Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[macro_use]
- extern crate serde_derive;
- #[derive(Debug, Deserialize)]
- pub struct SignUpParams<'a> {
- pub username: &'a str,
- pub password: &'a str,
- }
- fn create(d: &[u8]) -> SignUpParams {
- serde_json::from_slice::<SignUpParams>(d).unwrap()
- }
- fn main() {
- let s = String::from("{\"username\":\"abc\",\"password\":\"123\"}");
- let _ = create(s.as_bytes());
- println!("Hello, world!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement