pub struct ByteStream<'a> { /* private fields */ }Expand description
A read cursor over a borrowed byte slice.
Implementations§
Source§impl<'a> ByteStream<'a>
impl<'a> ByteStream<'a>
Sourcepub fn seek(&mut self, offset: usize) -> Result<(), FitError>
pub fn seek(&mut self, offset: usize) -> Result<(), FitError>
Move the cursor to an absolute offset. Returns an error if past end.
Sourcepub fn read_bytes(&mut self, n: usize) -> Result<&'a [u8], FitError>
pub fn read_bytes(&mut self, n: usize) -> Result<&'a [u8], FitError>
Read and consume the next n bytes as a borrowed sub-slice.
Sourcepub fn read_array<const N: usize>(&mut self) -> Result<[u8; N], FitError>
pub fn read_array<const N: usize>(&mut self) -> Result<[u8; N], FitError>
Read and consume an exact N-byte array.
Sourcepub fn read_u16(&mut self, endian: Endian) -> Result<u16, FitError>
pub fn read_u16(&mut self, endian: Endian) -> Result<u16, FitError>
Read u16 in the requested endianness.
Sourcepub fn read_u32(&mut self, endian: Endian) -> Result<u32, FitError>
pub fn read_u32(&mut self, endian: Endian) -> Result<u32, FitError>
Read u32 in the requested endianness.
Sourcepub fn read_u16_le(&mut self) -> Result<u16, FitError>
pub fn read_u16_le(&mut self) -> Result<u16, FitError>
Convenience: read u16 little-endian.
Sourcepub fn read_u32_le(&mut self) -> Result<u32, FitError>
pub fn read_u32_le(&mut self) -> Result<u32, FitError>
Convenience: read u32 little-endian.
Trait Implementations§
Source§impl<'a> Clone for ByteStream<'a>
impl<'a> Clone for ByteStream<'a>
Source§fn clone(&self) -> ByteStream<'a>
fn clone(&self) -> ByteStream<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for ByteStream<'a>
impl<'a> RefUnwindSafe for ByteStream<'a>
impl<'a> Send for ByteStream<'a>
impl<'a> Sync for ByteStream<'a>
impl<'a> Unpin for ByteStream<'a>
impl<'a> UnsafeUnpin for ByteStream<'a>
impl<'a> UnwindSafe for ByteStream<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more