[][src]Struct tectonic::io::stdstreams::BufferedPrimaryIo

pub struct BufferedPrimaryIo { /* fields omitted */ }

BufferedPrimaryIo provides a mechanism for the TeX "primary input" to come from stdin. Because Tectonic makes multiple passes through the input by default, we have to buffer it in memory so that the input can be read multiple times. It wouldn't be hard to make an alternative implementation that skips the buffering and errors out if one tries to open the stream more than once.

TODO: it might be better to stream stdin to a temporary file on disk that we then delete while holding on to the file handle. But mkstemp-rs doesn't give us Files and the whole approach might get a bit hairy, so we don't do that.

TODO: it also would be nicer to actually stream through stdin at pace on the first pass rather than slurping it all into memory upon construction, but once more we're being lazy.

Implementations

impl BufferedPrimaryIo[src]

pub fn from_stream<T: Read>(stream: &mut T) -> Result<Self>[src]

Create a new primary-I/O buffer from a type implementing Read.

The stream will be read and buffered in memory — regardless of how large it is. This approach is required because Tectonic will generally need to make multiple passes over the input file.

pub fn from_stdin() -> Result<Self>[src]

Create a new primary-I/O buffer from this processes's standard input.

Standard input will be read and buffered in memory — regardless of how large it is. This approach is required because Tectonic will generally need to make multiple passes over the input file.

pub fn from_text<T: AsRef<str>>(text: T) -> Self[src]

Create a new primary-I/O buffer from a string.

The string is converted into bytes as per [str.as_bytes].

pub fn from_buffer(buf: Vec<u8>) -> Self[src]

Create a new primary-I/O buffer from a byte vector.

Trait Implementations

impl Clone for BufferedPrimaryIo[src]

impl Debug for BufferedPrimaryIo[src]

impl Eq for BufferedPrimaryIo[src]

impl IoProvider for BufferedPrimaryIo[src]

impl PartialEq<BufferedPrimaryIo> for BufferedPrimaryIo[src]

impl StructuralEq for BufferedPrimaryIo[src]

impl StructuralPartialEq for BufferedPrimaryIo[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> AsIoProviderMut for T where
    T: IoProvider
[src]

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,