Trait segsource::U8Source [−][src]
pub trait U8Source: Source<Item = u8> { fn endidness(&self) -> Endidness; fn change_endidness(&mut self, endidness: Endidness); fn from_u8_slice_with_offset(
slice: &[u8],
initial_offset: usize,
endidness: Endidness
) -> Result<Self>; fn from_file_with_offset<P: AsRef<Path>>(
path: P,
initial_offset: usize,
endidness: Endidness
) -> Result<Self>; fn from_file_with_offset_async<'async_trait, P>(
path: P,
initial_offset: usize,
endidness: Endidness
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where
P: AsRef<Path> + Sync + Send,
P: 'async_trait,
Self: 'async_trait; fn from_bytes_with_offset(
bytes: Bytes,
initial_offset: usize,
endidness: Endidness
) -> Result<Self>; fn from_u8_slice(slice: &[u8], endidness: Endidness) -> Result<Self> { ... } fn from_u8_vec(items: Vec<u8>, endidness: Endidness) -> Result<Self> { ... } fn from_u8_vec_with_offset(
items: Vec<u8>,
initial_offset: usize,
endidness: Endidness
) -> Result<Self> { ... } fn from_file<P: AsRef<Path>>(path: P, endidness: Endidness) -> Result<Self> { ... } fn from_file_async<'async_trait, P>(
path: P,
endidness: Endidness
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where
P: AsRef<Path> + Sync + Send,
P: 'async_trait,
Self: Send + 'async_trait, { ... } fn from_bytes(bytes: Bytes, endidness: Endidness) -> Result<Self> { ... } }
Expand description
Segsource is mostly meant to work with binary data (although it by no means has to). Because of
this, sources can have some extra functionality when its item type is u8
.
Required methods
fn change_endidness(&mut self, endidness: Endidness)
fn change_endidness(&mut self, endidness: Endidness)
Creates a new source using the the provided slice, Endidness
, and offset.
Note: because sources own their data, this will copy the data from the provided slice.
Creates a new source using the the provided file, Endidness
, and offset.
An async version of U8Source::from_file_with_offset
.
Provided methods
Creates a new source using the the provided slice and Endidness
.
Note: because sources own their data, this will copy the data from the provided slice.
Creates a new source using the the provided vec and Endidness
.
Creates a new source using the the provided vec, Endidness
, and offset.
Creates a new source using the the provided file and Endidness
.
An async version of U8Source::from_file
.