1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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";
}