pub struct BuildBuilder<'a> { /* private fields */ }Expand description
Builder for configuring builds in a BuildDirectory.
Implementations§
Source§impl BuildBuilder<'_>
impl BuildBuilder<'_>
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>>(
self,
f: F,
) -> Result<BuildResult<R>>
pub fn run<R, F: FnOnce(&Build<'_>) -> Result<R>>( self, f: F, ) -> Result<BuildResult<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.
Returns a BuildResult containing both the closure’s return value and build-level
statistics gathered across the sandbox lifetime.
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");
let result = build_dir.build(&toolchain, &krate, sandbox).run(|build| {
build.cargo().args(&["test", "--all"]).run()?;
Ok(())
})?;
let _peak = result.statistics().memory_peak_bytes();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> UnsafeUnpin 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