pub struct RootMetadataBuilder { /* private fields */ }Expand description
Helper to construct RootMetadata.
Implementations§
Source§impl RootMetadataBuilder
impl RootMetadataBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new RootMetadataBuilder. It defaults to:
- version: 1,
- expires: 365 days from the current time.
- consistent snapshot: true
- role thresholds: 1
Sourcepub fn consistent_snapshot(self, consistent_snapshot: bool) -> Self
pub fn consistent_snapshot(self, consistent_snapshot: bool) -> Self
Set this metadata to have a consistent snapshot.
Sourcepub fn root_threshold(self, threshold: u32) -> Self
pub fn root_threshold(self, threshold: u32) -> Self
Set the root threshold.
Sourcepub fn snapshot_threshold(self, threshold: u32) -> Self
pub fn snapshot_threshold(self, threshold: u32) -> Self
Set the snapshot threshold.
Sourcepub fn snapshot_key(self, public_key: PublicKey) -> Self
pub fn snapshot_key(self, public_key: PublicKey) -> Self
Add a snapshot public key.
Sourcepub fn targets_threshold(self, threshold: u32) -> Self
pub fn targets_threshold(self, threshold: u32) -> Self
Set the targets threshold.
Sourcepub fn targets_key(self, public_key: PublicKey) -> Self
pub fn targets_key(self, public_key: PublicKey) -> Self
Add a targets public key.
Sourcepub fn timestamp_threshold(self, threshold: u32) -> Self
pub fn timestamp_threshold(self, threshold: u32) -> Self
Set the timestamp threshold.
Sourcepub fn timestamp_key(self, public_key: PublicKey) -> Self
pub fn timestamp_key(self, public_key: PublicKey) -> Self
Add a timestamp public key.
Sourcepub fn build(self) -> Result<RootMetadata>
pub fn build(self) -> Result<RootMetadata>
Construct a new RootMetadata.
Sourcepub fn signed<D>(
self,
private_key: &dyn PrivateKey,
) -> Result<SignedMetadata<D, RootMetadata>>where
D: Pouf,
pub fn signed<D>(
self,
private_key: &dyn PrivateKey,
) -> Result<SignedMetadata<D, RootMetadata>>where
D: Pouf,
Construct a new SignedMetadata<D, RootMetadata>.
Trait Implementations§
Source§impl Default for RootMetadataBuilder
impl Default for RootMetadataBuilder
Source§impl From<RootMetadata> for RootMetadataBuilder
impl From<RootMetadata> for RootMetadataBuilder
Source§fn from(metadata: RootMetadata) -> Self
fn from(metadata: RootMetadata) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RootMetadataBuilder
impl RefUnwindSafe for RootMetadataBuilder
impl Send for RootMetadataBuilder
impl Sync for RootMetadataBuilder
impl Unpin for RootMetadataBuilder
impl UnsafeUnpin for RootMetadataBuilder
impl UnwindSafe for RootMetadataBuilder
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