pub trait Kitsune:
'static
+ Send
+ Sync
+ Debug {
// Required methods
fn register_handler(
&self,
handler: DynKitsuneHandler,
) -> BoxFut<'_, K2Result<()>>;
fn list_spaces(&self) -> Vec<SpaceId>;
fn space(&self, space: SpaceId) -> BoxFut<'_, K2Result<DynSpace>>;
fn space_if_exists(&self, space: SpaceId) -> BoxFut<'_, Option<DynSpace>>;
fn transport(&self) -> BoxFut<'_, K2Result<DynTransport>>;
}Expand description
The top-level Kitsune2 api trait.
Required Methods§
Sourcefn register_handler(
&self,
handler: DynKitsuneHandler,
) -> BoxFut<'_, K2Result<()>>
fn register_handler( &self, handler: DynKitsuneHandler, ) -> BoxFut<'_, K2Result<()>>
Register the kitsune handler exactly once before invoking any other api functions.
This dependency injection strategy makes it possible for a struct to both act as a Handler and contain the resulting Kitsune instance.
Implementations should error if this is invoked more that once, and should return errors for any other api invocations if this has not yet been called.
Sourcefn list_spaces(&self) -> Vec<SpaceId>
fn list_spaces(&self) -> Vec<SpaceId>
List the active spaces.
Sourcefn space(&self, space: SpaceId) -> BoxFut<'_, K2Result<DynSpace>>
fn space(&self, space: SpaceId) -> BoxFut<'_, K2Result<DynSpace>>
Get an existing space with the provided SpaceId or create a new one.
Sourcefn space_if_exists(&self, space: SpaceId) -> BoxFut<'_, Option<DynSpace>>
fn space_if_exists(&self, space: SpaceId) -> BoxFut<'_, Option<DynSpace>>
Get a space, only if it exists.
Sourcefn transport(&self) -> BoxFut<'_, K2Result<DynTransport>>
fn transport(&self) -> BoxFut<'_, K2Result<DynTransport>>
Get the transport handle.