[][src]Struct exonum::runtime::ArtifactId

#[non_exhaustive]pub struct ArtifactId {
    pub runtime_id: u32,
    pub name: String,
    pub version: Version,
}

The artifact identifier is required to construct service instances. In other words, an artifact identifier is similar to a class name, and a specific service instance is similar to a class instance.

An artifact ID has the following string representation:

{runtime_id}:{artifact_name}:{version}

where:

  • runtime_id is a runtime identifier,
  • artifact_name is the name of the artifact
  • version is the artifact semantic version

Artifact name may contain the following characters: a-zA-Z0-9 and _.-.

Examples

// Typical Rust artifact.
let rust_artifact_id = "0:my-service:1.0.0".parse::<ArtifactId>()?;
// Typical Java artifact.
let java_artifact_id = "1:com.exonum.service:1.0.0".parse::<ArtifactId>()?;

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.
runtime_id: u32

Runtime identifier.

name: String

Artifact name.

version: Version

Semantic version of the artifact.

Methods

impl ArtifactId[src]

pub fn new(
    runtime_id: impl Into<u32>,
    name: impl Into<String>,
    version: Version
) -> Result<Self>
[src]

Creates a new artifact identifier from the given runtime id and name or returns error if the resulting artifact id is not correct.

pub fn from_raw_parts(runtime_id: u32, name: String, version: Version) -> Self[src]

Creates a new artifact identifier from prepared parts without any checks.

Use this method only if you don't need an artifact verification (e.g. in tests).

Stability

Since the internal structure of ArtifactId can change, this method is considered unstable and can break in the future.

pub fn is_upgrade_of(&self, other: &Self) -> bool[src]

Checks if the specified artifact is an upgraded version of another artifact.

pub fn into_default_instance(
    self,
    id: InstanceId,
    name: impl Into<String>
) -> InstanceInitParams
[src]

Converts into InstanceInitParams with the given IDs and an empty constructor.

Trait Implementations

impl BinaryKey for ArtifactId[src]

impl BinaryValue for ArtifactId[src]

impl Clone for ArtifactId[src]

impl Debug for ArtifactId[src]

impl<'de> Deserialize<'de> for ArtifactId[src]

impl Display for ArtifactId[src]

impl Eq for ArtifactId[src]

impl FromStr for ArtifactId[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for ArtifactId[src]

impl ObjectHash for ArtifactId[src]

impl Ord for ArtifactId[src]

impl PartialEq<ArtifactId> for ArtifactId[src]

impl PartialOrd<ArtifactId> for ArtifactId[src]

impl ProtobufConvert for ArtifactId[src]

type ProtoStruct = ArtifactId

Type generated from the Protobuf definition.

impl Serialize for ArtifactId[src]

impl StructuralEq for ArtifactId[src]

impl StructuralPartialEq for ArtifactId[src]

impl ValidateInput for ArtifactId[src]

type Error = Error

The type returned in the event of a validate error.

fn validate(&self) -> Result<(), Self::Error>[src]

Checks that the artifact name contains only allowed characters and is not empty.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,