[−][src]Struct bindle::Id
A parsed representation of an ID string for a bindle. This is currently defined as an arbitrary path with a version string at the end.
Examples of valid ID strings include:
foo/0.1.0
example.com/foo/1.2.3
example.com/a/longer/path/foo/1.10.0-rc.1
An Id
can be parsed from any string using the .parse()
method:
use bindle::Id; let id: Id = "example.com/foo/1.2.3".parse().expect("should parse"); println!("{}", id);
An Id
can also be parsed from any string using the TryFrom
or TryInto
trait:
use bindle::Id; use std::convert::TryInto; let id: Id = String::from("example.com/a/longer/path/foo/1.10.0-rc.1") .try_into().expect("should parse"); println!("{}", id);
Implementations
impl Id
[src]
pub fn name(&self) -> &str
[src]
Returns the name part of the ID
pub fn version(&self) -> &Version
[src]
pub fn version_string(&self) -> String
[src]
Returns the version part of the ID. This is returned as a String
as it is a conversion
from the underlying semver
pub fn sha(&self) -> String
[src]
Returns the SHA256 sum of this Id for use as a common identifier
We don't typically want to store a bindle with its name and version number. This
would impose both naming constraints on the bindle and security issues on the
storage layout. So this function hashes the name/version data (which together
MUST be unique in the system) and uses the resulting hash as the canonical
name. The hash is guaranteed to be in the character set [a-zA-Z0-9]
.
Trait Implementations
impl Clone for Id
[src]
impl Debug for Id
[src]
impl<'de> Deserialize<'de> for Id
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Id
[src]
impl<'_> From<&'_ Id> for Id
[src]
impl FromStr for Id
[src]
type Err = ParseError
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Self, ParseError>
[src]
impl Serialize for Id
[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'_> TryFrom<&'_ String> for Id
[src]
type Error = ParseError
The type returned in the event of a conversion error.
pub fn try_from(value: &String) -> Result<Self, ParseError>
[src]
impl<'_> TryFrom<&'_ str> for Id
[src]
type Error = ParseError
The type returned in the event of a conversion error.
pub fn try_from(value: &str) -> Result<Self, ParseError>
[src]
impl TryFrom<String> for Id
[src]
Auto Trait Implementations
impl RefUnwindSafe for Id
[src]
impl Send for Id
[src]
impl Sync for Id
[src]
impl Unpin for Id
[src]
impl UnwindSafe for Id
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
pub fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>
pub fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send, Global> where
T: Send,
T: Send,
pub fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync, Global> where
T: Sync,
T: Sync,
pub fn clone_any_send_sync(
&self
) -> Box<dyn CloneAny + 'static + Send + Sync, Global> where
T: Send + Sync,
&self
) -> Box<dyn CloneAny + 'static + Send + Sync, Global> where
T: Send + Sync,
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,