Skip to main content

ClientDefault

Struct ClientDefault 

Source
pub struct ClientDefault<T: ClientTask, C: Codec> {
    pub logger: Arc<LogFilter>,
    /* private fields */
}
Expand description

An example ClientFacts for general use

Fields§

§logger: Arc<LogFilter>

Implementations§

Source§

impl<T: ClientTask, C: Codec> ClientDefault<T, C>

Source

pub fn new(config: ClientConfig) -> Arc<Self>

Source

pub fn set_log_level(&self, level: Level)

Trait Implementations§

Source§

impl<T: ClientTask, C: Codec> ClientFacts for ClientDefault<T, C>

Source§

type Codec = C

Define the codec to serialization and deserialization Read more
Source§

type Task = T

Define the RPC task from client-side Read more
Source§

fn new_logger(&self) -> Arc<LogFilter>

Construct a captains_log::filter::Filter to oganize log of a client Read more
Source§

fn get_config(&self) -> &ClientConfig

You should keep ClientConfig inside, get_config() will return the reference.
Source§

fn error_handle(&self, task: Self::Task)

How to deal with error Read more
Source§

fn get_client_id(&self) -> u64

You can overwrite this to assign a client_id
Source§

fn get_timestamp(&self) -> u64

NOTE: you may overwrite this to use coarstime or quanta

Auto Trait Implementations§

§

impl<T, C> Freeze for ClientDefault<T, C>

§

impl<T, C> RefUnwindSafe for ClientDefault<T, C>

§

impl<T, C> Send for ClientDefault<T, C>

§

impl<T, C> Sync for ClientDefault<T, C>

§

impl<T, C> Unpin for ClientDefault<T, C>

§

impl<T, C> UnsafeUnpin for ClientDefault<T, C>

§

impl<T, C> UnwindSafe for ClientDefault<T, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.