DataObjectRef

Struct DataObjectRef 

Source
pub struct DataObjectRef(/* private fields */);

Implementations§

Source§

impl DataObjectRef

Source

pub fn new(data_object: DataObject) -> Self

Source

pub fn text_value(&self) -> Option<Box<str>>

Source

pub fn byte_buffer_value(&self) -> Option<Gc<GcCell<Box<[u8]>>>>

Source

pub fn array_value(&self) -> Option<Gc<GcCell<Box<[DataObjectRef]>>>>

Source

pub fn list_value(&self) -> Option<Gc<GcCell<VecDeque<DataObjectRef>>>>

Source

pub fn var_pointer_value(&self) -> Option<DataObjectRef>

Source

pub fn function_pointer_value(&self) -> Option<FunctionPointerObjectRef>

Source

pub fn struct_value(&self) -> Option<Gc<StructObject>>

Source

pub fn object_value(&self) -> Option<LangObjectRef>

Source

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

Source

pub fn long_value(&self) -> Option<i64>

Source

pub fn float_value(&self) -> Option<f32>

Source

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

Source

pub fn char_value(&self) -> Option<char>

Source

pub fn error_value(&self) -> Option<Gc<ErrorObject>>

Source

pub fn type_value(&self) -> Option<DataType>

Source

pub fn number_value(&self) -> Option<Number>

This method borrows the data object and copies the value from DataObject::number_value

Source

pub fn bool_value(&self) -> Option<bool>

This method borrows the data object and copies the value from DataObject::bool_value

Source

pub fn variable_name(&self) -> Option<Box<str>>

Source

pub fn is_final_data(&self) -> bool

Source

pub fn is_static_data(&self) -> bool

Source

pub fn is_copy_static_and_final_modifiers(&self) -> bool

Source

pub fn is_lang_var(&self) -> bool

Source

pub fn data_type(&self) -> DataType

Source

pub fn type_constraint(&self) -> DataTypeConstraint

This functions clones data

Source

pub fn member_visibility(&self) -> Option<Visibility>

Source

pub fn member_of_class(&self) -> i64

Source

pub fn is_accessible(&self, accessing_class: Option<&LangObjectRef>) -> bool

Methods from Deref<Target = GcCell<DataObject>>§

Source

pub fn borrow(&self) -> GcCellRef<'_, T>

Immutably borrows the wrapped value.

The borrow lasts until the returned GcCellRef exits scope. Multiple immutable borrows can be taken out at the same time.

§Panics

Panics if the value is currently mutably borrowed.

Source

pub fn borrow_mut(&self) -> GcCellRefMut<'_, T>

Mutably borrows the wrapped value.

The borrow lasts until the returned GcCellRefMut exits scope. The value cannot be borrowed while this borrow is active.

§Panics

Panics if the value is currently borrowed.

Source

pub fn try_borrow(&self) -> Result<GcCellRef<'_, T>, BorrowError>

Immutably borrows the wrapped value, returning an error if the value is currently mutably borrowed.

The borrow lasts until the returned GcCellRef exits scope. Multiple immutable borrows can be taken out at the same time.

This is the non-panicking variant of borrow.

§Examples
use gc::GcCell;

let c = GcCell::new(5);

{
    let m = c.borrow_mut();
    assert!(c.try_borrow().is_err());
}

{
    let m = c.borrow();
    assert!(c.try_borrow().is_ok());
}
Source

pub fn try_borrow_mut(&self) -> Result<GcCellRefMut<'_, T>, BorrowMutError>

Mutably borrows the wrapped value, returning an error if the value is currently borrowed.

The borrow lasts until the returned GcCellRefMut exits scope. The value cannot be borrowed while this borrow is active.

This is the non-panicking variant of borrow_mut.

§Examples
use gc::GcCell;

let c = GcCell::new(5);

{
    let m = c.borrow();
    assert!(c.try_borrow_mut().is_err());
}

assert!(c.try_borrow_mut().is_ok());

Trait Implementations§

Source§

impl AnyWithEq for DataObjectRef

Source§

fn as_any(&self) -> &dyn Any

Source§

fn is_equals( &self, other: &dyn AnyWithEq, interpreter: &mut Interpreter, pos: CodePosition, ) -> bool

Source§

fn is_strict_equals( &self, other: &dyn AnyWithEq, interpreter: &mut Interpreter, pos: CodePosition, ) -> bool

Source§

impl Clone for DataObjectRef

Source§

fn clone(&self) -> DataObjectRef

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 DataObjectRef

Source§

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

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

impl Default for DataObjectRef

Source§

fn default() -> DataObjectRef

Returns the “default value” for a type. Read more
Source§

impl Deref for DataObjectRef

Source§

type Target = GcCell<DataObject>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Drop for DataObjectRef

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Finalize for DataObjectRef

Source§

impl Trace for DataObjectRef

Source§

unsafe fn trace(&self)

Marks all contained Gcs.
Source§

unsafe fn root(&self)

Increments the root-count of all contained Gcs.
Source§

unsafe fn unroot(&self)

Decrements the root-count of all contained Gcs.
Source§

fn finalize_glue(&self)

Runs Finalize::finalize() on this object and all contained subobjects

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V