use std::error::Error;
pub enum TunEvent {
Up(usize), Down, }
pub trait Status: Send + 'static {
type Error: Error;
fn event(&mut self) -> Result<TunEvent, Self::Error>;
}
pub trait Writer: Send + Sync + 'static {
type Error: Error;
fn write(&self, src: &[u8]) -> Result<(), Self::Error>;
}
pub trait Reader: Send + 'static {
type Error: Error;
fn read(&self, buf: &mut [u8], offset: usize) -> Result<usize, Self::Error>;
}
pub trait Tun: Send + Sync + 'static {
type Writer: Writer;
type Reader: Reader;
type Error: Error;
}
pub trait PlatformTun: Tun {
type Status: Status;
#[allow(clippy::type_complexity)]
fn create(name: &str) -> Result<(Vec<Self::Reader>, Self::Writer, Self::Status), Self::Error>;
}