[][src]Module tbot::state::messages

A store for state per message.

The Messages store can be used to store state for each message separately. For example, when a chatting bot broadcasts a message from Alice to Bob, it can store the ID of the broadcasted message as the state for the original message's ID, and if Alice edits her message, the bot can edit the corresponding message on Bob's side.

Messages has a similar API to the API of Chats — all of the methods from the latter are adapted for the former, except that the key is a special structure MessageId, which contains a message's and its chat's IDs. In addition, for each method working with all records, Messages provides additional methods with the in_chat[_by_id] postfix that work only with messages with the specified chat ID. For example, len returns the amount of all records, while len_in_chat returns the amount of records with the specified chat (which is inferred from the context in the case of this method; len_in_chat_by_id, on the other hand, takes a chat ID directly).

Structs

Iter

An iterator over the entries of Messages.

IterMut

A mutable iterator over the entries of Messages.

MessageId

A struct containing the message's and its chat's IDs.

Messages

A store for state per message. See module docs to learn how to use it.