pub struct InMemoryBackend { /* private fields */ }Expand description
In-memory backend for client, bridge-adapter, and runtime tests.
Implementations§
Source§impl InMemoryBackend
impl InMemoryBackend
Sourcepub fn upsert_dialog(&self, dialog: DialogRecord)
pub fn upsert_dialog(&self, dialog: DialogRecord)
Inserts or replaces a dialog.
Sourcepub fn set_chat_participants(
&self,
chat_id: InlineId,
participants: Vec<ChatParticipantRecord>,
)
pub fn set_chat_participants( &self, chat_id: InlineId, participants: Vec<ChatParticipantRecord>, )
Replaces the participant snapshot for a chat.
Sourcepub fn insert_message(&self, message: MessageRecord)
pub fn insert_message(&self, message: MessageRecord)
Inserts a message into the in-memory history.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns whether the backend is connected.
Trait Implementations§
Source§impl ClientBackend for InMemoryBackend
impl ClientBackend for InMemoryBackend
Source§fn auth_start(
&self,
request: AuthStartRequest,
) -> BoxFuture<'static, BackendResult<AuthStartResult>>
fn auth_start( &self, request: AuthStartRequest, ) -> BoxFuture<'static, BackendResult<AuthStartResult>>
Sends an Inline login code.
Source§fn auth_verify(
&self,
request: AuthVerifyRequest,
) -> BoxFuture<'static, BackendResult<AuthVerifyResult>>
fn auth_verify( &self, request: AuthVerifyRequest, ) -> BoxFuture<'static, BackendResult<AuthVerifyResult>>
Verifies an Inline login code and persists the resulting session.
Source§fn resume_session(
&self,
) -> BoxFuture<'static, BackendResult<ClientStatusSnapshot>>
fn resume_session( &self, ) -> BoxFuture<'static, BackendResult<ClientStatusSnapshot>>
Resumes a previously stored session, if available.
Source§fn connect(
&self,
request: ConnectRequest,
) -> BoxFuture<'static, BackendResult<ClientStatusSnapshot>>
fn connect( &self, request: ConnectRequest, ) -> BoxFuture<'static, BackendResult<ClientStatusSnapshot>>
Connects or reconnects the client.
Source§fn dialogs(
&self,
request: DialogsRequest,
) -> BoxFuture<'static, BackendResult<DialogsPage>>
fn dialogs( &self, request: DialogsRequest, ) -> BoxFuture<'static, BackendResult<DialogsPage>>
Lists dialogs.
Source§fn history(
&self,
request: HistoryRequest,
) -> BoxFuture<'static, BackendResult<HistoryPage>>
fn history( &self, request: HistoryRequest, ) -> BoxFuture<'static, BackendResult<HistoryPage>>
Fetches chat history.
Source§fn chat_participants(
&self,
request: ChatParticipantsRequest,
) -> BoxFuture<'static, BackendResult<ChatParticipantsPage>>
fn chat_participants( &self, request: ChatParticipantsRequest, ) -> BoxFuture<'static, BackendResult<ChatParticipantsPage>>
Fetches chat participants.
Source§fn create_dm(
&self,
request: CreateDmRequest,
) -> BoxFuture<'static, BackendResult<CreatedChat>>
fn create_dm( &self, request: CreateDmRequest, ) -> BoxFuture<'static, BackendResult<CreatedChat>>
Creates or opens a direct message chat.
Source§fn create_thread(
&self,
request: CreateThreadRequest,
) -> BoxFuture<'static, BackendResult<CreatedChat>>
fn create_thread( &self, request: CreateThreadRequest, ) -> BoxFuture<'static, BackendResult<CreatedChat>>
Creates a regular Inline thread chat.
Source§fn create_reply_thread(
&self,
request: CreateReplyThreadRequest,
) -> BoxFuture<'static, BackendResult<CreatedChat>>
fn create_reply_thread( &self, request: CreateReplyThreadRequest, ) -> BoxFuture<'static, BackendResult<CreatedChat>>
Creates a child/reply Inline thread chat.
Source§fn send_text(
&self,
request: SendTextRequest,
) -> BoxFuture<'static, BackendResult<SendTextOutcome>>
fn send_text( &self, request: SendTextRequest, ) -> BoxFuture<'static, BackendResult<SendTextOutcome>>
Sends a text message.
Source§fn send_media(
&self,
request: UploadRequest,
bytes: Vec<u8>,
) -> BoxFuture<'static, BackendResult<SendTextOutcome>>
fn send_media( &self, request: UploadRequest, bytes: Vec<u8>, ) -> BoxFuture<'static, BackendResult<SendTextOutcome>>
Uploads and sends a media message.
Source§fn edit_message(
&self,
request: EditMessageRequest,
) -> BoxFuture<'static, BackendResult<OperationOutcome>>
fn edit_message( &self, request: EditMessageRequest, ) -> BoxFuture<'static, BackendResult<OperationOutcome>>
Edits a text message.
Source§fn delete_message(
&self,
request: DeleteMessageRequest,
) -> BoxFuture<'static, BackendResult<OperationOutcome>>
fn delete_message( &self, request: DeleteMessageRequest, ) -> BoxFuture<'static, BackendResult<OperationOutcome>>
Deletes or unsends a message.
Source§fn react(
&self,
request: ReactRequest,
) -> BoxFuture<'static, BackendResult<OperationOutcome>>
fn react( &self, request: ReactRequest, ) -> BoxFuture<'static, BackendResult<OperationOutcome>>
Adds or removes a reaction.
Source§fn read(
&self,
request: ReadRequest,
) -> BoxFuture<'static, BackendResult<OperationOutcome>>
fn read( &self, request: ReadRequest, ) -> BoxFuture<'static, BackendResult<OperationOutcome>>
Marks messages read.
Source§fn typing(
&self,
request: TypingRequest,
) -> BoxFuture<'static, BackendResult<OperationOutcome>>
fn typing( &self, request: TypingRequest, ) -> BoxFuture<'static, BackendResult<OperationOutcome>>
Sends a typing state.
Source§impl Clone for InMemoryBackend
impl Clone for InMemoryBackend
Source§fn clone(&self) -> InMemoryBackend
fn clone(&self) -> InMemoryBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryBackend
impl Debug for InMemoryBackend
Source§impl Default for InMemoryBackend
impl Default for InMemoryBackend
Source§fn default() -> InMemoryBackend
fn default() -> InMemoryBackend
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InMemoryBackend
impl RefUnwindSafe for InMemoryBackend
impl Send for InMemoryBackend
impl Sync for InMemoryBackend
impl Unpin for InMemoryBackend
impl UnsafeUnpin for InMemoryBackend
impl UnwindSafe for InMemoryBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more