[−][src]Struct nix_query_tree_viewer::nix_query_tree::NixQueryPathMap
A mapping of NixQueryDrv
to TreePath
. This gives an easy way to
figure out where a NixQueryDrv
is an a NixQueryTree
.
use indoc::indoc; use nix_query_tree_viewer::nix_query_tree::{NixQueryDrv, NixQueryTree}; use nix_query_tree_viewer::tree::Path; use std::str::FromStr; let raw_tree = indoc!( "/nix/store/qy93dp4a3rqyn2mz63fbxjg228hffwyw-hello-2.10 +---/nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27 | +---/nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27 [...] +---/nix/store/qy93dp4a3rqyn2mz63fbxjg228hffwyw-hello-2.10 [...] +---/nix/store/9ny6szla9dg61jv8q22qbnqsz37465n0-multiple-outputs.sh +---/nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27 [...] +---/nix/store/5wvmvcc3b7sisirx1vsqbqdis0sd1x5d-cc-wrapper.sh +---/nix/store/5jzbjvnrz85n454inlyxcpgap9i6k6la-pcre-8.43 " ); let nix_query_tree = NixQueryTree::from_str(raw_tree).unwrap(); let map = nix_query_tree.path_map(); let pcre_drv = NixQueryDrv::from("/nix/store/5jzbjvnrz85n454inlyxcpgap9i6k6la-pcre-8.43"); let expected_path = Some(Path::from(vec![2, 0, 1])); assert_eq!(map.lookup_first(&pcre_drv), expected_path.as_ref());
Methods
impl NixQueryPathMap
[src]
pub fn lookup_first(&self, k: &NixQueryDrv) -> Option<&Path>
[src]
Trait Implementations
impl Clone for NixQueryPathMap
[src]
fn clone(&self) -> NixQueryPathMap
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for NixQueryPathMap
[src]
impl Eq for NixQueryPathMap
[src]
impl PartialEq<NixQueryPathMap> for NixQueryPathMap
[src]
fn eq(&self, other: &NixQueryPathMap) -> bool
[src]
fn ne(&self, other: &NixQueryPathMap) -> bool
[src]
impl StructuralEq for NixQueryPathMap
[src]
impl StructuralPartialEq for NixQueryPathMap
[src]
Auto Trait Implementations
impl RefUnwindSafe for NixQueryPathMap
impl Send for NixQueryPathMap
impl Sync for NixQueryPathMap
impl Unpin for NixQueryPathMap
impl UnwindSafe for NixQueryPathMap
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,