pub struct ClientDefault<T: ClientTask, RT: AsyncRuntime, 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, RT: AsyncRuntime, C: Codec> ClientDefault<T, RT, C>
impl<T: ClientTask, RT: AsyncRuntime, C: Codec> ClientDefault<T, RT, C>
pub fn new(config: ClientConfig, rt: RT) -> Arc<Self>
pub fn set_log_level(&self, level: Level)
Trait Implementations§
Source§impl<T: ClientTask, RT: AsyncRuntime, C: Codec> ClientFacts for ClientDefault<T, RT, C>
impl<T: ClientTask, RT: AsyncRuntime, C: Codec> ClientFacts for ClientDefault<T, RT, C>
Source§fn new_logger(&self) -> Arc<LogFilter>
fn new_logger(&self) -> Arc<LogFilter>
Construct a captains_log::filter::Filter to oganize log of a client
Source§fn get_config(&self) -> &ClientConfig
fn get_config(&self) -> &ClientConfig
You should keep ClientConfig inside, get_config() will return the reference.
Source§fn error_handle(&self, task: Self::Task)
fn error_handle(&self, task: Self::Task)
TODO Fix the logger interface
How to deal with error Read more
Source§fn get_client_id(&self) -> u64
fn get_client_id(&self) -> u64
You can overwrite this to assign a client_id
Source§impl<T: ClientTask, RT: AsyncRuntime, C: Codec> Deref for ClientDefault<T, RT, C>
impl<T: ClientTask, RT: AsyncRuntime, C: Codec> Deref for ClientDefault<T, RT, C>
Auto Trait Implementations§
impl<T, RT, C> Freeze for ClientDefault<T, RT, C>where
RT: Freeze,
impl<T, RT, C> RefUnwindSafe for ClientDefault<T, RT, C>where
RT: RefUnwindSafe,
impl<T, RT, C> Send for ClientDefault<T, RT, C>
impl<T, RT, C> Sync for ClientDefault<T, RT, C>
impl<T, RT, C> Unpin for ClientDefault<T, RT, C>where
RT: Unpin,
impl<T, RT, C> UnwindSafe for ClientDefault<T, RT, C>where
RT: UnwindSafe,
Blanket Implementations§
Source§impl<FT, T> AsyncExec for FT
impl<FT, T> AsyncExec for FT
type AsyncHandle<R: Send> = <T as AsyncExec>::AsyncHandle<R>
type ThreadHandle<R: Send> = <T as AsyncExec>::ThreadHandle<R>
Source§fn spawn<F, R>(&self, f: F) -> <FT as AsyncExec>::AsyncHandle<R>
fn spawn<F, R>(&self, f: F) -> <FT as AsyncExec>::AsyncHandle<R>
Spawn a task in the background, returning a handle to await its result. Read more
Source§fn spawn_detach<F, R>(&self, f: F)
fn spawn_detach<F, R>(&self, f: F)
Spawn a task and detach it (no handle returned). Read more
Source§fn spawn_blocking<F, R>(f: F) -> <FT as AsyncExec>::ThreadHandle<R>
fn spawn_blocking<F, R>(f: F) -> <FT as AsyncExec>::ThreadHandle<R>
Run blocking code in a background thread pool, and return an async join handle Read more
Source§impl<F, IO> AsyncIO for F
impl<F, IO> AsyncIO for F
Source§type AsyncFd<T: AsRawFd + AsFd + Send + Sync + 'static> = <IO as AsyncIO>::AsyncFd<T>
type AsyncFd<T: AsRawFd + AsFd + Send + Sync + 'static> = <IO as AsyncIO>::AsyncFd<T>
The type used to represent async file descriptors. Read more
Source§fn connect_tcp(
addr: &SocketAddr,
) -> impl Future<Output = Result<<F as AsyncIO>::AsyncFd<TcpStream>, Error>> + Send
fn connect_tcp( addr: &SocketAddr, ) -> impl Future<Output = Result<<F as AsyncIO>::AsyncFd<TcpStream>, Error>> + Send
Connect to a TCP address asynchronously. Read more
Source§fn connect_unix(
addr: &Path,
) -> impl Future<Output = Result<<F as AsyncIO>::AsyncFd<UnixStream>, Error>> + Send
fn connect_unix( addr: &Path, ) -> impl Future<Output = Result<<F as AsyncIO>::AsyncFd<UnixStream>, Error>> + Send
Connect to a Unix socket address asynchronously. Read more
Source§impl<F, T> AsyncTime for F
impl<F, T> AsyncTime for F
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
Source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
The equivalent of
Access::load.