Use serde's `derive` feature instead of directly importing serde_derive

This commit is contained in:
klensy 2022-05-05 09:33:51 +03:00
parent 5bea83114b
commit f3332fb0da
8 changed files with 13 additions and 5 deletions

4
Cargo.lock generated
View File

@ -865,7 +865,6 @@ dependencies = [
"select", "select",
"semver", "semver",
"serde", "serde",
"serde_derive",
"serde_json", "serde_json",
"shlex", "shlex",
"tempfile", "tempfile",
@ -1483,6 +1482,9 @@ name = "serde"
version = "1.0.129" version = "1.0.129"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1" checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1"
dependencies = [
"serde_derive",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"

View File

@ -28,8 +28,7 @@ memchr = "2.0"
opener = "0.5" opener = "0.5"
pulldown-cmark = { version = "0.9.1", default-features = false } pulldown-cmark = { version = "0.9.1", default-features = false }
regex = "1.5.5" regex = "1.5.5"
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
shlex = "1" shlex = "1"
tempfile = "3.0" tempfile = "3.0"

View File

@ -9,6 +9,8 @@ use crate::config::BuildConfig;
use crate::errors::*; use crate::errors::*;
use crate::utils::bracket_escape; use crate::utils::bracket_escape;
use serde::{Deserialize, Serialize};
/// Load a book into memory from its `src/` directory. /// Load a book into memory from its `src/` directory.
pub fn load_book<P: AsRef<Path>>(src_dir: P, cfg: &BuildConfig) -> Result<Book> { pub fn load_book<P: AsRef<Path>>(src_dir: P, cfg: &BuildConfig) -> Result<Book> {
let src_dir = src_dir.as_ref(); let src_dir = src_dir.as_ref();

View File

@ -1,6 +1,7 @@
use crate::errors::*; use crate::errors::*;
use memchr::{self, Memchr}; use memchr::{self, Memchr};
use pulldown_cmark::{self, Event, HeadingLevel, Tag}; use pulldown_cmark::{self, Event, HeadingLevel, Tag};
use serde::{Deserialize, Serialize};
use std::fmt::{self, Display, Formatter}; use std::fmt::{self, Display, Formatter};
use std::iter::FromIterator; use std::iter::FromIterator;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};

View File

@ -89,8 +89,6 @@ extern crate lazy_static;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[macro_use] #[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json; extern crate serde_json;
#[cfg(test)] #[cfg(test)]

View File

@ -16,6 +16,8 @@ use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;
use serde::{Deserialize, Serialize};
/// Extra information for a `Preprocessor` to give them more context when /// Extra information for a `Preprocessor` to give them more context when
/// processing a book. /// processing a book.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]

View File

@ -11,6 +11,8 @@ use crate::errors::*;
use crate::theme::searcher; use crate::theme::searcher;
use crate::utils; use crate::utils;
use serde::Serialize;
/// Creates all files required for search. /// Creates all files required for search.
pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> Result<()> { pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> Result<()> {
let mut index = Index::new(&["title", "body", "breadcrumbs"]); let mut index = Index::new(&["title", "body", "breadcrumbs"]);

View File

@ -29,6 +29,8 @@ use crate::config::Config;
use crate::errors::*; use crate::errors::*;
use toml::Value; use toml::Value;
use serde::{Deserialize, Serialize};
/// An arbitrary `mdbook` backend. /// An arbitrary `mdbook` backend.
/// ///
/// Although it's quite possible for you to import `mdbook` as a library and /// Although it's quite possible for you to import `mdbook` as a library and