pub struct ComponentName { /* private fields */ }
Expand description
An import or export name in the component model which is backed by T
,
which defaults to String
.
This name can be either:
- a plain label or “kebab string”:
a-b-c
- a plain method name :
[method]a-b.c-d
- a plain static method name :
[static]a-b.c-d
- a plain constructor:
[constructor]a-b
- an interface name:
wasi:cli/reactor@0.1.0
- a dependency name:
locked-dep=foo:bar/baz
- a URL name:
url=https://..
- a hash name:
integrity=sha256:...
§Equality and hashing
Note that this type the [method]...
and [static]...
variants are
considered equal and hash to the same value. This enables disallowing
clashes between the two where method name overlap cannot happen.
Implementations§
Source§impl ComponentName
impl ComponentName
Sourcepub fn new(
name: &str,
offset: usize,
) -> Result<ComponentName, BinaryReaderError>
pub fn new( name: &str, offset: usize, ) -> Result<ComponentName, BinaryReaderError>
Attempts to parse name
as a valid component name, returning Err
if
it’s not valid.
Sourcepub fn new_with_features(
name: &str,
offset: usize,
features: WasmFeatures,
) -> Result<ComponentName, BinaryReaderError>
pub fn new_with_features( name: &str, offset: usize, features: WasmFeatures, ) -> Result<ComponentName, BinaryReaderError>
Attempts to parse name
as a valid component name, returning Err
if
it’s not valid.
features
can be used to enable or disable validation of certain forms
of supported import names.
Sourcepub fn kind(&self) -> ComponentNameKind<'_>
pub fn kind(&self) -> ComponentNameKind<'_>
Returns the ComponentNameKind
corresponding to this name.
Trait Implementations§
Source§impl Clone for ComponentName
impl Clone for ComponentName
Source§fn clone(&self) -> ComponentName
fn clone(&self) -> ComponentName
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 ComponentName
impl Debug for ComponentName
Source§impl Display for ComponentName
impl Display for ComponentName
Source§impl From<ComponentName> for String
impl From<ComponentName> for String
Source§fn from(name: ComponentName) -> String
fn from(name: ComponentName) -> String
Converts to this type from the input type.
Source§impl Hash for ComponentName
impl Hash for ComponentName
Source§impl Ord for ComponentName
impl Ord for ComponentName
Source§fn cmp(&self, other: &ComponentName) -> Ordering
fn cmp(&self, other: &ComponentName) -> 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 ComponentName
impl PartialEq for ComponentName
Source§impl PartialOrd for ComponentName
impl PartialOrd for ComponentName
impl Eq for ComponentName
Auto Trait Implementations§
impl Freeze for ComponentName
impl RefUnwindSafe for ComponentName
impl Send for ComponentName
impl Sync for ComponentName
impl Unpin for ComponentName
impl UnwindSafe for ComponentName
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.