Skip to main content

Hub

Struct Hub 

Source
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>

Source

pub fn new(store: SqliteStore) -> Self

Source

pub fn store(&mut self) -> &mut SqliteStore

Source

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.

Source

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.

Source

pub fn close(&mut self, session: u64) -> bool

Source

pub fn close_owner(&mut self, owner: &str) -> usize

Closes every session of an owner; returns how many were open.

Source

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>
where BTreeMap<u64, Session<S>>: Send,

§

impl<S> Unpin for Hub<S>
where BTreeMap<u64, Session<S>>: Unpin,

§

impl<S> UnsafeUnpin for Hub<S>
where BTreeMap<u64, Session<S>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.