pub struct ManagedSpacetimeDbConnection<Connection>{ /* private fields */ }Expand description
One generated connection, its worker, and resources tied to that connection.
App clients may retain generated subscription handles through keep_alive.
All retained resources are released before disconnecting the generated client.
Implementations§
Source§impl<Connection> ManagedSpacetimeDbConnection<Connection>
impl<Connection> ManagedSpacetimeDbConnection<Connection>
Sourcepub fn new(connection: Connection, worker: JoinHandle<()>) -> Self
pub fn new(connection: Connection, worker: JoinHandle<()>) -> Self
Wraps a generated connection and its background worker in the shared owner.
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Returns the generated connection while an app builder finishes setup.
Sourcepub fn keep_alive(&mut self, resource: impl Send + Sync + 'static)
pub fn keep_alive(&mut self, resource: impl Send + Sync + 'static)
Keeps a connection-scoped callback or subscription handle alive.
Trait Implementations§
Source§impl<Connection> Drop for ManagedSpacetimeDbConnection<Connection>
impl<Connection> Drop for ManagedSpacetimeDbConnection<Connection>
Auto Trait Implementations§
impl<Connection> !RefUnwindSafe for ManagedSpacetimeDbConnection<Connection>
impl<Connection> !UnwindSafe for ManagedSpacetimeDbConnection<Connection>
impl<Connection> Freeze for ManagedSpacetimeDbConnection<Connection>
impl<Connection> Send for ManagedSpacetimeDbConnection<Connection>
impl<Connection> Sync for ManagedSpacetimeDbConnection<Connection>
impl<Connection> Unpin for ManagedSpacetimeDbConnection<Connection>
impl<Connection> UnsafeUnpin for ManagedSpacetimeDbConnection<Connection>where
Option<Connection>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more