Struct gluon_vm::api::Opaque

source ·
pub struct Opaque<T, V>(/* private fields */)
where
    V: ?Sized;
Expand description

Type implementing both Pushable and Getable of values of V regardless of wheter V implements the traits. The actual value, V is only accessible directly either by Deref if it is Userdata or a string or by the to_value method if it implements Getable.

When the value is not accessible the value can only be transferred back into gluon again without inspecting the value itself two different threads.

Implementations§

source§

impl<'vm, V> Opaque<RootedValue<&'vm Thread>, V>where V: ?Sized,

source

pub fn vm_(&self) -> &'vm Thread

source§

impl<T, V> Opaque<RootedValue<T>, V>where T: VmRootInternal, V: ?Sized,

source

pub fn vm(&self) -> &Thread

source

pub fn to_value<'vm>(&'vm self) -> Vwhere V: Getable<'vm, 'vm>,

Converts the value into its Rust representation

source§

impl<T, V> Opaque<T, V>where V: ?Sized,

source

pub fn from_value(value: T) -> Self

source

pub fn into_inner(self) -> T

source§

impl<'s, 'value, T, V> Opaque<T, V>where T: AsVariant<'s, 'value>, V: ?Sized,

source

pub fn get_value(&'s self) -> &'s Value

source

pub fn get_variant(&'s self) -> Variants<'value>

source

pub fn get_ref(&'s self) -> ValueRef<'value>

source§

impl<'s, 'value, T, V> Opaque<T, [V]>where T: AsVariant<'s, 'value>,

source

pub fn len(&'s self) -> usize

source

pub fn get_array(&'s self) -> GcRef<'value, ValueArray>

source

pub fn get(&'s self, index: VmInt) -> Option<OpaqueRef<'value, V>>

source

pub fn iter(&'s self) -> Iter<'s, 'value, T, V>

source§

impl<T, V> Opaque<RootedValue<T>, [V]>where T: VmRootInternal,

source

pub fn get2<'value>(&'value self, index: VmInt) -> Option<V>where V: for<'vm> Getable<'vm, 'value>,

Trait Implementations§

source§

impl<T, V> AsRef<V> for Opaque<T, V>where V: ?Sized, Self: Deref<Target = V>,

source§

fn as_ref(&self) -> &V

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T, V> Borrow<V> for Opaque<T, V>where V: ?Sized, Self: Deref<Target = V>,

source§

fn borrow(&self) -> &V

Immutably borrows from an owned value. Read more
source§

impl<T, V> Clone for Opaque<T, V>where T: Clone,

source§

fn clone(&self) -> Self

Returns a copy 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<T, V> Debug for Opaque<T, V>where T: Debug,

source§

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

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

impl<T, V> Deref for Opaque<T, [V]>where T: AsValueRef, V: ArrayRepr + Copy,

§

type Target = [V]

The resulting type after dereferencing.
source§

fn deref(&self) -> &[V]

Dereferences the value.
source§

impl<'s, 'value, T> Deref for Opaque<T, GcPtr<ClosureData>>where T: AsVariant<'s, 'value>,

§

type Target = GcPtr<ClosureData>

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl<T, V> Deref for Opaque<T, V>where T: AsValueRef, V: Userdata,

§

type Target = V

The resulting type after dereferencing.
source§

fn deref(&self) -> &V

Dereferences the value.
source§

impl<T> Deref for Opaque<T, str>where T: AsValueRef,

§

type Target = str

The resulting type after dereferencing.
source§

fn deref(&self) -> &str

Dereferences the value.
source§

impl<'vm, 'value, V> Getable<'vm, 'value> for Opaque<Variants<'value>, V>where V: ?Sized,

§

type Proxy = Variants<'value>

source§

fn to_proxy(_vm: &'vm Thread, value: Variants<'value>) -> Result<Self::Proxy>

source§

fn from_proxy(vm: &'vm Thread, proxy: &'value mut Self::Proxy) -> Self

source§

fn from_value(_vm: &'vm Thread, value: Variants<'value>) -> Self

source§

impl<'a, T, V> IntoIterator for &'a Opaque<T, [V]>where T: AsVariant<'a, 'a>,

§

type Item = Opaque<Variants<'a>, V>

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, 'a, T, V>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, V> Ord for Opaque<T, V>where T: AsValueRef, Self: Borrow<V>, V: ?Sized + Ord,

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<T, V> PartialEq<Opaque<T, V>> for Opaque<T, V>where T: AsValueRef, Self: Borrow<V>, V: ?Sized + PartialEq,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, V> PartialOrd<Opaque<T, V>> for Opaque<T, V>where T: AsValueRef, Self: Borrow<V>, V: ?Sized + PartialOrd,

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'s, 'value, 'vm, T, V> Pushable<'vm> for Opaque<T, V>where T: Pushable<'vm>, V: ?Sized,

source§

fn vm_push(self, context: &mut ActiveThread<'vm>) -> Result<()>

Pushes self to stack. If the call is successful a single element should have been added to the stack and Ok(()) should be returned. If the call is unsuccessful Status:Error should be returned and the stack should be left intact
source§

fn status_push(self, context: &mut ActiveThread<'vm>) -> Statuswhere Self: Sized,

source§

unsafe fn marshal_unrooted(self, vm: &'vm Thread) -> Result<Value>where Self: Sized,

source§

fn marshal<T>(self, vm: &'vm Thread) -> Result<RootedValue<T>>where Self: Sized, T: VmRoot<'vm>,

source§

impl<T> Serialize for Opaque<T, str>where T: AsValueRef,

source§

fn serialize<S>(&self, serializer: S) -> StdResult<S::Ok, S::Error>where S: Serializer,

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

impl<T> SerializeState<Thread> for Opaque<T, str>where T: AsValueRef,

source§

fn serialize_state<S>( &self, serializer: S, _thread: &Thread ) -> StdResult<S::Ok, S::Error>where S: Serializer,

Serializes self
source§

impl<T, V> Trace for Opaque<T, V>where T: Trace,

source§

unsafe fn root(&mut self)

source§

unsafe fn unroot(&mut self)

source§

fn trace(&self, gc: &mut Gc)

source§

impl<T, V> VmType for Opaque<T, V>where V: ?Sized + VmType, V::Type: Sized,

§

type Type = <V as VmType>::Type

A version of Self which implements Any allowing a TypeId to be retrieved
source§

fn make_type(vm: &Thread) -> ArcType

Creates an gluon type which maps to Self in rust
source§

const EXTRA_ARGS: VmIndex = V::EXTRA_ARGS

How many extra arguments a function returning this type requires. Used for abstract types which when used in return position should act like they still need more arguments before they are called
source§

fn make_forall_type(vm: &Thread) -> ArcType

source§

impl<T, V> Eq for Opaque<T, V>where T: AsValueRef, Self: Borrow<V>, V: ?Sized + Eq,

Auto Trait Implementations§

§

impl<T, V: ?Sized> RefUnwindSafe for Opaque<T, V>where T: RefUnwindSafe, V: RefUnwindSafe,

§

impl<T, V: ?Sized> Send for Opaque<T, V>where T: Send, V: Send,

§

impl<T, V: ?Sized> Sync for Opaque<T, V>where T: Sync, V: Sync,

§

impl<T, V: ?Sized> Unpin for Opaque<T, V>where T: Unpin, V: Unpin,

§

impl<T, V: ?Sized> UnwindSafe for Opaque<T, V>where T: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<Id> AsId<Id> for Idwhere Id: ?Sized,

source§

fn as_id(&self) -> &Id

source§

impl<'vm, T> AsyncPushable<'vm> for Twhere T: Pushable<'vm>,

source§

fn async_push( self, context: &mut ActiveThread<'vm>, lock: Lock, _: u32 ) -> Poll<Result<(), Error>>

Pushes self to stack. If the call is successful a single element should have been added to the stack and Ok(()) should be returned. If the call is unsuccessful Status:Error should be returned and the stack should be left intact. Read more
source§

fn async_status_push( self, context: &mut ActiveThread<'vm>, lock: Lock, frame_index: VmIndex ) -> Statuswhere Self: Sized,

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
source§

impl<T> Downcast for Twhere T: Any,

source§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastArc for Twhere T: Downcast + Send + Sync,

source§

fn into_arc_any(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

source§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<D, T> FromPtr<D> for T

source§

unsafe fn make_ptr(_: D, ptr: *mut ()) -> *mut T

source§

impl<T, U> Into<U> for Twhere 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, U, I> LiftInto<U, I> for Twhere U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

impl<T> Any for Twhere T: Any,

source§

impl<T> Captures<'_> for T

§

impl<T> CloneAny for Twhere T: Any + Clone,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,