Minor documentation improvements

This commit is contained in:
Lukas Kalbertodt
2021-07-27 16:20:24 +02:00
parent a86ab50588
commit cc1a0eba5e
4 changed files with 10 additions and 2 deletions

View File

@@ -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,

View File

@@ -108,7 +108,8 @@ pub use self::{
///
/// - **`Option<T>`**: 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.
///
///
///

View File

@@ -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<Expr>,
},
/// A leaf field with an `Option<_>` type.
Optional,
}

View File

@@ -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::{