pub struct Emitter { /* private fields */ }Expand description
Emits Events to core (NDJSON mode) or renders them for a human (standalone mode).
Construct with Emitter::from_env. The mode is chosen by protocol_mode; callers write the
same code either way.
Implementations§
Source§impl Emitter
impl Emitter
pub fn from_env() -> Self
pub fn log(&self, level: LogLevel, msg: impl Into<String>)
pub fn info(&self, msg: impl Into<String>)
pub fn warn(&self, msg: impl Into<String>)
pub fn error(&self, msg: impl Into<String>)
pub fn progress(&self, done: u64, total: Option<u64>, msg: impl Into<String>)
Sourcepub fn note(&self, relpath: impl Into<String>, action: NoteAction)
pub fn note(&self, relpath: impl Into<String>, action: NoteAction)
Announce a note at relpath (relative to the vault root) so core can index it. Prefer
Emitter::write_note, which writes the file and emits this for you.
Sourcepub fn result_ok_no_index(&self, summary: Value)
pub fn result_ok_no_index(&self, summary: Value)
Terminal success event that tells core not to index afterwards (e.g. --dry-run).
Sourcepub fn result_err(&self, summary: Value)
pub fn result_err(&self, summary: Value)
Terminal failure event.
Sourcepub fn write_note(&self, relpath: &str, body: &str) -> Result<PathBuf>
pub fn write_note(&self, relpath: &str, body: &str) -> Result<PathBuf>
Write a Markdown note into the vault and emit the matching Event::Note.
Guards (contract): relpath must end in .md and must not escape the vault root. Parent
directories are created. Returns the absolute path written.
Sourcepub fn append_note(&self, relpath: &str, body: &str) -> Result<PathBuf>
pub fn append_note(&self, relpath: &str, body: &str) -> Result<PathBuf>
Append to (or create) a Markdown note and emit NoteAction::Append.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Emitter
impl RefUnwindSafe for Emitter
impl Send for Emitter
impl Sync for Emitter
impl Unpin for Emitter
impl UnsafeUnpin for Emitter
impl UnwindSafe for Emitter
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