#[non_exhaustive]pub struct UpdateFrontMatterSchemaOperation {
pub key: String,
pub old_schema: FrontMatterValueSchema,
pub old_value: Option<FrontMatterValue>,
pub new_schema: Option<FrontMatterValueSchema>,
pub new_value: Option<FrontMatterValue>,
pub delete_value: bool,
}Expand description
Changes the expected schema of a front matter key in a notebook and/or the value attached to a schema
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.key: StringThe key of the front matter schema to update.
old_schema: FrontMatterValueSchemaThe previous schema used for that front matter key. The old value is used to make consistency checks, as well as revert the operation.
old_value: Option<FrontMatterValue>The previous value for that front matter key. It is used for consistency checks, as well as making reverting operations possible.
new_schema: Option<FrontMatterValueSchema>The new schema to use, if unspecified the operation will leave the schema untouched (so the operation is only being used to edit the associated value).
If a new schema is specified, and the data type does not match between the old and the new one, then the old value will be wiped anyway.
new_value: Option<FrontMatterValue>The new value to set for the front matter entry.
If this attribute is None or null it can mean multiple things depending on
the other attributes:
- if
delete_valueisfalse, this means we want to keep theold_value- it is impossible to keep the
old_valueif the schemas are incompatible. In that case we use thedefault_valueof the new schema (or nothing if there’s no default)
- it is impossible to keep the
- if
delete_valueistrue, this means we want to wipe the value from the front matter in all cases.
delete_value: boolSwitch that controls front matter value edition alongside new_value, when
new_value is None.
Implementations§
source§impl UpdateFrontMatterSchemaOperation
impl UpdateFrontMatterSchemaOperation
sourcepub fn builder(
) -> UpdateFrontMatterSchemaOperationBuilder<((), (), (), (), (), ())>
pub fn builder( ) -> UpdateFrontMatterSchemaOperationBuilder<((), (), (), (), (), ())>
Create a builder for building UpdateFrontMatterSchemaOperation.
On the builder, call .key(...), .old_schema(...), .old_value(...)(optional), .new_schema(...), .new_value(...)(optional), .delete_value(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of UpdateFrontMatterSchemaOperation.
Trait Implementations§
source§impl Clone for UpdateFrontMatterSchemaOperation
impl Clone for UpdateFrontMatterSchemaOperation
source§fn clone(&self) -> UpdateFrontMatterSchemaOperation
fn clone(&self) -> UpdateFrontMatterSchemaOperation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<'de> Deserialize<'de> for UpdateFrontMatterSchemaOperation
impl<'de> Deserialize<'de> for UpdateFrontMatterSchemaOperation
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>,
source§impl PartialEq for UpdateFrontMatterSchemaOperation
impl PartialEq for UpdateFrontMatterSchemaOperation
source§fn eq(&self, other: &UpdateFrontMatterSchemaOperation) -> bool
fn eq(&self, other: &UpdateFrontMatterSchemaOperation) -> bool
self and other values to be equal, and is used
by ==.