Skip to main content

QValue

Enum QValue 

Source
pub enum QValue {
    Data(DataValue),
    Left(Rc<RefCell<dyn LeftValue>>),
}
Expand description

QVM 操作数栈元素。

Java 无同名对象;它对应 Java 栈上统一的 Value 引用,并显式区分 DataValueLeftValue,以保留赋值别名语义。

Variants§

§

Data(DataValue)

不可变数据值,对应 Java DataValue

§

Left(Rc<RefCell<dyn LeftValue>>)

可赋值共享槽位,对应 Java LeftValue 实现。

Implementations§

Source§

impl QValue

Source

pub fn get(&self) -> DataValue

取得内部数据。对应 Java 方法 Value#get()

Source

pub fn type_name(&self) -> &'static str

取得 Java 风格类型名。对应 Java 方法 Value#getTypeName()

Source

pub fn to_immutable(&self) -> QValue

将左值快照为不可变数据。对应 Java 方法 ValueUtils#toImmutable(Value)

Source

pub fn as_left(&self) -> Option<&Rc<RefCell<dyn LeftValue>>>

返回内部左值;不可赋值数据返回 None。Rust 便捷方法。 对应 Java:value instanceof LeftValue 后的强制类型转换。

Source

pub fn is_left(&self) -> bool

判断是否为 Java LeftValue。Rust 便捷方法。 对应 Java: 无(Rust 原生适配)。

Trait Implementations§

Source§

impl Clone for QValue

Source§

fn clone(&self) -> QValue

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 QValue

Source§

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

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

impl From<DataValue> for QValue

Source§

fn from(value: DataValue) -> QValue

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for QValue

§

impl !Send for QValue

§

impl !Sync for QValue

§

impl !UnwindSafe for QValue

§

impl Freeze for QValue

§

impl Unpin for QValue

§

impl UnsafeUnpin for QValue

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> 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.