Struct cap_sdk::IndefiniteEventBuilder
source · [−]pub struct IndefiniteEventBuilder { /* private fields */ }Expand description
Constructs an IndefiniteEvent.
If the type used for a call to IndefiniteEventBuilder.details has a non-default
implementation of IntoEvent::operation, it will override the current operation
and cause any call to IndefiniteEventBuilder.operation to panic.
Examples
Create an event with no details
Any IntoEvent type can be substituted into the details call.
⚠️ Note the above statement if that type uses the non-default
implementation of IntoEvent::operation. ⚠️
let event = IndefiniteEventBuilder::new()
.caller(Principal::anonymous())
.status(EventStatus::Completed)
.operation("Foo")
.details(vec![])
.build()?;Implementations
sourceimpl IndefiniteEventBuilder
impl IndefiniteEventBuilder
pub fn new() -> Self
sourcepub fn details(self, details: impl IntoEvent) -> Self
pub fn details(self, details: impl IntoEvent) -> Self
Sets the details of the event.
You can combine multiple IntoEvent types into one IndefiniteEvent
with this method as long as only one of them has a non-default implementation
of IntoEvent::operation.
Panics
Panics if operation has already been set by an IntoEvent::operation call.
sourcepub fn build(self) -> Result<IndefiniteEvent, ()>
pub fn build(self) -> Result<IndefiniteEvent, ()>
Builds an IndefiniteEvent from the builder.
Panics
Panics if caller, operation, or details has not already been set.
Trait Implementations
sourceimpl Clone for IndefiniteEventBuilder
impl Clone for IndefiniteEventBuilder
sourcefn clone(&self) -> IndefiniteEventBuilder
fn clone(&self) -> IndefiniteEventBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Default for IndefiniteEventBuilder
impl Default for IndefiniteEventBuilder
sourcefn default() -> IndefiniteEventBuilder
fn default() -> IndefiniteEventBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for IndefiniteEventBuilder
impl Send for IndefiniteEventBuilder
impl Sync for IndefiniteEventBuilder
impl Unpin for IndefiniteEventBuilder
impl UnwindSafe for IndefiniteEventBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more