pub struct PackageName {
pub namespace: String,
pub name: String,
pub version: Option<Version>,
}
Expand description
A structure used to keep track of the name of a package, containing optional information such as a namespace and version information.
This is directly encoded as an “ID” in the binary component representation with an interfaced tacked on as well.
Fields§
§namespace: String
A namespace such as wasi
in wasi:foo/bar
name: String
The kebab-name of this package, which is always specified.
version: Option<Version>
Optional major/minor version information.
Implementations§
Source§impl PackageName
impl PackageName
Sourcepub fn interface_id(&self, interface: &str) -> String
pub fn interface_id(&self, interface: &str) -> String
Returns the ID that this package name would assign the interface
name
specified.
Sourcepub fn version_compat_track(version: &Version) -> Version
pub fn version_compat_track(version: &Version) -> Version
Determines the “semver compatible track” for the given version.
This method implements the logic from the component model where semver versions can be compatible with one another. For example versions 1.2.0 and 1.2.1 would be considered both compatible with one another because they’re on the same semver compatible track.
This predicate is used during
Resolve::merge_world_imports_based_on_semver
for example to
determine whether two imports can be merged together. This is
additionally used when creating components to match up imports in
core wasm to imports in worlds.
Sourcepub fn version_compat_track_string(version: &Version) -> String
pub fn version_compat_track_string(version: &Version) -> String
Returns the string corresponding to
PackageName::version_compat_track
. This is done to match the
component model’s expected naming scheme of imports and exports.
Trait Implementations§
Source§impl Clone for PackageName
impl Clone for PackageName
Source§fn clone(&self) -> PackageName
fn clone(&self) -> PackageName
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PackageName
impl Debug for PackageName
Source§impl Display for PackageName
impl Display for PackageName
Source§impl From<PackageName> for String
impl From<PackageName> for String
Source§fn from(name: PackageName) -> String
fn from(name: PackageName) -> String
Source§impl Hash for PackageName
impl Hash for PackageName
Source§impl Ord for PackageName
impl Ord for PackageName
Source§fn cmp(&self, other: &PackageName) -> Ordering
fn cmp(&self, other: &PackageName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PackageName
impl PartialEq for PackageName
Source§impl PartialOrd for PackageName
impl PartialOrd for PackageName
Source§impl Serialize for PackageName
impl Serialize for PackageName
impl Eq for PackageName
impl StructuralPartialEq for PackageName
Auto Trait Implementations§
impl Freeze for PackageName
impl RefUnwindSafe for PackageName
impl Send for PackageName
impl Sync for PackageName
impl Unpin for PackageName
impl UnwindSafe for PackageName
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key
and return true
if they are equal.