#[non_exhaustive]pub struct FrontMatterStringSchema {
pub display_name: String,
pub icon_name: Option<String>,
pub multiple: bool,
pub allow_extra_values: bool,
pub options: Option<Vec<FrontMatterStringValue>>,
pub default_value: Option<FrontMatterStringValue>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.display_name: String§icon_name: Option<String>§multiple: boolWhether the field can have multiple values
allow_extra_values: bool§options: Option<Vec<FrontMatterStringValue>>The list of valid “pre-filled” options one can choose for the field.
There is a functional difference between None and Some(Vec::new()):
- When
options.is_none(), that means the current number field should not propose pre-filled values at all: this front matter field is a freeform field - When
options == Some(Vec::new())(arguably withallow_extra_valuesbeing true), that means that the field is supposed to be a “choose value from an enumerated list”-kind of field, but without any pre-existing values being present.
The difference of intent between those two cases can be used on the front-end side to decide how to render the front matter cell
default_value: Option<FrontMatterStringValue>Implementations§
source§impl FrontMatterStringSchema
impl FrontMatterStringSchema
pub fn validate_value( &self, value: Value ) -> Result<FrontMatterValue, FrontMatterValidationError>
pub fn validate_front_matter_value( &self, value: &FrontMatterValue ) -> Result<(), FrontMatterValidationError>
source§impl FrontMatterStringSchema
impl FrontMatterStringSchema
sourcepub fn builder() -> FrontMatterStringSchemaBuilder<((), (), (), (), (), ())>
pub fn builder() -> FrontMatterStringSchemaBuilder<((), (), (), (), (), ())>
Create a builder for building FrontMatterStringSchema.
On the builder, call .display_name(...)(optional), .icon_name(...)(optional), .multiple(...)(optional), .allow_extra_values(...)(optional), .options(...)(optional), .default_value(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of FrontMatterStringSchema.
Trait Implementations§
source§impl Clone for FrontMatterStringSchema
impl Clone for FrontMatterStringSchema
source§fn clone(&self) -> FrontMatterStringSchema
fn clone(&self) -> FrontMatterStringSchema
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for FrontMatterStringSchema
impl Debug for FrontMatterStringSchema
source§impl<'de> Deserialize<'de> for FrontMatterStringSchema
impl<'de> Deserialize<'de> for FrontMatterStringSchema
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<FrontMatterStringSchema> for FrontMatterValueSchema
impl From<FrontMatterStringSchema> for FrontMatterValueSchema
source§fn from(v: FrontMatterStringSchema) -> Self
fn from(v: FrontMatterStringSchema) -> Self
Converts to this type from the input type.
source§impl PartialEq for FrontMatterStringSchema
impl PartialEq for FrontMatterStringSchema
source§fn eq(&self, other: &FrontMatterStringSchema) -> bool
fn eq(&self, other: &FrontMatterStringSchema) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for FrontMatterStringSchema
impl Serialize for FrontMatterStringSchema
impl Eq for FrontMatterStringSchema
impl StructuralPartialEq for FrontMatterStringSchema
Auto Trait Implementations§
impl Freeze for FrontMatterStringSchema
impl RefUnwindSafe for FrontMatterStringSchema
impl Send for FrontMatterStringSchema
impl Sync for FrontMatterStringSchema
impl Unpin for FrontMatterStringSchema
impl UnwindSafe for FrontMatterStringSchema
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more