pub struct CustomBehavior { /* private fields */ }Expand description
Behavior implementation for custom (Lua-defined) note types.
Implementations§
Source§impl CustomBehavior
impl CustomBehavior
Sourcepub fn new(typedef: Arc<TypeDefinition>) -> Self
pub fn new(typedef: Arc<TypeDefinition>) -> Self
Create a new CustomBehavior wrapping a Lua typedef.
Sourcepub fn typedef(&self) -> &TypeDefinition
pub fn typedef(&self) -> &TypeDefinition
Get the underlying typedef.
Trait Implementations§
Source§impl NoteBehavior for CustomBehavior
impl NoteBehavior for CustomBehavior
Source§impl NoteIdentity for CustomBehavior
impl NoteIdentity for CustomBehavior
Source§fn generate_id(
&self,
_ctx: &CreationContext<'_>,
) -> DomainResult<Option<String>>
fn generate_id( &self, _ctx: &CreationContext<'_>, ) -> DomainResult<Option<String>>
Generate a unique ID for this note type.
Returns None if this type doesn’t use IDs (e.g., daily notes use dates).
Source§fn output_path(&self, ctx: &CreationContext<'_>) -> DomainResult<PathBuf>
fn output_path(&self, ctx: &CreationContext<'_>) -> DomainResult<PathBuf>
Determine the output path for this note.
This is called after prompts are collected and before_create runs.
Source§fn core_fields(&self) -> Vec<&'static str>
fn core_fields(&self) -> Vec<&'static str>
Get the fields that this type manages (core metadata).
These fields will be preserved through template/hook modifications.
Source§impl NoteLifecycle for CustomBehavior
impl NoteLifecycle for CustomBehavior
Source§fn before_create(&self, _ctx: &mut CreationContext<'_>) -> DomainResult<()>
fn before_create(&self, _ctx: &mut CreationContext<'_>) -> DomainResult<()>
Called before the note is written to disk.
Can modify the context (e.g., set computed vars, update counters).
Source§fn after_create(
&self,
_ctx: &CreationContext<'_>,
_content: &str,
) -> DomainResult<()>
fn after_create( &self, _ctx: &CreationContext<'_>, _content: &str, ) -> DomainResult<()>
Called after the note is successfully written to disk.
Used for side effects (logging to daily, reindexing, etc.).
Source§impl NotePrompts for CustomBehavior
impl NotePrompts for CustomBehavior
Source§fn type_prompts(&self, _ctx: &PromptContext<'_>) -> Vec<FieldPrompt>
fn type_prompts(&self, _ctx: &PromptContext<'_>) -> Vec<FieldPrompt>
Return type-specific prompts (e.g., project selector for tasks).
These run BEFORE schema-based prompts.
Source§fn should_prompt_schema(&self) -> bool
fn should_prompt_schema(&self) -> bool
Whether this type should prompt for schema fields.
Default: true. Override to false for types that compute all fields.
Auto Trait Implementations§
impl Freeze for CustomBehavior
impl RefUnwindSafe for CustomBehavior
impl Send for CustomBehavior
impl Sync for CustomBehavior
impl Unpin for CustomBehavior
impl UnsafeUnpin for CustomBehavior
impl UnwindSafe for CustomBehavior
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