pub struct SyncResponseBuilder { /* private fields */ }
Expand description
The SyncResponseBuilder
struct can be used to easily generate valid sync
responses for testing. These can be then fed into either Client
or Room
.
It supports generated a number of canned events, such as a member entering a
room, his power level and display name changing and similar. It also
supports insertion of custom events in the form of EventsJson
values.
Implementations§
Source§impl SyncResponseBuilder
impl SyncResponseBuilder
pub fn new() -> Self
Sourcepub fn add_joined_room(&mut self, room: JoinedRoomBuilder) -> &mut Self
pub fn add_joined_room(&mut self, room: JoinedRoomBuilder) -> &mut Self
Add a joined room to the next sync response.
If a room with the same room ID already exists, it is replaced by this one.
Sourcepub fn add_invited_room(&mut self, room: InvitedRoomBuilder) -> &mut Self
pub fn add_invited_room(&mut self, room: InvitedRoomBuilder) -> &mut Self
Add an invited room to the next sync response.
If a room with the same room ID already exists, it is replaced by this one.
Sourcepub fn add_left_room(&mut self, room: LeftRoomBuilder) -> &mut Self
pub fn add_left_room(&mut self, room: LeftRoomBuilder) -> &mut Self
Add a left room to the next sync response.
If a room with the same room ID already exists, it is replaced by this one.
Sourcepub fn add_knocked_room(&mut self, room: KnockedRoomBuilder) -> &mut Self
pub fn add_knocked_room(&mut self, room: KnockedRoomBuilder) -> &mut Self
Add a knocked room to the next sync response.
If a room with the same room ID already exists, it is replaced by this one.
Sourcepub fn add_presence_event(&mut self, event: PresenceTestEvent) -> &mut Self
pub fn add_presence_event(&mut self, event: PresenceTestEvent) -> &mut Self
Add a presence event.
Sourcepub fn add_presence_bulk<I>(&mut self, events: I) -> &mut Self
pub fn add_presence_bulk<I>(&mut self, events: I) -> &mut Self
Add presence in bulk.
Sourcepub fn add_global_account_data_event(
&mut self,
event: GlobalAccountDataTestEvent,
) -> &mut Self
pub fn add_global_account_data_event( &mut self, event: GlobalAccountDataTestEvent, ) -> &mut Self
Add global account data.
Sourcepub fn add_global_account_data_bulk<I>(&mut self, events: I) -> &mut Self
pub fn add_global_account_data_bulk<I>(&mut self, events: I) -> &mut Self
Add global account data in bulk.
pub fn add_change_device(&mut self, user_id: &UserId) -> &mut Self
Sourcepub fn build_json_sync_response(&mut self) -> JsonValue
pub fn build_json_sync_response(&mut self) -> JsonValue
Builds a sync response as a JSON Value containing the events we queued so far.
The next response returned by build_sync_response
will then be empty
if no further events were queued.
This method is raw JSON equivalent to build_sync_response(), use build_sync_response() if you need a typed response.
Sourcepub fn build_sync_response(&mut self) -> SyncResponse
pub fn build_sync_response(&mut self) -> SyncResponse
Builds a SyncResponse
containing the events we queued so far.
The next response returned by build_sync_response
will then be empty
if no further events were queued.
This method is high level and typed equivalent to build_json_sync_response(), use build_json_sync_response() if you need an untyped response.
pub fn clear(&mut self)
Trait Implementations§
Source§impl Default for SyncResponseBuilder
impl Default for SyncResponseBuilder
Source§fn default() -> SyncResponseBuilder
fn default() -> SyncResponseBuilder
Auto Trait Implementations§
impl Freeze for SyncResponseBuilder
impl RefUnwindSafe for SyncResponseBuilder
impl Send for SyncResponseBuilder
impl Sync for SyncResponseBuilder
impl Unpin for SyncResponseBuilder
impl UnwindSafe for SyncResponseBuilder
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>