summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorjosh rotenberg <joshrotenberg@gmail.com>2021-07-04 14:44:23 -0700
committerjosh rotenberg <joshrotenberg@gmail.com>2021-07-04 14:44:23 -0700
commitb87c231fc3347d98bbc03cac536c050239a7abe0 (patch)
tree18d9367e44a24720b847d68f1c9fdf577c71ccf9 /src/config.rs
parentb3c0b013501b43468852f4fb648e7a80495f8cd4 (diff)
first pass at 2021 support
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index c384192c..bf4aabbb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -467,6 +467,9 @@ pub struct RustConfig {
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
/// Rust edition to use for the code.
pub enum RustEdition {
+ /// The 2021 edition of Rust
+ #[serde(rename = "2021")]
+ E2021,
/// The 2018 edition of Rust
#[serde(rename = "2018")]
E2018,
@@ -856,6 +859,26 @@ mod tests {
}
#[test]
+ fn edition_2021() {
+ let src = r#"
+ [book]
+ title = "mdBook Documentation"
+ description = "Create book from markdown files. Like Gitbook but implemented in Rust"
+ authors = ["Mathieu David"]
+ src = "./source"
+ [rust]
+ edition = "2021"
+ "#;
+
+ let rust_should_be = RustConfig {
+ edition: Some(RustEdition::E2021),
+ };
+
+ let got = Config::from_str(src).unwrap();
+ assert_eq!(got.rust, rust_should_be);
+ }
+
+ #[test]
fn load_arbitrary_output_type() {
#[derive(Debug, Deserialize, PartialEq)]
struct RandomOutput {