pub trait AsyncSyslogTap<D: AsyncSyslogDestination + Display>: Debug + Send {
// Required methods
fn new(req_tap: D) -> SyRes<Self>
where Self: Sized;
async fn connectlog(&mut self) -> SyRes<()>;
async fn send(&mut self, msg: &[u8]) -> Result<usize>;
async fn disconnectlog(&mut self) -> Result<()>;
fn is_connected(&self) -> bool;
fn get_type(&self) -> TapType;
fn get_max_msg_size(&self) -> usize;
fn update_tap_data(&mut self, tap_data: D);
}
Expand description
A trait which implements the necessary functions for syslog internals.
It taps
the connection and provides the functionality for the syslog client
to use the communication channel.
Required Methods§
Sourcefn new(req_tap: D) -> SyRes<Self>where
Self: Sized,
fn new(req_tap: D) -> SyRes<Self>where
Self: Sized,
Proves the new instance of the syslog communication.
§Arguments
req_tap
- a connection endpoint setup information i.e address, path…
§Returns
In case of any error a SyRes i.e Result::Err should be returned.
Sourceasync fn connectlog(&mut self) -> SyRes<()>
async fn connectlog(&mut self) -> SyRes<()>
Opens a connection to target.
Sourceasync fn disconnectlog(&mut self) -> Result<()>
async fn disconnectlog(&mut self) -> Result<()>
Disconnects the connection.
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Tells if connection was opened.
Sourcefn get_max_msg_size(&self) -> usize
fn get_max_msg_size(&self) -> usize
Returns (in bytes) the maximum message size (including headers).
Sourcefn update_tap_data(&mut self, tap_data: D)
fn update_tap_data(&mut self, tap_data: D)
Updates the connection information without breaking tap.
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.