Struct thunderstore::PackageId
source · pub struct PackageId { /* private fields */ }Expand description
A unique identifier for a package, often formatted as namespace-name.
This struct can be created in a number of ways:
use thunderstore::PackageId;
let a = PackageId::new("BepInEx", "BepInExPack");
let b: PackageId = "BepInEx-BepInExPack".parse().unwrap();
let c: PackageId = ("BepInEx", "BepInExPack").into();Most methods on Client accept any type that implements IntoPackageId,
which allows any of the above methods to be used interchangeably.
Implementations§
source§impl PackageId
impl PackageId
pub fn new(namespace: &str, name: &str) -> Self
pub fn namespace(&self) -> &str
pub fn name(&self) -> &str
sourcepub fn path(&self) -> impl Display + '_
pub fn path(&self) -> impl Display + '_
Returns an object that, when formatted with {}, will produce the URL path for this package.
§Example
let id = thunderstore::PackageId::new("BepInEx", "BepInExPack");
assert_eq!(id.path().to_string(), "BepInEx/BepInExPack");sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the PackageId and returns the underlying string, formatted as namespace-name.
Trait Implementations§
source§impl From<&PackageExperimental> for PackageId
impl From<&PackageExperimental> for PackageId
source§fn from(pkg: &PackageExperimental) -> Self
fn from(pkg: &PackageExperimental) -> Self
Converts to this type from the input type.
source§impl Ord for PackageId
impl Ord for PackageId
source§impl PartialEq for PackageId
impl PartialEq for PackageId
source§impl PartialOrd for PackageId
impl PartialOrd for PackageId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for PackageId
Auto Trait Implementations§
impl Freeze for PackageId
impl RefUnwindSafe for PackageId
impl Send for PackageId
impl Sync for PackageId
impl Unpin for PackageId
impl UnwindSafe for PackageId
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default 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.