pub struct FrameDecoder { /* private fields */ }
Expand description
Decodes CADU bytes into Frames.
§Examples
Default decode using default CCSDS derandomization and reed-solomon.
use ccsds::framing::decode_frames_rs;
const cadu_len: usize = 1020;
let reed_solomon_interleave = 4;
let blocks: Vec<Vec<u8>> = vec![
vec![0u8; cadu_len],
];
let frames = decode_frames_rs(blocks.into_iter(), reed_solomon_interleave)
.filter_map(Result::ok);
Manually specified decode using default CCSDS derandomization and reed-solomon.
use ccsds::framing::{FrameDecoder, DefaultReedSolomon, DefaultDerandomizer};
const cadu_len: usize = 1020;
let reed_solomon_interleave = 4;
let blocks: Vec<Vec<u8>> = vec![
vec![0u8; cadu_len],
];
let frames = FrameDecoder::new()
.with_integrity(Box::new(DefaultReedSolomon::new(reed_solomon_interleave)))
.with_derandomization(Box::new(DefaultDerandomizer))
.decode(blocks.into_iter())
.filter_map(Result::ok);
Implementations§
Source§impl FrameDecoder
impl FrameDecoder
pub fn new() -> Self
Sourcepub fn with_derandomization(self, derandomizer: Box<dyn Derandomizer>) -> Self
pub fn with_derandomization(self, derandomizer: Box<dyn Derandomizer>) -> Self
Apply derandomization using the provided algorithm. If not provided no derandomization is performed.
Sourcepub fn with_integrity(self, integrity: Box<dyn IntegrityAlgorithm>) -> Self
pub fn with_integrity(self, integrity: Box<dyn IntegrityAlgorithm>) -> Self
Perform integrity checking with the give algorithm. If not provided, no configuration checking is performed.
Sourcepub fn with_integrity_threads(self, num: u32) -> Self
pub fn with_integrity_threads(self, num: u32) -> Self
Use this number of threads for integrity checks. By default the number of threads is configured automatically and is typically the number of CPUs available on the system.
Sourcepub fn decode<B>(self, cadus: B) -> impl Iterator<Item = Result<DecodedFrame>>
pub fn decode<B>(self, cadus: B) -> impl Iterator<Item = Result<DecodedFrame>>
Returns an interator that performs the decode, including derandomization and integrity checks, if configured.
Integrity checks are not performed on VCDU fill frames (vcid=63), however, fill frames are not filtered and are produced by the returned iterator.
Integrity checking is handled in parallel with a distinct job per-CADU using an automatically configured number of threads by default, otherwise the number of threads set using Self::with_integrity_threads.
§Errors
Error if integrity checking is used and fails.
Trait Implementations§
Source§impl Default for FrameDecoder
impl Default for FrameDecoder
Source§fn default() -> FrameDecoder
fn default() -> FrameDecoder
Auto Trait Implementations§
impl Freeze for FrameDecoder
impl !RefUnwindSafe for FrameDecoder
impl Send for FrameDecoder
impl Sync for FrameDecoder
impl Unpin for FrameDecoder
impl !UnwindSafe for FrameDecoder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more