Skip to main content

Object

Enum Object 

Source
pub enum Object {
Show 16 variants Real { value: Real, }, Integer { value: Integer, }, Complex { re: Real, im: Real, }, String { value: String, }, Name { value: String, }, LocalName { value: String, }, Character { value: String, }, Binary { value: u64, base: Option<Base>, text: Option<String>, }, List { items: Vec<Object>, }, Tagged { tag: String, object: Box<Object>, }, Unit { value: Real, unit: Option<String>, }, Array { dims: Vec<usize>, items: Vec<ArrayItem>, }, Program { source: Option<String>, }, Algebraic { source: Option<String>, }, Command { name: Option<String>, address: Option<u32>, library: Option<u16>, command: Option<u16>, source: Option<String>, }, Unknown { prolog: String, kind: Option<String>, nibbles: usize, hex: String, truncated: bool, source: Option<String>, graphic: Option<Graphic>, },
}
Expand description

A calculator object as the semantic tools return and accept it.

Variants§

§

Real

A real number, exact to its 12 digits.

Fields

§value: Real

The value (a JSON number, or text beyond an f64’s exponent range).

§

Integer

A 49G exact integer.

Fields

§value: Integer

The value (a JSON number up to 15 digits, else decimal text).

§

Complex

A complex number.

Fields

§re: Real

Real part.

§im: Real

Imaginary part.

§

String

A string (HP characters as Unicode).

Fields

§value: String

The text.

§

Name

A global name.

Fields

§value: String

The name.

§

LocalName

A local (temporary) name.

Fields

§value: String

The name.

§

Character

A character object.

Fields

§value: String

The character.

§

Binary

A binary integer (# 2Ah).

Fields

§value: u64

The value (up to 64 bits).

§base: Option<Base>

The calculator’s display base, when known.

§text: Option<String>

The value as the calculator shows it in that base.

§

List

A list.

Fields

§items: Vec<Object>

The elements.

§

Tagged

A tagged object :tag:object.

Fields

§tag: String

The tag.

§object: Box<Object>

The tagged object.

§

Unit

A unit object value_unit.

Fields

§value: Real

The number, exact.

§unit: Option<String>

The unit expression, e.g. m/s^2.

§

Array

A real or complex array (vector or matrix).

Fields

§dims: Vec<usize>

Dimensions, e.g. [2, 3] for 2 rows of 3.

§items: Vec<ArrayItem>

Elements, nested by dimension (rows of elements for a matrix).

§

Program

A program.

Fields

§source: Option<String>

Its source, e.g. « 1 2 + ».

§

Algebraic

An algebraic expression.

Fields

§source: Option<String>

Its source with quotes, e.g. 'X^2'.

§

Command

A built-in command (a ROM pointer to a program, code or primitive, or an XLIB name).

Fields

§name: Option<String>

Its name from the ROM’s tables, e.g. +; absent when they have none.

§address: Option<u32>

The ROM address it points to (not for XLIB names).

§library: Option<u16>

Its library number, when known (always for an XLIB name; an XLIB name without name is a command of a library the ROM’s tables do not hold, which the calculator shows XLIB l n).

§command: Option<u16>

Its command number in the library, with library.

§source: Option<String>

Its text from an ASCII transfer, when known.

§

Unknown

Any other object: its prolog, type name and nibbles.

Fields

§prolog: String

Prolog address, e.g. 02B1E.

§kind: Option<String>

Type name, e.g. Graphic, when the prolog is known.

§nibbles: usize

Size in nibbles.

§hex: String

The object’s nibbles in memory order (prolog first), at most 4096.

§truncated: bool

Whether hex was cut.

§source: Option<String>

The calculator’s text for it, when known.

§graphic: Option<Graphic>

A graphic’s picture (Graphic), for a GROB of a sane size.

Implementations§

Source§

impl Object

Source

pub fn needs_source(&self) -> bool

Whether this object or one inside it needs text from the ASCII transfer (the transfer layer fills them in).

Source

pub fn set_base(&mut self, b: Base)

Set the base (and display text) of every binary integer inside.

Source

pub fn has_binary(&self) -> bool

Whether a binary integer is inside.

Trait Implementations§

Source§

impl Clone for Object

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Object

Source§

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

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

impl<'de> Deserialize<'de> for Object

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Object

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Object

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Object

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

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.