Struct tbot::state::chats::Chats

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

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

Implementations§

Constructs a new chat storage.

Constructs a new chat storage with capacity for n chats.

Returns an iterator over the stored chat IDs.

Returns an iterator over the stored states.

Returns an iterator over the stored chat IDs and their states.

Returns a mutable iterator over the stored chat IDs and their states.

Returns how many chats are stored.

Returns the storage’s capacity.

Returns true if the store is empty.

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

Clears the store.

Reserves capacity for n additional chats.

Shrinks the storage to already stored chats.

Gets a chat’s state by its ID.

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

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

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

Gets an entry for a chat’s state by its ID.

Gets an entry for a chat’s state, inferring its ID from the context.

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

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

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

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

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

Removes and returns a chat’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