Struct tbot::state::messages::Messages

source ·
pub struct Messages<S> { /* private fields */ }
Expand description

A storage of state per message. See the module’s docs to learn how to use it.

Implementations§

Constructs a new message storage.

Constructs a new message storage with capacity for n messages.

Returns an iterator over the stored messages.

Returns an iterator over stored message IDs for a chat by its ID.

Returns an iterator over stored message IDs for a chat, which ID is inferred from the context.

Returns an iterator over the stored states.

Returns an iterator over stored states for messages in a chat by its ID.

Returns an iterator over stored states for messages in a chat, which ID is inferred from the context.

Returns an iterator over stored messages and their states.

Returns an iterator over stored messages and their states in a chat by its ID.

Returns an iterator over stored messages and their states in a chat, which ID is inferred from the context.

Returns a mutable iterator over the stored messages and their states.

Returns a mutable iterator over the stored messages and their states in a chat by its ID.

Returns a mutable iterator over the stored messages and their states in a chat, which ID is inferred from the context.

Returns an owning iterator over the stored messages and their states in a chat by its ID.

Returns an owning iterator over the stored messages and their states in a chat, which ID is inferred from the context.

Returns how many messages are stored.

Returns how many messages from a chat are stored.

Returns how many messages from a chat, which ID is inferred from the context, are stored.

Returns the storage’s capacity.

Returns true if the store is empty.

Returns if the store does not have messages from a chat.

Returns if the store does not have messages from a chat, inferring its ID from the context.

Clears the storage, returning each stored item in an iterator.

Clears the store.

Deletes state for all messages from a chat.

Deletes state for all messages from a chat, inferring its ID from the context.

Reserves capacity for n additional messages.

Shrinks the capacity to already stored messages.

Gets a message’s state by its ID.

Gets a message’s state, inferring its ID from the context.

Gets a mutable reference to a message’s state by its ID.

Gets a mutable reference to a message’s state, inferring its ID from the context.

Gets an entry to a message’s state by its ID.

Gets an entry to a message’s state, inferring its ID from the context.

Checks if there’s state for a message by its ID.

Checks if there’s state for a message, inferring its ID from the context.

Inserts state for a message by its ID. Returns the previous state.

Inserts state for a message, inferring its ID from the context. Returns the previous state.

Removes and returns a message’s state by its ID.

Removes and returns a message’s state, inferring its ID from the context.

Calls the predicate for each stored entry and deletes entries for which the predicate returns false.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more