diff --git a/src/file.rs b/src/file.rs index d61ee48..7cae620 100644 --- a/src/file.rs +++ b/src/file.rs @@ -6,7 +6,8 @@ use crate::{Error, Partial, error::ErrorInner}; /// A file as source for configuration. /// /// By default, the file is considered optional, meaning that on [`File::load`], -/// if the file does not exist, `Partial::empty()` is returned. +/// if the file does not exist, [`Partial::empty()`][crate::Partial::empty] is +/// returned. pub struct File { path: PathBuf, format: FileFormat, diff --git a/src/lib.rs b/src/lib.rs index 5b43abe..a3cc35a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -108,7 +108,8 @@ pub use self::{ /// /// - **`Option`**: this marks the field as an optional field. All other /// fields are non-optional and will raise an error if while loading the -/// configuration, no value has been set for them. +/// configuration, no value has been set for them. Optional fields cannot have +/// a `#[config(default = ...)]` attribute as that would not make sense. /// /// /// diff --git a/src/meta.rs b/src/meta.rs index 82f3463..954ad80 100644 --- a/src/meta.rs +++ b/src/meta.rs @@ -7,6 +7,7 @@ use core::fmt; // fine, but before reaching 1.0 I need to figure out how to allow future // additions without breaking stuff. +/// Root type. #[derive(Clone, Copy, Debug)] pub struct Meta { /// The type (struct) name. @@ -38,9 +39,11 @@ pub enum FieldKind { #[derive(Clone, Copy, Debug)] pub enum LeafKind { + /// A leaf field with a non `Option<_>` type. Required { default: Option, }, + /// A leaf field with an `Option<_>` type. Optional, } diff --git a/src/yaml.rs b/src/yaml.rs index 9c7885d..fde9af4 100644 --- a/src/yaml.rs +++ b/src/yaml.rs @@ -1,3 +1,6 @@ +//! YAML specific features. This module only exists if the Cargo feature `yaml` +//! is enabled. + use std::fmt::{self, Write}; use crate::{