Skip to main content

ContextBuilder

Struct ContextBuilder 

Source
pub struct ContextBuilder { /* private fields */ }
Expand description

Assemble a context by hand, for a plugin’s own tests.

Implementations§

Source§

impl ContextBuilder

Source

pub fn project_root(self, root: impl Into<PathBuf>) -> Self

Set the project root.

Source

pub fn start_dir(self, dir: impl Into<PathBuf>) -> Self

Set the invocation directory.

Source

pub fn matched<I, S>(self, files: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Set the matched files.

Source

pub fn config_files<I, P>(self, paths: I) -> Self
where I: IntoIterator<Item = P>, P: Into<PathBuf>,

Set the project config files that would have been read.

Source

pub fn pin(self, family: &str, plugin: &str) -> Self

Pin one family to one plugin.

Source

pub fn reason(self, reason: SelectionReason) -> Self

Say why this plugin would have been selected.

Source

pub fn score(self, score: u32) -> Self

Set the evidence score.

Source

pub fn file(self, name: &str, contents: impl Into<Vec<u8>>) -> Self

Offer the contents of one declared file.

Source

pub fn build(self) -> Context<'static>

Build it.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.