January 2019
Intermediate to advanced
520 pages
14h 32m
English
We actually need not only the serde crate but also the serde_derive crate. Both crates help with the serialization struct in various serialization formats. Add all three crates to the dependencies list in Cargo.toml:
serde = "1.0"serde_derive = "1.0"toml = "0.4"
The full list of imports in the main.rs file contains the following:
use clap::{crate_authors, crate_description, crate_name, crate_version, Arg, App};use dotenv::dotenv;use hyper::{Body, Response, Server};use hyper::rt::Future;use hyper::service::service_fn_ok;use log::{debug, info, trace, warn};use serde_derive::Deserialize;use std::env;use std::io::{self, Read};use std::fs::File;use std::net::SocketAddr;
As you can see, we haven't imported the serde crate here. ...
Read now
Unlock full access