pub struct SnapshotMetadataBuilder { /* private fields */ }Expand description
Helper to construct SnapshotMetadata.
Implementations§
Source§impl SnapshotMetadataBuilder
impl SnapshotMetadataBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new SnapshotMetadataBuilder. It defaults to:
- version: 1
- expires: 7 days from the current time.
Sourcepub fn from_targets<D>(
targets: &SignedMetadata<D, TargetsMetadata>,
hash_algs: &[HashAlgorithm],
) -> Result<Self>where
D: Pouf,
pub fn from_targets<D>(
targets: &SignedMetadata<D, TargetsMetadata>,
hash_algs: &[HashAlgorithm],
) -> Result<Self>where
D: Pouf,
Create a new SnapshotMetadataBuilder from a given snapshot. It defaults to:
- version: 1
- expires: 7 day from the current time.
Sourcepub fn insert_metadata<D, M>(
self,
metadata: &SignedMetadata<D, M>,
hash_algs: &[HashAlgorithm],
) -> Result<Self>
pub fn insert_metadata<D, M>( self, metadata: &SignedMetadata<D, M>, hash_algs: &[HashAlgorithm], ) -> Result<Self>
Add metadata to this snapshot metadata using the default path.
Sourcepub fn insert_metadata_with_path<P, D, M>(
self,
path: P,
metadata: &SignedMetadata<D, M>,
hash_algs: &[HashAlgorithm],
) -> Result<Self>
pub fn insert_metadata_with_path<P, D, M>( self, path: P, metadata: &SignedMetadata<D, M>, hash_algs: &[HashAlgorithm], ) -> Result<Self>
Add metadata to this snapshot metadata using a custom path.
Sourcepub fn insert_metadata_description(
self,
path: MetadataPath,
description: MetadataDescription<TargetsMetadata>,
) -> Self
pub fn insert_metadata_description( self, path: MetadataPath, description: MetadataDescription<TargetsMetadata>, ) -> Self
Add MetadataDescription to this snapshot metadata using a custom path.
Sourcepub fn build(self) -> Result<SnapshotMetadata>
pub fn build(self) -> Result<SnapshotMetadata>
Construct a new SnapshotMetadata.
Sourcepub fn signed<D>(
self,
private_key: &dyn PrivateKey,
) -> Result<SignedMetadata<D, SnapshotMetadata>>where
D: Pouf,
pub fn signed<D>(
self,
private_key: &dyn PrivateKey,
) -> Result<SignedMetadata<D, SnapshotMetadata>>where
D: Pouf,
Construct a new SignedMetadata<D, SnapshotMetadata>.
Trait Implementations§
Source§impl Default for SnapshotMetadataBuilder
impl Default for SnapshotMetadataBuilder
Source§impl From<SnapshotMetadata> for SnapshotMetadataBuilder
impl From<SnapshotMetadata> for SnapshotMetadataBuilder
Source§fn from(meta: SnapshotMetadata) -> Self
fn from(meta: SnapshotMetadata) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SnapshotMetadataBuilder
impl RefUnwindSafe for SnapshotMetadataBuilder
impl Send for SnapshotMetadataBuilder
impl Sync for SnapshotMetadataBuilder
impl Unpin for SnapshotMetadataBuilder
impl UnsafeUnpin for SnapshotMetadataBuilder
impl UnwindSafe for SnapshotMetadataBuilder
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
Mutably borrows from an owned value. Read more