Trait Kitsune

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

Source

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.

Source

fn list_spaces(&self) -> Vec<SpaceId>

List the active spaces.

Source

fn space(&self, space: SpaceId) -> BoxFut<'_, K2Result<DynSpace>>

Get an existing space with the provided SpaceId or create a new one.

Source

fn space_if_exists(&self, space: SpaceId) -> BoxFut<'_, Option<DynSpace>>

Get a space, only if it exists.

Source

fn transport(&self) -> BoxFut<'_, K2Result<DynTransport>>

Get the transport handle.

Implementors§