[−][src]Struct exonum::runtime::versioning::ArtifactReq
Requirement on an artifact. Can be matched against artifact identifiers.
Examples
// Requirements can be parsed from a string. let req: ArtifactReq = "some.Service@^1.3.0".parse()?; let valid_artifact = ArtifactId::new( RuntimeIdentifier::Rust as u32, "some.Service".to_owned(), "1.5.7".parse()?, )?; assert!(req.try_match(&valid_artifact).is_ok()); // This artifact is outdated. let mut outdated_artifact = valid_artifact.clone(); outdated_artifact.version = "1.2.0".parse()?; assert!(req.try_match(&outdated_artifact).is_err()); // This artifact is too new. let mut novel_artifact = valid_artifact.clone(); novel_artifact.version = "2.0.0".parse()?; assert!(req.try_match(&novel_artifact).is_err()); // This artifact has wrong name. let mut other_artifact = valid_artifact.clone(); other_artifact.name = "other.Service".to_owned(); assert!(req.try_match(&novel_artifact).is_err());
Fields (Non-exhaustive)
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.name: String
Artifact name.
version: VersionReq
Allowed artifact versions.
Methods
impl ArtifactReq
[src]
pub fn new(name: impl Into<String>, version: VersionReq) -> Self
[src]
Creates a new artifact requirement.
pub fn try_match(&self, artifact: &ArtifactId) -> Result<(), ArtifactReqError>
[src]
Tries to match this requirement against the provided artifact.
Trait Implementations
impl Clone for ArtifactReq
[src]
fn clone(&self) -> ArtifactReq
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ArtifactReq
[src]
impl Display for ArtifactReq
[src]
impl FromStr for ArtifactReq
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<ArtifactReq> for ArtifactReq
[src]
fn eq(&self, other: &ArtifactReq) -> bool
[src]
fn ne(&self, other: &ArtifactReq) -> bool
[src]
impl StructuralPartialEq for ArtifactReq
[src]
Auto Trait Implementations
impl RefUnwindSafe for ArtifactReq
impl Send for ArtifactReq
impl Sync for ArtifactReq
impl Unpin for ArtifactReq
impl UnwindSafe for ArtifactReq
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,