#[non_exhaustive]pub struct CollectionManifest {Show 13 fields
pub schema_version: u32,
pub collection_id: Uuid,
pub version: String,
pub parent: Option<Hash>,
pub changelog: Option<String>,
pub entries: Vec<CollectionEntry>,
pub package: Option<PackageProfile>,
pub signature: Option<String>,
pub public_key: Option<String>,
pub content_type: Option<ContentType>,
pub editorial_state: Option<EditorialState>,
pub channels: Vec<Channel>,
pub metadata: Option<PackageMetadata>,
}Expand description
Immutable description of a collection version.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.schema_version: u32§collection_id: Uuid§version: String§parent: Option<Hash>§changelog: Option<String>§entries: Vec<CollectionEntry>§package: Option<PackageProfile>§signature: Option<String>§public_key: Option<String>§content_type: Option<ContentType>Content type taxonomy — None means the collection behaves as a
generic file set (default, backward-compatible behaviour).
editorial_state: Option<EditorialState>Editorial lifecycle stage — None means the collection is in the
implicit Published state (backward-compatible).
channels: Vec<Channel>Channels this collection version should be announced on.
An empty list means the collection is broadcast only on the default public catalog topic.
metadata: Option<PackageMetadata>Application-specific metadata (optional).
Implementations§
Source§impl CollectionManifest
impl CollectionManifest
pub fn new(collection_id: Uuid, version: impl Into<String>) -> Self
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
§Errors
Returns an error when the schema, version, paths, dependencies, or duplicate entries are invalid.
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>>
pub fn to_bytes(&self) -> Result<Vec<u8>>
§Errors
Returns an error when the manifest is invalid or cannot be serialized.
Sourcepub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self>
pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self>
§Errors
Returns an error when the manifest cannot be decoded or is invalid.
Sourcepub fn unsigned_bytes(&self) -> Result<Vec<u8>>
pub fn unsigned_bytes(&self) -> Result<Vec<u8>>
Serialize the manifest without its signature.
The public key remains part of this representation so changing the signer changes the manifest identity.
§Errors
Returns an error when the manifest is invalid or cannot be serialized.
Sourcepub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
pub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
Sign the manifest with an Ed25519 maintainer key.
The signature is encoded as lowercase hexadecimal in the manifest.
§Errors
Returns an error when the manifest is invalid or cannot be serialized.
Sourcepub fn verify_signature(&self) -> Result<()>
pub fn verify_signature(&self) -> Result<()>
Verify the manifest’s embedded Ed25519 signature.
Unsigned manifests have no signature to verify and return Ok(());
a partially signed manifest is rejected.
§Errors
Returns an error when signature metadata is malformed or verification fails.
Sourcepub fn version_ordering(&self, other_manifest: &Self) -> Result<Ordering>
pub fn version_ordering(&self, other_manifest: &Self) -> Result<Ordering>
Compare this manifest’s semver version with another manifest.
§Errors
Returns an error when either manifest contains an invalid semver version.
Sourcepub fn is_upgrade_from(&self, other: &Self) -> Result<bool>
pub fn is_upgrade_from(&self, other: &Self) -> Result<bool>
Return whether this manifest is a newer version than another manifest.
§Errors
Returns an error when either manifest contains an invalid semver version.
Sourcepub fn dependencies_satisfied(
&self,
available: &BTreeMap<Uuid, Version>,
) -> Result<bool>
pub fn dependencies_satisfied( &self, available: &BTreeMap<Uuid, Version>, ) -> Result<bool>
Check whether all package dependencies are available.
§Errors
Returns an error when package metadata or dependency requirements are invalid.
Sourcepub fn content_id(&self) -> Result<Hash>
pub fn content_id(&self) -> Result<Hash>
§Errors
Returns an error when the manifest cannot be serialized.
Sourcepub fn blob_id(&self) -> Result<Hash>
pub fn blob_id(&self) -> Result<Hash>
Return the content hash of the serialized manifest blob.
This differs from Self::content_id for signed manifests because
the signature is intentionally excluded from the logical manifest ID.
§Errors
Returns an error when the manifest is invalid or cannot be serialized.
Sourcepub const fn has_editorial_metadata(&self) -> bool
pub const fn has_editorial_metadata(&self) -> bool
Whether this collection has opted into editorial flows.
Sourcepub fn effective_state(&self) -> EditorialState
pub fn effective_state(&self) -> EditorialState
The effective editorial state (defaults to Published).
Sourcepub fn effective_content_type(&self) -> &ContentType
pub fn effective_content_type(&self) -> &ContentType
The effective content type (defaults to Generic).
Trait Implementations§
Source§impl Clone for CollectionManifest
impl Clone for CollectionManifest
Source§fn clone(&self) -> CollectionManifest
fn clone(&self) -> CollectionManifest
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 CollectionManifest
impl Debug for CollectionManifest
Source§impl<'de> Deserialize<'de> for CollectionManifest
impl<'de> Deserialize<'de> for CollectionManifest
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>,
impl Eq for CollectionManifest
Source§impl PartialEq for CollectionManifest
impl PartialEq for CollectionManifest
Source§impl Serialize for CollectionManifest
impl Serialize for CollectionManifest
impl StructuralPartialEq for CollectionManifest
Auto Trait Implementations§
impl Freeze for CollectionManifest
impl RefUnwindSafe for CollectionManifest
impl Send for CollectionManifest
impl Sync for CollectionManifest
impl Unpin for CollectionManifest
impl UnsafeUnpin for CollectionManifest
impl UnwindSafe for CollectionManifest
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more