pub struct Hub<T, 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<T: PatchStore, S: Sink> Hub<T, S>
impl<T: PatchStore, S: Sink> Hub<T, S>
pub fn new(store: T) -> Self
pub fn store(&mut self) -> &mut T
Sourcepub fn open(
&mut self,
doc_id: &str,
owner: &str,
sink: S,
) -> Result<u64, T::Error>
pub fn open( &mut self, doc_id: &str, owner: &str, sink: S, ) -> Result<u64, T::Error>
owner groups sessions for close_owner, e.g. a webview label.
Sourcepub fn send(&mut self, session: u64, bytes: &[u8]) -> Result<(), T::Error>
pub fn send(&mut self, session: u64, bytes: &[u8]) -> Result<(), T::Error>
Relays one frame. Responses go to session, new rows to the document’s other sessions.
Sourcepub fn retire_prefix(&mut self, prefix: &str) -> Result<usize, T::Error>
pub fn retire_prefix(&mut self, prefix: &str) -> Result<usize, T::Error>
Notify and close sessions only after their subtree has been durably retired.
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<T, S> Forget for Hub<T, S>
impl<T, S> Freeze for Hub<T, S>
impl<T, S> Move for Hub<T, S>
impl<T, S> RefUnwindSafe for Hub<T, S>
impl<T, S> Send for Hub<T, S>
impl<T, S> Sync for Hub<T, S>
impl<T, S> Unpin for Hub<T, S>
impl<T, S> UnsafeUnpin for Hub<T, S>
impl<T, S> UnwindSafe for Hub<T, 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