pub struct UnverifiedOutputsBuilder(OutputsInner);Expand description
Builder for making unverified Outputs.
Even when not verifying the output path of a set of outputs, there are still invariants that
must be upheld. But rather than checking all of them in one go, it is useful during construction
to check each output as they are added and then do a final check when building the Outputs.
§Examples
use nix_compat::derivation::{OutputName, UnverifiedOutputsBuilder};
use nix_compat::store_path::StorePath;
let mut builder = UnverifiedOutputsBuilder::new();
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
builder.try_insert(OutputName::out(), out_sp, None).unwrap();
let outputs = builder.try_build().unwrap();Tuple Fields§
§0: OutputsInnerImplementations§
Source§impl UnverifiedOutputsBuilder
impl UnverifiedOutputsBuilder
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of outputs
§Examples
use nix_compat::derivation::{OutputName, UnverifiedOutputsBuilder};
use nix_compat::store_path::StorePath;
let mut builder = UnverifiedOutputsBuilder::new();
assert_eq!(builder.len(), 0);
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
builder.try_insert(OutputName::out(), out_sp, None).unwrap();
assert_eq!(builder.len(), 1);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there are not outputs defined in this builder.
§Examples
use nix_compat::derivation::{OutputName, UnverifiedOutputsBuilder};
use nix_compat::store_path::StorePath;
let mut builder = UnverifiedOutputsBuilder::new();
assert!(builder.is_empty());
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
builder.try_insert(OutputName::out(), out_sp, None).unwrap();
assert!(!builder.is_empty());Sourcepub fn is_input_addressed(&self) -> bool
pub fn is_input_addressed(&self) -> bool
Returns true if this is a set of input addressed outputs.
§Examples
use nix_compat::derivation::{OutputName, UnverifiedOutputsBuilder};
use nix_compat::store_path::StorePath;
let mut a = UnverifiedOutputsBuilder::new();
assert!(!a.is_input_addressed());
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
a.try_insert(OutputName::out(), out_sp, None).unwrap();
assert!(a.is_input_addressed());
let bin_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyib-has-multi-out-bin".parse().unwrap();
a.try_insert(OutputName::from_static("bin").unwrap(), bin_sp, None).unwrap();
assert!(a.is_input_addressed());
let mut b = UnverifiedOutputsBuilder::new();
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
b.try_insert(OutputName::out(), out_sp, Some(output_hash)).unwrap();
assert!(!b.is_input_addressed());Sourcepub fn is_single(&self) -> bool
pub fn is_single(&self) -> bool
Returns true if this builder contains a single output called “out”
§Examples
use nix_compat::derivation::{OutputName, UnverifiedOutputsBuilder};
use nix_compat::store_path::StorePath;
let mut a = UnverifiedOutputsBuilder::new();
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
a.try_insert(OutputName::out(), out_sp, None).unwrap();
assert!(a.is_single());
let bin_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyib-has-multi-out-bin".parse().unwrap();
a.try_insert(OutputName::from_static("bin").unwrap(), bin_sp, None).unwrap();
assert!(!a.is_single());
let mut b = UnverifiedOutputsBuilder::new();
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
b.try_insert(OutputName::out(), out_sp, Some(output_hash)).unwrap();
assert!(b.is_single());Sourcepub fn is_fixed(&self) -> bool
pub fn is_fixed(&self) -> bool
Returns true if this is a set of input addressed outputs.
§Examples
use nix_compat::derivation::{OutputName, UnverifiedOutputsBuilder};
use nix_compat::store_path::StorePath;
let mut a = UnverifiedOutputsBuilder::new();
assert!(!a.is_fixed());
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
a.try_insert(OutputName::out(), out_sp, None).unwrap();
assert!(!a.is_fixed());
let mut b = UnverifiedOutputsBuilder::new();
let out_sp : StorePath = "2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out".parse().unwrap();
b.try_insert(OutputName::out(), out_sp, Some(output_hash)).unwrap();
assert!(b.is_fixed());Sourcepub fn contains_key(&self, name: &OutputName) -> bool
pub fn contains_key(&self, name: &OutputName) -> bool
Returns true if the outputs contains an output with the specified name.
Sourcepub fn get(&self, name: &OutputName) -> Option<&StorePath>
pub fn get(&self, name: &OutputName) -> Option<&StorePath>
Returns a reference to the StorePath corresponding to the provided name.
Sourcepub fn names(&self) -> OutputNames<'_> ⓘ
pub fn names(&self) -> OutputNames<'_> ⓘ
Gets an iterator over the names of the outputs, in sorted order.
Sourcepub fn into_names(self) -> IntoOutputNames ⓘ
pub fn into_names(self) -> IntoOutputNames ⓘ
Consume this builder and return an iterator over the names of the outputs, in sorted order.
Sourcepub fn iter(&self) -> Iter<'_> ⓘ
pub fn iter(&self) -> Iter<'_> ⓘ
Gets an iterator over the entries of the outputs, sorted by name.
Sourcepub fn store_paths(&self) -> impl Iterator<Item = &StorePath>
pub fn store_paths(&self) -> impl Iterator<Item = &StorePath>
Gets an iterator over the StorePath values of the outputs, in order by name.
Sourcepub fn try_insert(
&mut self,
output_name: OutputName,
output_path: StorePath,
output_hash: Option<OutputHash>,
) -> Result<(), OutputsError>
pub fn try_insert( &mut self, output_name: OutputName, output_path: StorePath, output_hash: Option<OutputHash>, ) -> Result<(), OutputsError>
Try to insert a new output with the provided values and an error if this violates the invariants.
Trait Implementations§
Source§impl Clone for UnverifiedOutputsBuilder
impl Clone for UnverifiedOutputsBuilder
Source§fn clone(&self) -> UnverifiedOutputsBuilder
fn clone(&self) -> UnverifiedOutputsBuilder
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 UnverifiedOutputsBuilder
impl Debug for UnverifiedOutputsBuilder
Source§impl Default for UnverifiedOutputsBuilder
impl Default for UnverifiedOutputsBuilder
Source§fn default() -> UnverifiedOutputsBuilder
fn default() -> UnverifiedOutputsBuilder
Source§impl From<Outputs> for UnverifiedOutputsBuilder
impl From<Outputs> for UnverifiedOutputsBuilder
Source§impl<'a> IntoIterator for &'a UnverifiedOutputsBuilder
impl<'a> IntoIterator for &'a UnverifiedOutputsBuilder
Source§impl PartialEq for UnverifiedOutputsBuilder
impl PartialEq for UnverifiedOutputsBuilder
Source§fn eq(&self, other: &UnverifiedOutputsBuilder) -> bool
fn eq(&self, other: &UnverifiedOutputsBuilder) -> bool
self and other values to be equal, and is used by ==.impl Eq for UnverifiedOutputsBuilder
impl StructuralPartialEq for UnverifiedOutputsBuilder
Auto Trait Implementations§
impl Freeze for UnverifiedOutputsBuilder
impl RefUnwindSafe for UnverifiedOutputsBuilder
impl Send for UnverifiedOutputsBuilder
impl Sync for UnverifiedOutputsBuilder
impl Unpin for UnverifiedOutputsBuilder
impl UnsafeUnpin for UnverifiedOutputsBuilder
impl UnwindSafe for UnverifiedOutputsBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.