Struct SectionBuilder
pub struct SectionBuilder { /* private fields */ }Expand description
Fluent builder for a single section.
Implementations§
§impl SectionBuilder
impl SectionBuilder
pub fn field(self, key: &str, label: &str) -> SectionBuilder
pub fn field(self, key: &str, label: &str) -> SectionBuilder
Add a value field — renders as “Label: {value}.” when the key exists.
pub fn flag(self, key: &str, label: &str) -> SectionBuilder
pub fn flag(self, key: &str, label: &str) -> SectionBuilder
Add a bool flag — renders “Label.” when true, omitted when false/missing.
pub fn sentiment(self, key: &str) -> SectionBuilder
pub fn sentiment(self, key: &str) -> SectionBuilder
Add a sentiment field — renders “Caller seems {value}.” when non-neutral.
pub fn format(
self,
key: &str,
label: &str,
f: impl Fn(&Value) -> String + Send + Sync + 'static,
) -> SectionBuilder
pub fn format( self, key: &str, label: &str, f: impl Fn(&Value) -> String + Send + Sync + 'static, ) -> SectionBuilder
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.
pub fn section(self, label: &str) -> SectionBuilder
pub fn section(self, label: &str) -> SectionBuilder
Start a new section (finalizes the current one).
pub 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