Enum cranelift_codegen::ir::ExternalName[][src]

pub enum ExternalName {
    User {
        namespace: u32,
        index: u32,
    },
    TestCase {
        length: u8,
        ascii: [u8; 16],
    },
    LibCall(LibCall),
}
Expand description

The name of an external is either a reference to a user-defined symbol table, or a short sequence of ascii bytes so that test cases do not have to keep track of a symbol table.

External names are primarily used as keys by code using Cranelift to map from a cranelift_codegen::ir::FuncRef or similar to additional associated data.

External names can also serve as a primitive testing and debugging tool. In particular, many .clif test files use function names to identify functions.

Variants

User

A name in a user-defined symbol table. Cranelift does not interpret these numbers in any way.

Show fields

Fields of User

namespace: u32

Arbitrary.

index: u32

Arbitrary.

TestCase

A test case function name of up to a hardcoded amount of ascii characters. This is not intended to be used outside test cases.

Show fields

Fields of TestCase

length: u8

How many of the bytes in ascii are valid?

ascii: [u8; 16]

Ascii bytes of the name.

LibCall(LibCall)

A well-known runtime library function.

Implementations

impl ExternalName[src]

pub fn testcase<T: AsRef<[u8]>>(v: T) -> Self[src]

Creates a new external name from a sequence of bytes. Caller is expected to guarantee bytes are only ascii alphanumeric or _.

Examples

// Create `ExternalName` from a string.
let name = ExternalName::testcase("hello");
assert_eq!(name.to_string(), "%hello");

pub fn user(namespace: u32, index: u32) -> Self[src]

Create a new external name from user-provided integer indices.

Examples

// Create `ExternalName` from integer indices
let name = ExternalName::user(123, 456);
assert_eq!(name.to_string(), "u123:456");

Trait Implementations

impl Clone for ExternalName[src]

fn clone(&self) -> ExternalName[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ExternalName[src]

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

Formats the value using the given formatter. Read more

impl Default for ExternalName[src]

fn default() -> Self[src]

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

impl Display for ExternalName[src]

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

Formats the value using the given formatter. Read more

impl FromStr for ExternalName[src]

type Err = ()

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>[src]

Parses a string s to return a value of this type. Read more

impl PartialEq<ExternalName> for ExternalName[src]

fn eq(&self, other: &ExternalName) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ExternalName) -> bool[src]

This method tests for !=.

impl Eq for ExternalName[src]

impl StructuralEq for ExternalName[src]

impl StructuralPartialEq for ExternalName[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

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

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.