Struct ccsds::Synchronizer
source · pub struct Synchronizer<'a> {
pub pattern_hits: HashMap<u8, i32>,
/* private fields */
}Expand description
Synchronizer scans a byte stream for data blocks indicated by a sync marker.
The sync marker may be bit-shifted, in which case the bytes returned will also be bit shifted.
Fields§
§pattern_hits: HashMap<u8, i32>Implementations§
source§impl<'a> Synchronizer<'a>
impl<'a> Synchronizer<'a>
pub fn new( reader: impl Read + Send + 'a, asm: &Vec<u8>, block_size: i32 ) -> Self
sourcepub fn scan(&mut self) -> Result<Option<Loc>>
pub fn scan(&mut self) -> Result<Option<Loc>>
Scan our stream until the next sync marker is found and return a option containing a [Some(Loc)] indicating the position of the data block and any left bit-shift currently in effect. If there are not enough bytes to check the sync marker return Ok(None).
On ErrorKind::UnexpectedEof this will return [Ok(None)]. Any other error will result in [Err(err)].
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Synchronizer<'a>
impl<'a> Send for Synchronizer<'a>
impl<'a> !Sync for Synchronizer<'a>
impl<'a> Unpin for Synchronizer<'a>
impl<'a> !UnwindSafe for Synchronizer<'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