Skip to main content

NarrativeBuilder

Struct NarrativeBuilder 

Source
pub struct NarrativeBuilder { /* private fields */ }
Expand description

Builder for constructing Narrative instances.

Implementations§

Source§

impl NarrativeBuilder

Source

pub fn new() -> Self

Creates a new NarrativeBuilder.

Source

pub fn id(self, id: NarrativeId) -> Self

Sets the narrative ID.

Source

pub fn title(self, title: impl Into<String>) -> Self

Sets the title.

Source

pub fn event(self, event: Event) -> Self

Adds an event.

Source

pub fn events(self, events: impl IntoIterator<Item = Event>) -> Self

Adds multiple events.

Source

pub fn author(self, author: impl Into<String>) -> Self

Sets the author.

Source

pub fn description(self, description: impl Into<String>) -> Self

Sets the description.

Source

pub fn category(self, category: impl Into<String>) -> Self

Sets the category.

Source

pub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self

Adds a metadata key-value pair.

Source

pub fn tag(self, tag: impl Into<String>) -> Self

Adds a tag.

Source

pub fn tags(self, tags: impl IntoIterator<Item = impl Into<String>>) -> Self

Adds multiple tags.

Source

pub fn build(self) -> Narrative

Builds the Narrative.

Trait Implementations§

Source§

impl Debug for NarrativeBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NarrativeBuilder

Source§

fn default() -> NarrativeBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.