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
#![allow(clippy::module_name_repetitions)]
pub(self) mod buffer;
pub(self) mod byte;
pub(self) mod cgroups;
pub(self) mod lazy_quantity;
pub(self) mod pool;
pub(self) mod system;
pub use buffer::*;
pub use byte::*;
pub use cgroups::*;
pub use lazy_quantity::*;
pub use pool::*;
pub use system::*;
#[derive(Default, Clone, Copy)]
pub struct AnonymousSlice {
pub start: usize,
pub length: usize,
}
impl AnonymousSlice {
#[must_use]
pub fn consume<'a, 'b: 'a, T>(&self, slice: &'b [T]) -> Option<&'a [T]> {
let end = self.start + self.length;
if end >= slice.len() {
None
} else {
Some(&slice[self.start..end])
}
}
}