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>
impl<'a> BuildBuilder<'a>
sourcepub fn patch_with_git(self, name: &str, uri: &str, branch: &str) -> Self
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(())
})?;
sourcepub fn patch_with_path(self, name: &str, path: &str) -> Self
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(())
})?;
sourcepub fn run<R, F: FnOnce(&Build<'_>) -> Result<R, Error>>(
self,
f: F
) -> Result<R, Error>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more