Skip to main content

PrefabFunctions

Trait PrefabFunctions 

Source
pub trait PrefabFunctions<'a, Arg: Send + 'a, R: Ratchet>: Sized + 'a {
    type UserLevelInputFunction: Send + 'a;
    type SharedBundle: Send + 'a;

    // Required methods
    fn get_shared_bundle(&self) -> Self::SharedBundle;
    fn on_c2s_channel_received<'async_trait>(
        connect_success: CitadelClientServerConnection<R>,
        arg: Arg,
        fx: Self::UserLevelInputFunction,
        shared: Self::SharedBundle,
    ) -> Pin<Box<dyn Future<Output = Result<(), NetworkError>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn construct(kernel: Box<dyn NetKernel<R> + 'a>) -> Self;

    // Provided method
    fn new(
        server_connection_settings: ServerConnectionSettings<R>,
        arg: Arg,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Self { ... }
}

Required Associated Types§

Source

type UserLevelInputFunction: Send + 'a

Source

type SharedBundle: Send + 'a

Shared between the kernel and the on_c2s_channel_received function

Required Methods§

Source

fn get_shared_bundle(&self) -> Self::SharedBundle

Source

fn on_c2s_channel_received<'async_trait>( connect_success: CitadelClientServerConnection<R>, arg: Arg, fx: Self::UserLevelInputFunction, shared: Self::SharedBundle, ) -> Pin<Box<dyn Future<Output = Result<(), NetworkError>> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn construct(kernel: Box<dyn NetKernel<R> + 'a>) -> Self

Provided Methods§

Source

fn new( server_connection_settings: ServerConnectionSettings<R>, arg: Arg, on_channel_received: Self::UserLevelInputFunction, ) -> Self

Creates a new connection with a central server entailed by the user information

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§