pub struct ObjFlags(/* private fields */);Expand description
Packed object metadata (1 byte).
Layout:
- Bits 0-2: access level (0-4)
- Bit 3: executable (0=literal, 1=executable)
- Bit 4: global (0=local, 1=global)
- Bit 5: composite (0=simple, 1=composite)
Implementations§
Source§impl ObjFlags
impl ObjFlags
pub const LITERAL: u8 = 0
pub const EXECUTABLE: u8
pub const ACCESS_NONE: u8 = 0
pub const ACCESS_EXECUTE_ONLY: u8 = 1
pub const ACCESS_READ_ONLY: u8 = 2
pub const ACCESS_WRITE_ONLY: u8 = 3
pub const ACCESS_UNLIMITED: u8 = 4
Sourcepub fn new(access: u8, executable: bool, global: bool, composite: bool) -> Self
pub fn new(access: u8, executable: bool, global: bool, composite: bool) -> Self
Create new flags with specified attributes.
Sourcepub fn executable() -> Self
pub fn executable() -> Self
Convenience: executable simple object with unlimited access.
Sourcepub fn literal_composite() -> Self
pub fn literal_composite() -> Self
Convenience: literal composite object with unlimited access.
Sourcepub fn executable_composite() -> Self
pub fn executable_composite() -> Self
Convenience: executable composite object with unlimited access.
pub fn access(self) -> u8
pub fn is_executable(self) -> bool
pub fn is_literal(self) -> bool
pub fn is_global(self) -> bool
pub fn is_composite(self) -> bool
pub fn set_executable(&mut self)
pub fn set_literal(&mut self)
pub fn set_access(&mut self, access: u8)
Sourcepub fn is_deferred(self) -> bool
pub fn is_deferred(self) -> bool
Check if this object is deferred (should be pushed to o_stack from e_stack).
Used by exec_procedure to mark nested executable arrays that should be
pushed to the operand stack rather than executed when encountered on the
execution stack. The executable flag remains set so operators like if
and ifelse still accept them.
Sourcepub fn set_deferred(&mut self)
pub fn set_deferred(&mut self)
Mark this object as deferred.
Sourcepub fn clear_deferred(&mut self)
pub fn clear_deferred(&mut self)
Clear the deferred flag.
Sourcepub fn require_read(self) -> Result<(), PsError>
pub fn require_read(self) -> Result<(), PsError>
Require read access (>= READ_ONLY). Returns InvalidAccess if not.
Sourcepub fn require_write(self) -> Result<(), PsError>
pub fn require_write(self) -> Result<(), PsError>
Require write access (>= UNLIMITED) for non-file composites. Returns InvalidAccess if not.
Sourcepub fn require_file_write(self) -> Result<(), PsError>
pub fn require_file_write(self) -> Result<(), PsError>
Require file write access (>= WRITE_ONLY). Returns InvalidAccess if not.