Struct scarb::core::PackageName
source · pub struct PackageName(_);Expand description
A String-like type representing Package name.
- Instances of this type are validated upon construction to comply with the package naming rules.
- Values are immutable.
CloneisO(1).- Short names (which is common for package names) are stack-allocated.
Package naming rules are described in Scarb docs.
Implementations§
source§impl PackageName
impl PackageName
pub const CORE: Self = _
pub const STARKNET: Self = _
sourcepub fn new(name: impl AsRef<str>) -> Self
pub fn new(name: impl AsRef<str>) -> Self
Constructs and validates new PackageName.
Panics if name does not conform to package naming rules.
sourcepub fn try_new(name: impl AsRef<str>) -> Result<Self>
pub fn try_new(name: impl AsRef<str>) -> Result<Self>
Constructs and validates new PackageName.
sourcepub unsafe fn new_unchecked(name: impl AsRef<str>) -> Self
pub unsafe fn new_unchecked(name: impl AsRef<str>) -> Self
Constructs new PackageName without validating it to conform to package naming rules.
Safety
- Does not validate name to conform package naming rules.
pub fn as_str(&self) -> &str
pub fn to_smol_str(&self) -> SmolStr
Trait Implementations§
source§impl AsRef<str> for PackageName
impl AsRef<str> for PackageName
source§impl Borrow<str> for PackageName
impl Borrow<str> for PackageName
source§impl Clone for PackageName
impl Clone for PackageName
source§fn clone(&self) -> PackageName
fn clone(&self) -> PackageName
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 PackageName
impl Debug for PackageName
source§impl<'de> Deserialize<'de> for PackageName
impl<'de> Deserialize<'de> for PackageName
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for PackageName
impl Display for PackageName
source§impl From<PackageName> for SmolStr
impl From<PackageName> for SmolStr
source§fn from(value: PackageName) -> Self
fn from(value: PackageName) -> Self
Converts to this type from the input type.
source§impl From<PackageName> for String
impl From<PackageName> for String
source§fn from(value: PackageName) -> Self
fn from(value: PackageName) -> Self
Converts to this type from the input type.
source§impl FromStr for PackageName
impl FromStr for PackageName
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,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<PackageName> for PackageName
impl PartialEq<PackageName> for PackageName
source§fn eq(&self, other: &PackageName) -> bool
fn eq(&self, other: &PackageName) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd<PackageName> for PackageName
impl PartialOrd<PackageName> for PackageName
source§fn partial_cmp(&self, other: &PackageName) -> Option<Ordering>
fn partial_cmp(&self, other: &PackageName) -> Option<Ordering>
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 moresource§impl Serialize for PackageName
impl Serialize for PackageName
source§impl TryFrom<&str> for PackageName
impl TryFrom<&str> for PackageName
source§impl TryFrom<SmolStr> for PackageName
impl TryFrom<SmolStr> for PackageName
source§impl TryFrom<String> for PackageName
impl TryFrom<String> for PackageName
impl Eq for PackageName
impl StructuralEq for PackageName
impl StructuralPartialEq for PackageName
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<I> IntoResettable<String> for Iwhere
I: Into<String>,
impl<I> IntoResettable<String> for Iwhere I: Into<String>,
§fn into_resettable(self) -> Resettable<String>
fn into_resettable(self) -> Resettable<String>
Convert to the intended resettable type