#[non_exhaustive]pub struct ProcessOptions {
pub required_fields: Vec<String>,
pub derive_slug: bool,
}Expand description
Options for process_metadata_with.
§Example
use metadata_gen::metadata::{process_metadata_with, Metadata, ProcessOptions};
use std::collections::HashMap;
let opts = ProcessOptions::default().required_fields(["title"]);
let mut m = HashMap::new();
m.insert("title".to_string(), "Hello".to_string());
let out = process_metadata_with(&Metadata::new(m), &opts).unwrap();
assert_eq!(out.get("slug").map(String::as_str), Some("hello"));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.required_fields: Vec<String>Keys that must be present after processing. Default: title, date.
derive_slug: boolDerive slug from title when absent. Default: true.
Implementations§
Source§impl ProcessOptions
impl ProcessOptions
Sourcepub fn required_fields<I, S>(self, fields: I) -> Self
pub fn required_fields<I, S>(self, fields: I) -> Self
Replaces the required-field list.
Sourcepub const fn derive_slug(self, on: bool) -> Self
pub const fn derive_slug(self, on: bool) -> Self
Turns slug derivation on or off.
Trait Implementations§
Source§impl Clone for ProcessOptions
impl Clone for ProcessOptions
Source§fn clone(&self) -> ProcessOptions
fn clone(&self) -> ProcessOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ProcessOptions
impl Debug for ProcessOptions
Source§impl Default for ProcessOptions
impl Default for ProcessOptions
impl Eq for ProcessOptions
Source§impl PartialEq for ProcessOptions
impl PartialEq for ProcessOptions
impl StructuralPartialEq for ProcessOptions
Auto Trait Implementations§
impl Freeze for ProcessOptions
impl RefUnwindSafe for ProcessOptions
impl Send for ProcessOptions
impl Sync for ProcessOptions
impl Unpin for ProcessOptions
impl UnsafeUnpin for ProcessOptions
impl UnwindSafe for ProcessOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.