Struct BuildBuilder

Source
pub struct BuildBuilder<'a> { /* private fields */ }
Expand description

Builder for configuring builds in a BuildDirectory.

Implementations§

Source§

impl BuildBuilder<'_>

Source

pub fn patch_with_git(self, name: &str, uri: &str, branch: &str) -> Self

Add a git-based patch to this build. Patches get added to the crate’s Cargo.toml in the patch.crates-io table.

§Example
let mut build_dir = workspace.build_dir("foo");
build_dir.build(&toolchain, &krate, sandbox)
    .patch_with_git("bar", "https://github.com/foo/bar", "baz")
    .run(|build| {
        build.cargo().args(&["test", "--all"]).run()?;
        Ok(())
    })?;
Source

pub fn patch_with_path(self, name: &str, path: &str) -> Self

Add a path-based patch to this build. Patches get added to the crate’s Cargo.toml in the patch.crates-io table.

§Example
let sandbox = SandboxBuilder::new().mount(
    Path::new(manifest_dir),
    Path::new("/patch/bar"),
    MountKind::ReadOnly,
);
let mut build_dir = workspace.build_dir("foo");
build_dir.build(&toolchain, &krate, sandbox)
    .patch_with_path("bar", "/patch/bar")
    .run(|build| {
        build.cargo().args(&["test", "--all"]).run()?;
        Ok(())
    })?;
Source

pub fn run<R, F: FnOnce(&Build<'_>) -> Result<R>>(self, f: F) -> Result<R>

Run a sandboxed build of the provided crate with the provided toolchain. The closure will be provided an instance of Build that allows spawning new processes inside the sandbox.

All the state will be kept on disk as long as the closure doesn’t exit: after that things might be removed.

§Example
let mut build_dir = workspace.build_dir("foo");
build_dir.build(&toolchain, &krate, sandbox).run(|build| {
    build.cargo().args(&["test", "--all"]).run()?;
    Ok(())
})?;

Auto Trait Implementations§

§

impl<'a> Freeze for BuildBuilder<'a>

§

impl<'a> RefUnwindSafe for BuildBuilder<'a>

§

impl<'a> Send for BuildBuilder<'a>

§

impl<'a> Sync for BuildBuilder<'a>

§

impl<'a> Unpin for BuildBuilder<'a>

§

impl<'a> !UnwindSafe for BuildBuilder<'a>

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,