Trait Profile

Source
pub trait Profile {
    type InterfaceIdent;

    // Required methods
    fn send<T: Serialize>(
        &mut self,
        hdr: &Header,
        data: &T,
    ) -> Result<(), InterfaceSendError>;
    fn send_err(
        &mut self,
        hdr: &Header,
        err: ProtocolError,
    ) -> Result<(), InterfaceSendError>;
    fn send_raw(
        &mut self,
        hdr: &Header,
        hdr_raw: &[u8],
        data: &[u8],
    ) -> Result<(), InterfaceSendError>;
    fn interface_state(
        &mut self,
        ident: Self::InterfaceIdent,
    ) -> Option<InterfaceState>;
    fn set_interface_state(
        &mut self,
        ident: Self::InterfaceIdent,
        state: InterfaceState,
    ) -> Result<(), SetStateError>;
}

Required Associated Types§

Source

type InterfaceIdent

The kind of type that is used to identify a single interface. If a Profile only supports a single interface, this is often the () type. If a Profile supports many interfaces, this could be an enum or integer type.

Required Methods§

Source

fn send<T: Serialize>( &mut self, hdr: &Header, data: &T, ) -> Result<(), InterfaceSendError>

Source

fn send_err( &mut self, hdr: &Header, err: ProtocolError, ) -> Result<(), InterfaceSendError>

Source

fn send_raw( &mut self, hdr: &Header, hdr_raw: &[u8], data: &[u8], ) -> Result<(), InterfaceSendError>

Source

fn interface_state( &mut self, ident: Self::InterfaceIdent, ) -> Option<InterfaceState>

Source

fn set_interface_state( &mut self, ident: Self::InterfaceIdent, state: InterfaceState, ) -> Result<(), SetStateError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§