pub enum StaticValue {
Unit,
Tuple(Tuple<StaticValue>),
Borrow(&'static dyn Extern, Option<Rc<StaticValue>>),
Owned(Rc<dyn ExternOwned>, Option<Rc<StaticValue>>),
I64(i64),
Bool(bool),
String(Rc<str>),
Function(Rc<StaticFunction>),
EnumVariant(Rc<StaticEnumVariant>),
Option {
contents: Option<Rc<StaticValue>>,
ty: ComplexType,
},
Type(Type),
}Expand description
A version of Value with a static lifetime.
Must be cast back to a runtime-compatible Value using
StaticValue::to_runtime to be used.
The difference between this type and Value<'static> is the lack
of Mut, which contains a RefCell and makes Value<'static>
invariant over
'host. This means that a Value<'static> cannot be combined with
non 'static values in the same runtime, which would prevent useful things
like a static Function accepting a borrowed Extern value with a
non-'static lifetime.
Variants§
Unit
Tuple(Tuple<StaticValue>)
Borrow(&'static dyn Extern, Option<Rc<StaticValue>>)
Owned(Rc<dyn ExternOwned>, Option<Rc<StaticValue>>)
I64(i64)
Bool(bool)
String(Rc<str>)
Function(Rc<StaticFunction>)
EnumVariant(Rc<StaticEnumVariant>)
Option
Type(Type)
Implementations§
Source§impl StaticValue
impl StaticValue
pub fn to_runtime<'host>(&self) -> Value<'host>
Trait Implementations§
Source§impl Clone for StaticValue
impl Clone for StaticValue
Source§fn clone(&self) -> StaticValue
fn clone(&self) -> StaticValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StaticValue
impl !RefUnwindSafe for StaticValue
impl !Send for StaticValue
impl !Sync for StaticValue
impl Unpin for StaticValue
impl !UnwindSafe for StaticValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more