pub struct GlobalValue(/* private fields */);
Expand description
An opaque reference to a global value.
A GlobalValue
is a Value
that will be live across the entire
function lifetime. It can be preloaded from other global values.
You can create a GlobalValue
in the following ways:
- When compiling to native code, you can use it for objects in static memory with
Module::declare_data_in_func
. - For any compilation target, it can be registered with
FunctionBuilder::create_global_value
.
GlobalValue
s can be retrieved with
InstBuilder:global_value
.
While the order is stable, it is arbitrary.
Implementations§
Source§impl GlobalValue
impl GlobalValue
Source§impl GlobalValue
impl GlobalValue
Sourcepub fn with_number(n: u32) -> Option<Self>
pub fn with_number(n: u32) -> Option<Self>
Create a new global value reference from its number.
This method is for use by the parser.
Trait Implementations§
Source§impl Clone for GlobalValue
impl Clone for GlobalValue
Source§fn clone(&self) -> GlobalValue
fn clone(&self) -> GlobalValue
Returns a copy 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 moreSource§impl Debug for GlobalValue
impl Debug for GlobalValue
Source§impl<'de> Deserialize<'de> for GlobalValue
impl<'de> Deserialize<'de> for GlobalValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 Display for GlobalValue
impl Display for GlobalValue
Source§impl EntityRef for GlobalValue
impl EntityRef for GlobalValue
Source§impl From<GlobalValue> for AnyEntity
impl From<GlobalValue> for AnyEntity
Source§fn from(r: GlobalValue) -> Self
fn from(r: GlobalValue) -> Self
Converts to this type from the input type.
Source§impl Hash for GlobalValue
impl Hash for GlobalValue
Source§impl Ord for GlobalValue
impl Ord for GlobalValue
Source§fn cmp(&self, other: &GlobalValue) -> Ordering
fn cmp(&self, other: &GlobalValue) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for GlobalValue
impl PartialEq for GlobalValue
Source§impl PartialOrd for GlobalValue
impl PartialOrd for GlobalValue
Source§impl ReservedValue for GlobalValue
impl ReservedValue for GlobalValue
Source§fn reserved_value() -> GlobalValue
fn reserved_value() -> GlobalValue
Create an instance of the reserved value.
Source§fn is_reserved_value(&self) -> bool
fn is_reserved_value(&self) -> bool
Checks whether value is the reserved one.
Source§impl Serialize for GlobalValue
impl Serialize for GlobalValue
impl Copy for GlobalValue
impl Eq for GlobalValue
impl StructuralPartialEq for GlobalValue
Auto Trait Implementations§
impl Freeze for GlobalValue
impl RefUnwindSafe for GlobalValue
impl Send for GlobalValue
impl Sync for GlobalValue
impl Unpin for GlobalValue
impl UnwindSafe for GlobalValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more