pub struct StateRoom { /* private fields */ }Expand description
A live room you are in: its state, kept current, and who else is here.
Implementations§
Source§impl StateRoom
impl StateRoom
pub fn name(&self) -> String
pub fn state(&self) -> Value
pub fn version(&self) -> u64
pub fn hydrate(&self, snapshot: &Value)
pub fn handle_event(&self, packet: &Value) -> bool
Sourcepub fn set_state(&self, state: &Value, if_version: Option<u64>)
pub fn set_state(&self, state: &Value, if_version: Option<u64>)
Replace the state for everyone here. Writers only; with if_version, only
while the room is at that version.
pub async fn connect( authorization: &CredentialsOrApiKey, target_id: &str, hooks: Option<Arc<dyn Hooks>>, ) -> Result<(StateRoom, Presence)>
Methods from Deref<Target = Room>§
pub fn endpoint(&self) -> &str
pub fn ws(&self) -> RoomSocket
pub fn id(&self) -> &str
pub fn get_presences(&self) -> Vec<Presence>
The caller’s Credentials or ApiKey from the live authorization pack.
pub fn post(&self, packet: &Value)
pub fn disconnect(&self)
pub async fn generate_access_code(&self) -> Result<String>
Trait Implementations§
Auto Trait Implementations§
impl Forget for StateRoom
impl Freeze for StateRoomwhere
*const ArcInner<RoomInner> is !null: Freeze,
PhantomData<ArcInner<RoomInner>>: Freeze,
*const ArcInner<Mutex<Snapshot>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Snapshot>>>: Freeze,
impl Move for StateRoom
impl RefUnwindSafe for StateRoomwhere
Atomic<usize>: RefUnwindSafe,
Chan<Message, Semaphore>: RefUnwindSafe,
Mutex<Vec<Presence>>: RefUnwindSafe,
RwLock<bool>: RefUnwindSafe,
AtomicUsize: RefUnwindSafe,
Notify: RefUnwindSafe,
Atomic<bool>: RefUnwindSafe,
Mutex<Snapshot>: RefUnwindSafe,
impl Send for StateRoom
impl Sync for StateRoom
impl Unpin for StateRoom
impl UnsafeUnpin for StateRoomwhere
*const ArcInner<RoomInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<RoomInner>>: UnsafeUnpin,
*const ArcInner<Mutex<Snapshot>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Snapshot>>>: UnsafeUnpin,
impl UnwindSafe for StateRoom
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