pub struct StoreState { /* private fields */ }
Expand description
The state of the Nix
store at a given point in time
Implementations§
Source§impl StoreState
impl StoreState
Sourcepub fn new(config: NixConfiguration) -> Self
pub fn new(config: NixConfiguration) -> Self
Create a new, empty, StoreState
with the specified Nix
configuration
Sourcepub fn add_path(&mut self, path: impl AsRef<Path>) -> Result<(), StoreError>
pub fn add_path(&mut self, path: impl AsRef<Path>) -> Result<(), StoreError>
Add a path to the StoreState
§Errors
Will propagate an error if the prefix is impossible to strip due to misconfiguration
Sourcepub fn paths(&self) -> impl Iterator<Item = PathBuf> + '_
pub fn paths(&self) -> impl Iterator<Item = PathBuf> + '_
Iterator over the paths in this StoreState
Sourcepub fn diff(&self, other: &StoreState) -> Result<Self, StoreError>
pub fn diff(&self, other: &StoreState) -> Result<Self, StoreError>
Return all paths that are different between this StoreState
and another StoreState
This returns elements that are in other
, but not in self
§Errors
Will return an error if two stores with incompatible configuration are compared.
Sourcepub fn path_count(&self) -> usize
pub fn path_count(&self) -> usize
Returns the number of unique paths in the store
Sourcepub fn from_store_excluding(
configuration: &NixConfiguration,
excludes: &[Regex],
) -> Result<Self, StoreError>
pub fn from_store_excluding( configuration: &NixConfiguration, excludes: &[Regex], ) -> Result<Self, StoreError>
Create a StoreState
from the current status of the Nix
store pointed to by the given
NixConfiguration
including installables as well as other paths matching the supplied
regexes
§Errors
Will propagate any IO errors that occur trying to enumerate the Nix
store
Sourcepub fn from_store(configuration: &NixConfiguration) -> Result<Self, StoreError>
pub fn from_store(configuration: &NixConfiguration) -> Result<Self, StoreError>
Create a StoreState
from the current status of the Nix
store pointed to by the given
NixConfiguration
This is a wrapper around from_store_excluding
with the
default include filters implied.
The default filters will include:
- Any installable (non-disableable)
- Any
nix-shell
derivations
§Errors
Will propagate any IO errors that occur trying to enumerate the Nix
store
Sourcepub async fn filter_against_cache(
self,
cache_uri: &str,
) -> Result<Self, StoreError>
pub async fn filter_against_cache( self, cache_uri: &str, ) -> Result<Self, StoreError>
Filter this Store
state against the given nix binary cache, removing any paths that are
present in the cache. The provided cache uri is expected not to have a trailing slash
§Errors
Will propagate any network or nix store interaction errors that occur
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for StoreState
impl<'__de, __Context> BorrowDecode<'__de, __Context> for StoreState
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for StoreState
impl Clone for StoreState
Source§fn clone(&self) -> StoreState
fn clone(&self) -> StoreState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StoreState
impl Debug for StoreState
Source§impl<__Context> Decode<__Context> for StoreState
impl<__Context> Decode<__Context> for StoreState
Source§impl Default for StoreState
impl Default for StoreState
Source§fn default() -> StoreState
fn default() -> StoreState
Source§impl Encode for StoreState
impl Encode for StoreState
Source§impl PartialEq for StoreState
impl PartialEq for StoreState
impl Eq for StoreState
impl StructuralPartialEq for StoreState
Auto Trait Implementations§
impl Freeze for StoreState
impl RefUnwindSafe for StoreState
impl Send for StoreState
impl Sync for StoreState
impl Unpin for StoreState
impl UnwindSafe for StoreState
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.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> 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