Skip to main content

PsInterpreter

Struct PsInterpreter 

Source
pub struct PsInterpreter {
    pub dictstack: Vec<DictRef>,
    pub stack: Vec<ObjRef>,
    /* private fields */
}
Expand description

The interpreter (PSInterpreter), with the operators of PSOperators.

Fields§

§dictstack: Vec<DictRef>

The dictionary stack (dictstack): systemdict, userdict, then the dictionaries of begin.

§stack: Vec<ObjRef>

The operand stack (stack).

Implementations§

Source§

impl PsInterpreter

Source

pub fn new(encoding: &str) -> Self

A new interpreter whose tokens are decoded with encoding (PSInterpreter(encoding)).

Source

pub fn interpret(&mut self, data: &[u8]) -> Result<(), PsError>

Interprets PostScript code (interpret).

Source

pub fn resolve_name(&self, name: &Key) -> Result<ObjRef, PsError>

resolve_name: looks a name up in the dictionary stack, from the top.

Source

pub fn push(&mut self, object: ObjRef)

Pushes an object (push).

Source

pub fn pop(&mut self, types: &[&str]) -> Result<ObjRef, PsError>

Pops an object, checking its type if types is not empty (pop).

Source

pub fn close(&mut self)

Breaks the reference cycles the dictionaries may hold (close).

Trait Implementations§

Source§

impl Debug for PsInterpreter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PsInterpreter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.