[−][src]Struct exifsd::ScanSegment
A Scan Segment is contains a segment of the JPEG data.
Fields
specifier: &'a [u8]
Specifies which segment is encoded following this specifier.
data: &'a [u8]
The actual entropy-encoded data that makes up the image segment.
Methods
impl<'a> ScanSegment<'a>
[src]
pub fn parser<I: 'a>() -> impl Parser<Input = I, Output = ScanSegment<'a>> + 'a where
I: RangeStream<Item = u8, Range = &'a [u8]>,
I::Error: ParseError<I::Item, I::Range, I::Position>,
[src]
I: RangeStream<Item = u8, Range = &'a [u8]>,
I::Error: ParseError<I::Item, I::Range, I::Position>,
Parses out a Scan Segment, including the entropy-encoded data.
use exifsd::*; use combine::*; let input = &[0xFF, 0xDA, 0x00, 0x02, 0x01, 0xFF, 0x00, 0x02, 0xFF, 0xFF, 0xD9][..]; let result = ScanSegment::parser().parse(input); let expected = ScanSegment { specifier: &[], data: &[0x01, 0xFF, 0x00, 0x02, 0xFF] }; // Note that the marker `[0xFF, 0xD9]` is not consumed. assert_eq!(result, Ok((expected, &[0xFF, 0xD9][..])));
pub fn write<W: WriteBytesExt>(&self, writer: &mut W) -> Result<()>
[src]
Writes the binary representation of the ScanSegment
out to a file.
use exifsd::*; use combine::*; let input = &[0xFF, 0xDA, 0x00, 0x02, 0x01, 0xFF, 0x00, 0x02][..]; let scan_segment = ScanSegment::parser().parse(input).unwrap().0; let mut written = vec![]; scan_segment.write(&mut written).unwrap(); assert_eq!(input, &written[..]);
Trait Implementations
impl<'a> Copy for ScanSegment<'a>
[src]
impl<'a> PartialEq<ScanSegment<'a>> for ScanSegment<'a>
[src]
fn eq(&self, other: &ScanSegment<'a>) -> bool
[src]
fn ne(&self, other: &ScanSegment<'a>) -> bool
[src]
impl<'a> Clone for ScanSegment<'a>
[src]
fn clone(&self) -> ScanSegment<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Eq for ScanSegment<'a>
[src]
impl<'a> Debug for ScanSegment<'a>
[src]
Auto Trait Implementations
impl<'a> Send for ScanSegment<'a>
impl<'a> Sync for ScanSegment<'a>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,