pub struct Decoder { /* private fields */ }Expand description
Decoder for decoding FIT file.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create new Decoder for decoding FIT file.
For more options, use Decoder::builder() to build the Decoder.
Sourcepub fn stream<'a, R>(&'a mut self, reader: R) -> Stream<'a, R>
pub fn stream<'a, R>(&'a mut self, reader: R) -> Stream<'a, R>
Creates a Stream from a mutably borrowed Decoder for streaming decoding of the given reader.
Example:
// ...
let mut dec = Decoder::new();
let mut stream = dec.stream(&mut reader);
while let Some(event) = stream.next() {
// do something with event having borrowed data
}
Sourcepub fn decode<R>(&mut self, reader: R) -> Result<Option<FIT>, Error<R::Error>>where
R: Read,
pub fn decode<R>(&mut self, reader: R) -> Result<Option<FIT>, Error<R::Error>>where
R: Read,
Decode returns a single FIT sequence. If it’s a chained FIT file, call this method multiple times until it return Ok(None) or Err(err).
Sourcepub fn release_heap_memory(&mut self)
pub fn release_heap_memory(&mut self)
Releases heap memory used by the Decoder back to the allocator, so it can be reused
by subsequent allocations in memory-constrained environments such as embedded systems
when a statically allocated Decoder is no longer in use.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnsafeUnpin for Decoder
impl UnwindSafe for Decoder
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