Struct rustwide::BuildBuilder

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

Builder for configuring builds in a BuildDirectory.

Implementations§

source§

impl<'a> BuildBuilder<'a>

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, Error>>( self, f: F ) -> Result<R, Error>

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> 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.