Struct StateContainer

Source
pub struct StateContainer<S, T>
where S: StateResolver<T>, T: Clone,
{ /* private fields */ }
Expand description

This is what is used internally take care of input and manage flushing and handling retries.

Implementations§

Source§

impl<S, T> StateContainer<S, T>
where S: StateResolver<T>, T: Clone,

Source

pub fn feed(&mut self, input: &T)

Takes the log events and processes it in the state. Note that it does not guarantee that the event will be processed immediately. In some situations the event will be queued when the state things it is better able to process the event, but it doesn’t do this automatically. For those events to be processed, you need to call StateContainer::flush. This will go through the remaining events and tries to process them.

Source

pub fn flush(&mut self)

Processes any left-over events that were scheduled for later processing. Call this sparingly especially not while you’re also still reading a lot of events through StateContainer::feed as that will likely cause performance issues.

Trait Implementations§

Source§

impl<S, T> Debug for StateContainer<S, T>
where S: StateResolver<T> + Debug, T: Clone,

Source§

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

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

impl<S, T> Default for StateContainer<S, T>
where S: StateResolver<T> + Default, T: Clone,

Source§

fn default() -> Self

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

impl<S, T> DerefMut for StateContainer<S, T>
where S: StateResolver<T>, T: Clone,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de, S, T> Deserialize<'de> for StateContainer<S, T>
where S: StateResolver<T> + Deserialize<'de>, T: Clone,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<S, T> From<S> for StateContainer<S, T>
where S: StateResolver<T>, T: Clone,

Source§

fn from(value: S) -> Self

Converts to this type from the input type.
Source§

impl<S, T> Serialize for StateContainer<S, T>
where S: StateResolver<T> + Serialize, T: Clone,

Source§

fn serialize<Se>(&self, serializer: Se) -> Result<Se::Ok, Se::Error>
where Se: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<S, T> Deref for StateContainer<S, T>
where S: StateResolver<T>, T: Clone,

Source§

type Target = S

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<S, T> Freeze for StateContainer<S, T>
where S: Freeze,

§

impl<S, T> RefUnwindSafe for StateContainer<S, T>

§

impl<S, T> Send for StateContainer<S, T>
where S: Send, T: Send,

§

impl<S, T> Sync for StateContainer<S, T>
where S: Sync, T: Sync,

§

impl<S, T> Unpin for StateContainer<S, T>
where S: Unpin, T: Unpin,

§

impl<S, T> UnwindSafe for StateContainer<S, T>
where S: UnwindSafe, T: UnwindSafe,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,