pub struct Rooms { /* private fields */ }Expand description
Rooms on one endpoint.
Owns the gossip instance all rooms on the endpoint share. Cheap to clone,
and shutdown ends it for every clone.
§Examples
use iroh_live_rooms::Rooms;
let rooms = Rooms::new(&node);
// Mount the service with `rooms.mount(router_builder)` to accept members.
let room = rooms.join(&ticket, Some("ada".into())).await?;
rooms.shutdown().await;Implementations§
Source§impl Rooms
impl Rooms
Sourcepub fn new(node: &Node) -> Self
pub fn new(node: &Node) -> Self
Creates the room service on node’s endpoint, with its own gossip.
§Panics
Panics when called outside a Tokio runtime.
Sourcepub fn with_gossip(node: &Node, gossip: Gossip) -> Self
pub fn with_gossip(node: &Node, gossip: Gossip) -> Self
Creates the room service over an existing gossip instance.
The service takes over the gossip: shutdown shuts
it down.
Sourcepub fn mount(&self, router: RouterBuilder) -> RouterBuilder
pub fn mount(&self, router: RouterBuilder) -> RouterBuilder
Sourcepub async fn leave_all(&self)
pub async fn leave_all(&self)
Leaves every room joined here that a handle still holds.
Tells the other members at once, as Room::leave does for one room.
The rooms are left concurrently. A room whose last handle dropped has
stopped already without telling anyone, so keep a handle until this
runs. Call it before shutdown. Not cancellation
safe: call it again to finish.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Rooms
impl !UnwindSafe for Rooms
impl Freeze for Rooms
impl Send for Rooms
impl Sync for Rooms
impl Unpin for Rooms
impl UnsafeUnpin for Rooms
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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