use crate::ffi;
pub trait Mode {
const ID: u32;
const NAME: &'static str;
fn is_block() -> bool {
Self::ID == Block::ID
}
fn is_vectored() -> bool {
Self::ID == Vectored::ID
}
fn is_streaming() -> bool {
Self::ID == Streaming::ID
}
}
#[derive(Debug, PartialEq, Eq)]
pub enum Block {}
#[derive(Debug, PartialEq, Eq)]
pub enum Vectored {}
#[derive(Debug, PartialEq, Eq)]
pub enum Streaming {}
impl Mode for Block {
const ID: u32 = ffi::HS_MODE_BLOCK;
const NAME: &'static str = "Block";
}
impl Mode for Streaming {
const ID: u32 = ffi::HS_MODE_STREAM;
const NAME: &'static str = "Streaming";
}
impl Mode for Vectored {
const ID: u32 = ffi::HS_MODE_VECTORED;
const NAME: &'static str = "Vectored";
}