pub enum UserFuncName {
User(UserExternalName),
Testcase(TestcaseName),
}
Expand description
An explicit name for a user-defined function, be it defined in code or in CLIF text.
This is used both for naming a function (for debugging purposes) and for declaring external
functions. In the latter case, this becomes an ExternalName
, which gets embedded in
relocations later, etc.
Variants§
User(UserExternalName)
A user-defined name, with semantics left to the user.
Testcase(TestcaseName)
A name for a test case, mostly intended for Cranelift testing.
Implementations§
Source§impl UserFuncName
impl UserFuncName
Sourcepub fn testcase<T: AsRef<[u8]>>(v: T) -> Self
pub fn testcase<T: AsRef<[u8]>>(v: T) -> Self
Creates a new external name from a sequence of bytes. Caller is expected
to guarantee bytes are only ascii alphanumeric or _
.
Sourcepub fn user(namespace: u32, index: u32) -> Self
pub fn user(namespace: u32, index: u32) -> Self
Create a new external name from a user-defined external function reference.
Sourcepub fn get_user(&self) -> Option<&UserExternalName>
pub fn get_user(&self) -> Option<&UserExternalName>
Get a UserExternalName
if this is a user-defined name.
Trait Implementations§
Source§impl Clone for UserFuncName
impl Clone for UserFuncName
Source§fn clone(&self) -> UserFuncName
fn clone(&self) -> UserFuncName
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 UserFuncName
impl Debug for UserFuncName
Source§impl Default for UserFuncName
impl Default for UserFuncName
Source§impl<'de> Deserialize<'de> for UserFuncName
impl<'de> Deserialize<'de> for UserFuncName
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 UserFuncName
impl Display for UserFuncName
Source§impl Hash for UserFuncName
impl Hash for UserFuncName
Source§impl PartialEq for UserFuncName
impl PartialEq for UserFuncName
Source§impl Serialize for UserFuncName
impl Serialize for UserFuncName
impl Eq for UserFuncName
impl StructuralPartialEq for UserFuncName
Auto Trait Implementations§
impl Freeze for UserFuncName
impl RefUnwindSafe for UserFuncName
impl Send for UserFuncName
impl Sync for UserFuncName
impl Unpin for UserFuncName
impl UnwindSafe for UserFuncName
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> 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