Skip to main content

PsObject

Struct PsObject 

Source
pub struct PsObject {
    pub value: PsValue,
    pub flags: ObjFlags,
}
Expand description

A PostScript object: a tagged value with metadata flags.

PsObject is Clone + Copy — it’s a value type containing indices into arena stores, not heap references.

Fields§

§value: PsValue§flags: ObjFlags

Implementations§

Source§

impl PsObject

Source

pub fn int(v: i32) -> Self

Source

pub fn real(v: f64) -> Self

Source

pub fn bool(v: bool) -> Self

Source

pub fn null() -> Self

Source

pub fn mark() -> Self

Source

pub fn dict_mark() -> Self

Dict mark from << — distinct from [/mark marks.

Source

pub fn name_lit(id: NameId) -> Self

Literal name: /foo

Source

pub fn name_exec(id: NameId) -> Self

Executable name: foo

Source

pub fn operator(op: OpCode) -> Self

Source

pub fn string(entity: EntityId, len: u32) -> Self

Literal string.

Source

pub fn array(entity: EntityId, len: u32) -> Self

Literal array.

Source

pub fn procedure(entity: EntityId, len: u32) -> Self

Executable array (procedure body).

Source

pub fn dict(entity: EntityId) -> Self

Dict object.

Source

pub fn stopped_mark() -> Self

Stopped marker (internal).

Source

pub fn loop_mark(entity: EntityId) -> Self

Loop marker (internal).

Source

pub fn hard_return() -> Self

HardReturn marker (internal).

Source

pub fn dict_end(entity: EntityId) -> Self

DictEnd marker (internal) — conditionally pops the dict stack when reached.

Source

pub fn is_numeric(&self) -> bool

Source

pub fn is_int(&self) -> bool

Source

pub fn is_real(&self) -> bool

Source

pub fn is_bool(&self) -> bool

Source

pub fn is_array_type(&self) -> bool

Source

pub fn is_composite(&self) -> bool

Source

pub fn is_global_vm(&self) -> bool

Check if this object is in global VM using authoritative entity tag bits for composite types, falling back to ObjFlags for simple types.

Source

pub fn type_name(&self) -> &'static [u8]

PostScript type name as bytes (e.g. b"integertype").

Source

pub fn as_f64(&self) -> Option<f64>

Extract as f64 (works for both Int and Real).

Source

pub fn as_i32(&self) -> Option<i32>

Extract as i32 (Int only).

Trait Implementations§

Source§

impl Clone for PsObject

Source§

fn clone(&self) -> PsObject

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PsObject

Source§

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

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

impl PartialEq for PsObject

Source§

fn eq(&self, other: &PsObject) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PsObject

Source§

impl StructuralPartialEq for PsObject

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.