@@ -64,6 +64,7 @@ use toml::value::Table;
64
64
/// The overall configuration object for MDBook, essentially an in-memory
65
65
/// representation of `book.toml`.
66
66
#[ derive( Debug , Clone , PartialEq ) ]
67
+ #[ non_exhaustive]
67
68
pub struct Config {
68
69
/// Metadata about the book.
69
70
pub book : BookConfig ,
@@ -386,6 +387,7 @@ fn is_legacy_format(table: &Value) -> bool {
386
387
/// loading it from disk.
387
388
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
388
389
#[ serde( default , rename_all = "kebab-case" ) ]
390
+ #[ non_exhaustive]
389
391
pub struct BookConfig {
390
392
/// The book's title.
391
393
pub title : Option < String > ,
@@ -429,6 +431,7 @@ impl BookConfig {
429
431
430
432
/// Text direction to use for HTML output
431
433
#[ derive( Debug , Copy , Clone , PartialEq , Serialize , Deserialize ) ]
434
+ #[ non_exhaustive]
432
435
pub enum TextDirection {
433
436
/// Left to right.
434
437
#[ serde( rename = "ltr" ) ]
@@ -454,6 +457,7 @@ impl TextDirection {
454
457
/// Configuration for the build procedure.
455
458
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
456
459
#[ serde( default , rename_all = "kebab-case" ) ]
460
+ #[ non_exhaustive]
457
461
pub struct BuildConfig {
458
462
/// Where to put built artefacts relative to the book's root directory.
459
463
pub build_dir : PathBuf ,
@@ -481,13 +485,15 @@ impl Default for BuildConfig {
481
485
/// Configuration for the Rust compiler(e.g., for playground)
482
486
#[ derive( Debug , Default , Clone , PartialEq , Serialize , Deserialize ) ]
483
487
#[ serde( default , rename_all = "kebab-case" ) ]
488
+ #[ non_exhaustive]
484
489
pub struct RustConfig {
485
490
/// Rust edition used in playground
486
491
pub edition : Option < RustEdition > ,
487
492
}
488
493
489
- #[ derive( Debug , Copy , Clone , PartialEq , Serialize , Deserialize ) ]
490
494
/// Rust edition to use for the code.
495
+ #[ derive( Debug , Copy , Clone , PartialEq , Serialize , Deserialize ) ]
496
+ #[ non_exhaustive]
491
497
pub enum RustEdition {
492
498
/// The 2024 edition of Rust
493
499
#[ serde( rename = "2024" ) ]
@@ -506,6 +512,7 @@ pub enum RustEdition {
506
512
/// Configuration for the HTML renderer.
507
513
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
508
514
#[ serde( default , rename_all = "kebab-case" ) ]
515
+ #[ non_exhaustive]
509
516
pub struct HtmlConfig {
510
517
/// The theme directory, if specified.
511
518
pub theme : Option < PathBuf > ,
@@ -625,6 +632,7 @@ impl HtmlConfig {
625
632
/// Configuration for how to render the print icon, print.html, and print.css.
626
633
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
627
634
#[ serde( default , rename_all = "kebab-case" ) ]
635
+ #[ non_exhaustive]
628
636
pub struct Print {
629
637
/// Whether print support is enabled.
630
638
pub enable : bool ,
@@ -644,6 +652,7 @@ impl Default for Print {
644
652
/// Configuration for how to fold chapters of sidebar.
645
653
#[ derive( Default , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
646
654
#[ serde( default , rename_all = "kebab-case" ) ]
655
+ #[ non_exhaustive]
647
656
pub struct Fold {
648
657
/// When off, all folds are open. Default: `false`.
649
658
pub enable : bool ,
@@ -656,6 +665,7 @@ pub struct Fold {
656
665
/// Configuration for tweaking how the HTML renderer handles the playground.
657
666
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
658
667
#[ serde( default , rename_all = "kebab-case" ) ]
668
+ #[ non_exhaustive]
659
669
pub struct Playground {
660
670
/// Should playground snippets be editable? Default: `false`.
661
671
pub editable : bool ,
@@ -685,6 +695,7 @@ impl Default for Playground {
685
695
/// Configuration for tweaking how the HTML renderer handles code blocks.
686
696
#[ derive( Debug , Default , Clone , PartialEq , Serialize , Deserialize ) ]
687
697
#[ serde( default , rename_all = "kebab-case" ) ]
698
+ #[ non_exhaustive]
688
699
pub struct Code {
689
700
/// A prefix string to hide lines per language (one or more chars).
690
701
pub hidelines : HashMap < String , String > ,
@@ -693,6 +704,7 @@ pub struct Code {
693
704
/// Configuration of the search functionality of the HTML renderer.
694
705
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize ) ]
695
706
#[ serde( default , rename_all = "kebab-case" ) ]
707
+ #[ non_exhaustive]
696
708
pub struct Search {
697
709
/// Enable the search feature. Default: `true`.
698
710
pub enable : bool ,
@@ -750,6 +762,7 @@ impl Default for Search {
750
762
/// Search options for chapters (or paths).
751
763
#[ derive( Debug , Clone , PartialEq , Serialize , Deserialize , Default ) ]
752
764
#[ serde( default , rename_all = "kebab-case" ) ]
765
+ #[ non_exhaustive]
753
766
pub struct SearchChapterSettings {
754
767
/// Whether or not indexing is enabled, default `true`.
755
768
pub enable : Option < bool > ,
0 commit comments