Enum cranelift::prelude::codegen::ir::ExternalName [−][src]
pub enum ExternalName { User { namespace: u32, index: u32, }, TestCase { length: u8, ascii: [u8; 16], }, LibCall(LibCall), }
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 sy mbol 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.
Fields of User
namespace: u32 | Arbitrary. |
index: u32 | Arbitrary. |
TestCase
A test case function name of up to 10 ascii characters. This is not intended to be used outside test cases.
Fields of TestCase
length: u8 | How many of the bytes in |
ascii: [u8; 16] | Ascii bytes of the name. |
LibCall(LibCall)
A well-known runtime library function.
Methods
impl ExternalName
[src]
impl ExternalName
pub fn testcase<T>(v: T) -> ExternalName where
T: AsRef<[u8]>,
[src]
pub fn testcase<T>(v: T) -> ExternalName where
T: AsRef<[u8]>,
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) -> ExternalName
[src]
pub fn user(namespace: u32, index: u32) -> ExternalName
Create a new external name from user-provided integer indicies.
Examples
// Create `ExternalName` from integer indicies let name = ExternalName::user(123, 456); assert_eq!(name.to_string(), "u123:456");
Trait Implementations
impl Clone for ExternalName
[src]
impl Clone for ExternalName
fn clone(&self) -> ExternalName
[src]
fn clone(&self) -> ExternalName
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl FromStr for ExternalName
[src]
impl FromStr for ExternalName
type Err = ()
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<ExternalName, <ExternalName as FromStr>::Err>
[src]
fn from_str(s: &str) -> Result<ExternalName, <ExternalName as FromStr>::Err>
Parses a string s
to return a value of this type. Read more
impl Debug for ExternalName
[src]
impl Debug for ExternalName
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Display for ExternalName
[src]
impl Display for ExternalName
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Default for ExternalName
[src]
impl Default for ExternalName
fn default() -> ExternalName
[src]
fn default() -> ExternalName
Returns the "default value" for a type. Read more
impl Eq for ExternalName
[src]
impl Eq for ExternalName
impl PartialEq<ExternalName> for ExternalName
[src]
impl PartialEq<ExternalName> for ExternalName
fn eq(&self, other: &ExternalName) -> bool
[src]
fn eq(&self, other: &ExternalName) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &ExternalName) -> bool
[src]
fn ne(&self, other: &ExternalName) -> bool
This method tests for !=
.
Auto Trait Implementations
impl Send for ExternalName
impl Send for ExternalName
impl Sync for ExternalName
impl Sync for ExternalName