pub struct Hub<S> { /* private fields */ }Expand description
One writer and its sessions: each session is pinned to a document, and rows stored through one session are forwarded to the document’s other sessions.
Implementations§
Source§impl<S: Sink> Hub<S>
impl<S: Sink> Hub<S>
pub fn new(store: SqliteStore) -> Self
pub fn store(&mut self) -> &mut SqliteStore
Sourcepub fn open(&mut self, doc_id: &str, owner: &str, sink: S) -> Result<u64>
pub fn open(&mut self, doc_id: &str, owner: &str, sink: S) -> Result<u64>
owner groups sessions for close_owner, e.g. a webview label.
Sourcepub fn send(&mut self, session: u64, bytes: &[u8]) -> Result<()>
pub fn send(&mut self, session: u64, bytes: &[u8]) -> Result<()>
Relays one frame. Responses go to session, new rows to the document’s other sessions.
pub fn close(&mut self, session: u64) -> bool
Sourcepub fn close_owner(&mut self, owner: &str) -> usize
pub fn close_owner(&mut self, owner: &str) -> usize
Closes every session of an owner; returns how many were open.
pub fn session_count(&self) -> usize
Auto Trait Implementations§
impl<S> !Freeze for Hub<S>
impl<S> !RefUnwindSafe for Hub<S>
impl<S> !Sync for Hub<S>
impl<S> !UnwindSafe for Hub<S>
impl<S> Forget for Hub<S>
impl<S> Send for Hub<S>
impl<S> Unpin for Hub<S>
impl<S> UnsafeUnpin for Hub<S>
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