pub struct ConcreteVersion(/* private fields */);Expand description
A concrete, resolved version string as returned by a registry.
This is deliberately permissive: it stores whatever bytes the registry
returned (e.g. "1.2.3", "2.0.0-beta.1"), including the empty string.
No parsing, validation, trimming, or normalization is performed by this
type — ecosystems that need to parse a version (via semver,
node-semver, pep440_rs, etc.) do so from ConcreteVersion::as_str,
not from this type. It is distinct from VersionReq: a VersionReq is
a constraint written in a manifest ("^1.0"), while a ConcreteVersion
is a single resolved version ("1.0.4").
§Examples
use deps_core::ConcreteVersion;
let version = ConcreteVersion::new("1.2.3");
assert_eq!(version.as_str(), "1.2.3");
assert_eq!(version, "1.2.3");Implementations§
Source§impl ConcreteVersion
impl ConcreteVersion
Sourcepub fn new(value: impl Into<String>) -> Self
pub fn new(value: impl Into<String>) -> Self
Wraps value as a ConcreteVersion, unchanged.
This never fails and never modifies its input: an empty string is a
valid ConcreteVersion, as is a string with surrounding whitespace.
§Examples
use deps_core::ConcreteVersion;
let version = ConcreteVersion::new(String::from("1.0.0"));
assert_eq!(version.as_str(), "1.0.0");Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the concrete version as a string slice.
§Examples
use deps_core::ConcreteVersion;
let version = ConcreteVersion::new("4.5.6");
assert_eq!(version.as_str(), "4.5.6");Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the ConcreteVersion, returning the wrapped String.
§Examples
use deps_core::ConcreteVersion;
let version = ConcreteVersion::new("4.5.6");
let owned: String = version.into_string();
assert_eq!(owned, "4.5.6");Trait Implementations§
Source§impl AsRef<str> for ConcreteVersion
impl AsRef<str> for ConcreteVersion
Source§impl Clone for ConcreteVersion
impl Clone for ConcreteVersion
Source§fn clone(&self) -> ConcreteVersion
fn clone(&self) -> ConcreteVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConcreteVersion
impl Debug for ConcreteVersion
Source§impl Display for ConcreteVersion
impl Display for ConcreteVersion
impl Eq for ConcreteVersion
Source§impl From<&str> for ConcreteVersion
impl From<&str> for ConcreteVersion
Source§impl From<String> for ConcreteVersion
impl From<String> for ConcreteVersion
Source§impl Hash for ConcreteVersion
impl Hash for ConcreteVersion
Source§impl PartialEq for ConcreteVersion
impl PartialEq for ConcreteVersion
Source§fn eq(&self, other: &ConcreteVersion) -> bool
fn eq(&self, other: &ConcreteVersion) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<&str> for ConcreteVersion
impl PartialEq<&str> for ConcreteVersion
Source§impl PartialEq<str> for ConcreteVersion
impl PartialEq<str> for ConcreteVersion
impl StructuralPartialEq for ConcreteVersion
Auto Trait Implementations§
impl Freeze for ConcreteVersion
impl RefUnwindSafe for ConcreteVersion
impl Send for ConcreteVersion
impl Sync for ConcreteVersion
impl Unpin for ConcreteVersion
impl UnsafeUnpin for ConcreteVersion
impl UnwindSafe for ConcreteVersion
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.