Enum DiscoverIndexPathResolver

Source
pub enum DiscoverIndexPathResolver {
    Remap {
        from: PathBuf,
        to: PathBuf,
    },
    Custom {
        f: Box<dyn Fn(&Path) -> Option<PathBuf>>,
    },
}
Expand description

A resolver for test index data file paths.

§Examples


let resolver = DiscoverIndexPathResolver::Remap {from: "foo".into(), to: "bar".into()};

assert_eq!(resolver.resolve(Path::new("foo/bar/baz")), Some(PathBuf::from("bar/bar/baz")));
assert_eq!(resolver.resolve(Path::new("bar/baz")), None);

Variants§

§

Remap

Remaps the index path from the given from path to the given to path.

Fields

§from: PathBuf

The path to strip from the index path.

§to: PathBuf

The path to append to the stripped index path.

§

Custom

A custom remapping function.

Fields

§f: Box<dyn Fn(&Path) -> Option<PathBuf>>

The remapping function.

Implementations§

Source§

impl DiscoverIndexPathResolver

Source

pub fn resolve(&self, p: &Path) -> Option<PathBuf>

Resolves the index path from the given Difftest directory.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T