o3/buffer/bytes/scope/mod.rs
1//! Selections tied to their original storage owner.
2
3use std::convert::Infallible;
4
5pub use owner::Owner;
6pub use range::Range;
7pub use view::View;
8
9mod owner;
10mod range;
11pub mod raw;
12mod view;
13
14/// Selects a byte range while preserving its source's ownership proof.
15pub trait Source: Copy {
16 type Selection;
17
18 fn select(self, bytes: &[u8]) -> Option<Self::Selection>;
19}
20
21impl Source for () {
22 type Selection = Infallible;
23
24 fn select(self, _: &[u8]) -> Option<Self::Selection> {
25 None
26 }
27}