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: ObjFlagsImplementations§
Source§impl PsObject
impl PsObject
Sourcepub fn int(v: impl Into<i64>) -> Self
pub fn int(v: impl Into<i64>) -> Self
Build an integer object.
Generic over anything that widens losslessly to i64 so the many
i32/u8/u16 call sites need no cast.
pub fn real(v: f64) -> Self
pub fn bool(v: bool) -> Self
pub fn null() -> Self
pub fn mark() -> Self
pub fn operator(op: OpCode) -> Self
Sourcepub fn stopped_mark() -> Self
pub fn stopped_mark() -> Self
Stopped marker (internal).
Sourcepub fn hard_return() -> Self
pub fn hard_return() -> Self
HardReturn marker (internal).
Sourcepub fn dict_end(entity: EntityId) -> Self
pub fn dict_end(entity: EntityId) -> Self
DictEnd marker (internal) — conditionally pops the dict stack when reached.
pub fn is_numeric(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_real(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_array_type(&self) -> bool
pub fn is_composite(&self) -> bool
Sourcepub fn is_global_vm(&self) -> bool
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.
Sourcepub fn type_name(&self) -> &'static [u8] ⓘ
pub fn type_name(&self) -> &'static [u8] ⓘ
PostScript type name as bytes (e.g. b"integertype").
Sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
Extract as i32 (Int only), rejecting values outside i32 range.
PostScript integers are i64 (see PsValue::Int), but many callers
need an i32 — array and string indices, character codes, operand
counts. Those are all genuinely bounded, and a value too large to be
one of them should fail the caller’s range check rather than wrap
silently, so this returns None instead of truncating.