pub struct CreationContext<'a> {
pub title: String,
pub type_name: String,
pub config: &'a ResolvedConfig,
pub typedef: Option<Arc<TypeDefinition>>,
pub registry: &'a TypeRegistry,
pub vars: HashMap<String, String>,
pub core_metadata: CoreMetadata,
pub output_path: Option<PathBuf>,
pub template: Option<LoadedTemplate>,
pub batch_mode: bool,
pub reference_date: Option<NaiveDate>,
}Expand description
Context available during note creation.
Fields§
§title: String§type_name: String§config: &'a ResolvedConfig§typedef: Option<Arc<TypeDefinition>>§registry: &'a TypeRegistry§vars: HashMap<String, String>§core_metadata: CoreMetadata§output_path: Option<PathBuf>§template: Option<LoadedTemplate>§batch_mode: bool§reference_date: Option<NaiveDate>Implementations§
Source§impl<'a> CreationContext<'a>
impl<'a> CreationContext<'a>
Sourcepub fn new(
type_name: &str,
title: &str,
config: &'a ResolvedConfig,
registry: &'a TypeRegistry,
) -> Self
pub fn new( type_name: &str, title: &str, config: &'a ResolvedConfig, registry: &'a TypeRegistry, ) -> Self
Create a new creation context.
Sourcepub fn with_template(self, template: LoadedTemplate) -> Self
pub fn with_template(self, template: LoadedTemplate) -> Self
Set a template to use for content generation.
Sourcepub fn with_batch_mode(self, batch: bool) -> Self
pub fn with_batch_mode(self, batch: bool) -> Self
Set batch mode flag.
Sourcepub fn set_var(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn set_var(&mut self, key: impl Into<String>, value: impl Into<String>)
Set a variable value.
Sourcepub fn to_prompt_context(&self) -> PromptContext<'_>
pub fn to_prompt_context(&self) -> PromptContext<'_>
Create a PromptContext from this CreationContext.
Auto Trait Implementations§
impl<'a> Freeze for CreationContext<'a>
impl<'a> RefUnwindSafe for CreationContext<'a>
impl<'a> Send for CreationContext<'a>
impl<'a> Sync for CreationContext<'a>
impl<'a> Unpin for CreationContext<'a>
impl<'a> UnsafeUnpin for CreationContext<'a>
impl<'a> UnwindSafe for CreationContext<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more