Struct StringSource

Source
pub struct StringSource<C: CharType> {
    pub source: Option<Ptr<String>>,
    /* private fields */
}
Expand description

A StringSource is the primary TokenSource for TeX, which reads from a String

Fields§

§source: Option<Ptr<String>>

Implementations§

Source§

impl<C: CharType> StringSource<C>

Source

pub fn new(string: Vec<u8>, source: Option<Ptr<String>>) -> StringSource<C>

Create a new StringSource from a String and an optional source reference. source is usually a filename, used to construct crate::tex::token::SourceReferences for Tokens. The StringSource keeps track of the current line and column number.

Source

pub fn line(&self) -> usize

Source

pub fn column(&self) -> usize

Source

pub fn preview(&self) -> String

Source

pub fn get_next<T: Token<Char = C>>( &mut self, cc: &CategoryCodeScheme<C>, endline: Option<C>, ) -> Result<Option<T>, InvalidCharacter<T>>

Auto Trait Implementations§

§

impl<C> Freeze for StringSource<C>

§

impl<C> RefUnwindSafe for StringSource<C>
where C: RefUnwindSafe,

§

impl<C> !Send for StringSource<C>

§

impl<C> !Sync for StringSource<C>

§

impl<C> Unpin for StringSource<C>
where C: Unpin,

§

impl<C> UnwindSafe for StringSource<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.