[][src]Struct tectonic_xdv::XdvParser

pub struct XdvParser<T: XdvEvents> { /* fields omitted */ }

State for parsing an XDV file.

Implementations

impl<T: XdvEvents> XdvParser<T>[src]

pub fn new(events: T) -> Self[src]

Create a new XDV/SPX parser.

Methods implemented by events will be called as various items are encountered in the file.

pub fn process<R: Read>(mut stream: R, events: T) -> Result<(T, u64), T::Error> where
    T::Error: From<IoError>, 
[src]

Parse an entire XDV/SPX stream.

Returns the input “events” variable and the number of bytes that were processed.

Because the io::Read trait is used, the event result type must implement From<io::Error> as well as From<XdvError>.

The initial buffer size is hardcoded to 4096 bytes. It doubles in size every time the parser is unable to make any progress at all in the current chunk, which should be a rare circumstance.

pub fn parse(&mut self, chunk: &[u8]) -> Result<usize, T::Error>[src]

Parse the next chunk of XDV data.

Returns the number of bytes consumed from the input buffer. If this is not the same as the buffer size, some of the existing bytes must be re-fed to the parser. If the returned value is 0, you need a bigger buffer in order to be able to parse the next directive.

pub fn current_offset(&self) -> u64[src]

Get the current byte offset of the parsing.

pub fn finish(self) -> Result<T, T::Error>[src]

Finish parsing, consume this object, and return the underlying event handler, assuming all went well.

Trait Implementations

impl<T: Debug + XdvEvents> Debug for XdvParser<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for XdvParser<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for XdvParser<T> where
    T: Send
[src]

impl<T> Sync for XdvParser<T> where
    T: Sync
[src]

impl<T> Unpin for XdvParser<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for XdvParser<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.