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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#![cfg_attr(feature = "missing_mpl", feature(plugin))]
#![cfg_attr(feature = "missing_mpl", plugin(missing_mpl))]
#![cfg_attr(feature = "missing_mpl", deny(missing_mpl))]
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate core as std;
pub mod filter;
pub mod finalize;
pub mod sink;
pub mod source;
pub use filter::Filter;
pub use finalize::Finalize;
pub use sink::Sink;
pub use source::Source;
pub mod prelude {}
pub trait Config {
type Config;
}
pub trait WithConfig: Config {
type Output;
fn with_config(config: Self::Config) -> Self::Output;
}
pub trait ConfigClone: Config {
fn config(&self) -> Self::Config;
}
pub trait ConfigRef: Config {
fn config_ref(&self) -> &Self::Config;
}
pub trait State: Sized {
type State;
}
pub trait StateMut: State {
unsafe fn state_mut(&mut self) -> &mut Self::State;
}
pub trait Guts: Sized {
type Guts;
}
pub trait FromGuts: Guts {
unsafe fn from_guts(guts: Self::Guts) -> Self;
}
pub trait IntoGuts: Guts {
fn into_guts(self) -> Self::Guts;
}
pub trait Reset: Sized {
fn reset(self) -> Self;
fn reset_mut(&mut self) {
use std::{mem, ptr};
unsafe {
let owned_self = ptr::replace(self, mem::uninitialized());
ptr::write(self, owned_self.reset());
}
}
}