Trait citadel_sdk::prefabs::client::PrefabFunctions

source ·
pub trait PrefabFunctions<'a, Arg: Send + 'a>: 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: ConnectionSuccess,
        remote: ClientServerRemote,
        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 + 'a>) -> Self;

    // Provided methods
    fn new_connect<T: Into<String>, P: Into<SecBuffer>>(
        username: T,
        password: P,
        arg: Arg,
        udp_mode: UdpMode,
        session_security_settings: SessionSecuritySettings,
        server_password: Option<PreSharedKey>,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Self { ... }
    fn new_connect_defaults<T: Into<String>, P: Into<SecBuffer>>(
        username: T,
        password: P,
        arg: Arg,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Self { ... }
    fn new_register<T: Into<String>, R: Into<String>, P: Into<SecBuffer>, V: ToSocketAddrs>(
        full_name: T,
        username: R,
        password: P,
        arg: Arg,
        server_addr: V,
        udp_mode: UdpMode,
        session_security_settings: SessionSecuritySettings,
        server_password: Option<PreSharedKey>,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Result<Self, NetworkError> { ... }
    fn new_register_defaults<T: Into<String>, R: Into<String>, P: Into<SecBuffer>, V: ToSocketAddrs>(
        full_name: T,
        username: R,
        password: P,
        arg: Arg,
        server_addr: V,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Result<Self, NetworkError> { ... }
    fn new_authless<V: ToSocketAddrs>(
        uuid: Uuid,
        server_addr: V,
        arg: Arg,
        udp_mode: UdpMode,
        session_security_settings: SessionSecuritySettings,
        server_password: Option<PreSharedKey>,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Result<Self, NetworkError> { ... }
    fn new_authless_defaults<V: ToSocketAddrs>(
        uuid: Uuid,
        server_addr: V,
        arg: Arg,
        on_channel_received: Self::UserLevelInputFunction,
    ) -> Result<Self, NetworkError> { ... }
}

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: ConnectionSuccess, remote: ClientServerRemote, 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 + 'a>) -> Self

Provided Methods§

source

fn new_connect<T: Into<String>, P: Into<SecBuffer>>( username: T, password: P, arg: Arg, udp_mode: UdpMode, session_security_settings: SessionSecuritySettings, server_password: Option<PreSharedKey>, on_channel_received: Self::UserLevelInputFunction, ) -> Self

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

source

fn new_connect_defaults<T: Into<String>, P: Into<SecBuffer>>( username: T, password: P, arg: Arg, on_channel_received: Self::UserLevelInputFunction, ) -> Self

Crates a new connection with a central server entailed by the user information and default configuration

source

fn new_register<T: Into<String>, R: Into<String>, P: Into<SecBuffer>, V: ToSocketAddrs>( full_name: T, username: R, password: P, arg: Arg, server_addr: V, udp_mode: UdpMode, session_security_settings: SessionSecuritySettings, server_password: Option<PreSharedKey>, on_channel_received: Self::UserLevelInputFunction, ) -> Result<Self, NetworkError>

First registers with a central server with the proposed credentials, and thereafter, establishes a connection with custom parameters

source

fn new_register_defaults<T: Into<String>, R: Into<String>, P: Into<SecBuffer>, V: ToSocketAddrs>( full_name: T, username: R, password: P, arg: Arg, server_addr: V, on_channel_received: Self::UserLevelInputFunction, ) -> Result<Self, NetworkError>

First registers with a central server with the proposed credentials, and thereafter, establishes a connection with default parameters

source

fn new_authless<V: ToSocketAddrs>( uuid: Uuid, server_addr: V, arg: Arg, udp_mode: UdpMode, session_security_settings: SessionSecuritySettings, server_password: Option<PreSharedKey>, on_channel_received: Self::UserLevelInputFunction, ) -> Result<Self, NetworkError>

Creates a new authless connection with custom arguments

source

fn new_authless_defaults<V: ToSocketAddrs>( uuid: Uuid, server_addr: V, arg: Arg, on_channel_received: Self::UserLevelInputFunction, ) -> Result<Self, NetworkError>

Creates a new authless connection with default arguments

Object Safety§

This trait is not object safe.

Implementors§