forall C, S.
trait ReadBytes {
/// Byte `index` of `bytes`, or `None` when `index` is out of range;
/// zero is an ordinary byte.
fn get(&cx: C, bytes: S, index: usize) -> Option[u8];
/// The number of bytes in `bytes`.
///
/// Needs `cx` only so a call can select the instance: generic code
/// holding just `S` has no other way to name the view's length.
fn len(&cx: C, bytes: S) -> usize;
}
Reading the bytes of a view S through the capability C.
Methods
method getsource
fn get(&cx: C, bytes: S, index: usize) -> Option[u8];
Byte index of bytes, or None when index is out of range; zero is an ordinary byte.
method lensource
fn len(&cx: C, bytes: S) -> usize;
The number of bytes in bytes.
Needs cx only so a call can select the instance: generic code holding just S has no other way to name the view's length.
Implementors
instance ReadBytes[Exclusive!['r], Slice[u8, 'r]]source
forall 'r.
instance ReadBytes[Exclusive!['r], Slice[u8, 'r]] { ... }
In core::slice.
A byte slice is read through its domain's Exclusive!.
instance ReadBytes[Exclusive!['r], Str['r]]source
forall 'r.
instance ReadBytes[Exclusive!['r], Str['r]] { ... }
In core::str.
Text is read through its domain's Exclusive!.
instance ReadBytes[StaticRead, Str['static]]source
instance ReadBytes[StaticRead, Str['static]] { ... }
In core::str.
'static text is read through StaticRead.
instance ReadBytes[Domain!['k], Str['k]]source
forall 'k.
instance ReadBytes[Domain!['k], Str['k]] { ... }
In alloc::arena.
Text of a domain is read through the domain itself, which lends its capability to read it.