@@ -64,6 +64,7 @@ use toml::value::Table;
6464/// The overall configuration object for MDBook, essentially an in-memory
6565/// representation of `book.toml`.
6666#[ derive( Debug , Clone , PartialEq ) ]
67+ #[ non_exhaustive]
6768pub struct Config {
6869 /// Metadata about the book.
6970 pub book : BookConfig ,
@@ -386,6 +387,7 @@ fn is_legacy_format(table: &Value) -> bool {
386387/// loading it from disk.
387388#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
388389#[ serde( default , rename_all = "kebab-case" ) ]
390+ #[ non_exhaustive]
389391pub struct BookConfig {
390392 /// The book's title.
391393 pub title : Option < String > ,
@@ -429,6 +431,7 @@ impl BookConfig {
429431
430432/// Text direction to use for HTML output
431433#[ derive( Debug , Copy , Clone , PartialEq , Serialize , Deserialize ) ]
434+ #[ non_exhaustive]
432435pub enum TextDirection {
433436 /// Left to right.
434437 #[ serde( rename = "ltr" ) ]
@@ -454,6 +457,7 @@ impl TextDirection {
454457/// Configuration for the build procedure.
455458#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
456459#[ serde( default , rename_all = "kebab-case" ) ]
460+ #[ non_exhaustive]
457461pub struct BuildConfig {
458462 /// Where to put built artefacts relative to the book's root directory.
459463 pub build_dir : PathBuf ,
@@ -481,13 +485,15 @@ impl Default for BuildConfig {
481485/// Configuration for the Rust compiler(e.g., for playground)
482486#[ derive( Debug , Default , Clone , PartialEq , Serialize , Deserialize ) ]
483487#[ serde( default , rename_all = "kebab-case" ) ]
488+ #[ non_exhaustive]
484489pub struct RustConfig {
485490 /// Rust edition used in playground
486491 pub edition : Option < RustEdition > ,
487492}
488493
489- #[ derive( Debug , Copy , Clone , PartialEq , Serialize , Deserialize ) ]
490494/// Rust edition to use for the code.
495+ #[ derive( Debug , Copy , Clone , PartialEq , Serialize , Deserialize ) ]
496+ #[ non_exhaustive]
491497pub enum RustEdition {
492498 /// The 2024 edition of Rust
493499 #[ serde( rename = "2024" ) ]
@@ -506,6 +512,7 @@ pub enum RustEdition {
506512/// Configuration for the HTML renderer.
507513#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
508514#[ serde( default , rename_all = "kebab-case" ) ]
515+ #[ non_exhaustive]
509516pub struct HtmlConfig {
510517 /// The theme directory, if specified.
511518 pub theme : Option < PathBuf > ,
@@ -625,6 +632,7 @@ impl HtmlConfig {
625632/// Configuration for how to render the print icon, print.html, and print.css.
626633#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
627634#[ serde( default , rename_all = "kebab-case" ) ]
635+ #[ non_exhaustive]
628636pub struct Print {
629637 /// Whether print support is enabled.
630638 pub enable : bool ,
@@ -644,6 +652,7 @@ impl Default for Print {
644652/// Configuration for how to fold chapters of sidebar.
645653#[ derive( Default , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
646654#[ serde( default , rename_all = "kebab-case" ) ]
655+ #[ non_exhaustive]
647656pub struct Fold {
648657 /// When off, all folds are open. Default: `false`.
649658 pub enable : bool ,
@@ -656,6 +665,7 @@ pub struct Fold {
656665/// Configuration for tweaking how the HTML renderer handles the playground.
657666#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
658667#[ serde( default , rename_all = "kebab-case" ) ]
668+ #[ non_exhaustive]
659669pub struct Playground {
660670 /// Should playground snippets be editable? Default: `false`.
661671 pub editable : bool ,
@@ -685,6 +695,7 @@ impl Default for Playground {
685695/// Configuration for tweaking how the HTML renderer handles code blocks.
686696#[ derive( Debug , Default , Clone , PartialEq , Serialize , Deserialize ) ]
687697#[ serde( default , rename_all = "kebab-case" ) ]
698+ #[ non_exhaustive]
688699pub struct Code {
689700 /// A prefix string to hide lines per language (one or more chars).
690701 pub hidelines : HashMap < String , String > ,
@@ -693,6 +704,7 @@ pub struct Code {
693704/// Configuration of the search functionality of the HTML renderer.
694705#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
695706#[ serde( default , rename_all = "kebab-case" ) ]
707+ #[ non_exhaustive]
696708pub struct Search {
697709 /// Enable the search feature. Default: `true`.
698710 pub enable : bool ,
@@ -750,6 +762,7 @@ impl Default for Search {
750762/// Search options for chapters (or paths).
751763#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize , Default ) ]
752764#[ serde( default , rename_all = "kebab-case" ) ]
765+ #[ non_exhaustive]
753766pub struct SearchChapterSettings {
754767 /// Whether or not indexing is enabled, default `true`.
755768 pub enable : Option < bool > ,
0 commit comments