pub struct SectionBuilder { /* private fields */ }Expand description
Fluent builder for a single section.
Implementations§
Source§impl SectionBuilder
impl SectionBuilder
Sourcepub fn field(self, key: &str, label: &str) -> Self
pub fn field(self, key: &str, label: &str) -> Self
Add a value field — renders as “Label: {value}.” when the key exists.
Sourcepub fn flag(self, key: &str, label: &str) -> Self
pub fn flag(self, key: &str, label: &str) -> Self
Add a bool flag — renders “Label.” when true, omitted when false/missing.
Sourcepub fn sentiment(self, key: &str) -> Self
pub fn sentiment(self, key: &str) -> Self
Add a sentiment field — renders “Caller seems {value}.” when non-neutral.
Sourcepub fn format(
self,
key: &str,
label: &str,
f: impl Fn(&Value) -> String + Send + Sync + 'static,
) -> Self
pub fn format( self, key: &str, label: &str, f: impl Fn(&Value) -> String + Send + Sync + 'static, ) -> Self
Add a field with a custom formatter.
The formatter receives the raw JSON value and returns a string. Return an empty string to skip the field.
Sourcepub fn section(self, label: &str) -> SectionBuilder
pub fn section(self, label: &str) -> SectionBuilder
Start a new section (finalizes the current one).
Sourcepub fn build(self) -> ContextBuilder
pub fn build(self) -> ContextBuilder
Build the final ContextBuilder.
Auto Trait Implementations§
impl Freeze for SectionBuilder
impl !RefUnwindSafe for SectionBuilder
impl Send for SectionBuilder
impl Sync for SectionBuilder
impl Unpin for SectionBuilder
impl !UnwindSafe for SectionBuilder
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