pub struct TestBinary<'a> { /* private fields */ }
Expand description
Builder constructor for a test binary.
Start with TestBinary::relative_to_parent(name, manifest)
where
name
is the name of the binary in the child project’s manifestmanifest
is the path to the manifest file for the test binary, relative to the directory that the containing project is in. It should probably end inCargo.toml
.
Note that you can pass a path in a cross-platform way by using
PathBuf::from_iter()
:
TestBinary::relative_to_parent(
"does-build",
&PathBuf::from_iter(["testbins", "does-build", "Cargo.toml"]),
);
Implementations§
Source§impl<'a> TestBinary<'a>
impl<'a> TestBinary<'a>
Sourcepub fn relative_to_parent(name: &'a str, manifest: &'a Path) -> Self
pub fn relative_to_parent(name: &'a str, manifest: &'a Path) -> Self
Creates a new TestBinary
by specifying the child binary’s manifest
relative to the parent.
Sourcepub fn with_profile(&mut self, profile: &'a str) -> &mut Self
pub fn with_profile(&mut self, profile: &'a str) -> &mut Self
Specifies a profile to build the test binary with.
Sourcepub fn no_default_features(&mut self) -> &mut Self
pub fn no_default_features(&mut self) -> &mut Self
Specifies not to enable default features.
Sourcepub fn with_feature(&mut self, feature: &'a str) -> &mut Self
pub fn with_feature(&mut self, feature: &'a str) -> &mut Self
Specifies a feature to enable for the test binary. These are additive, so if you call this multiple times all the features you specify will be enabled.
Sourcepub fn build(&mut self) -> Result<OsString, TestBinaryError>
pub fn build(&mut self) -> Result<OsString, TestBinaryError>
Builds the binary crate we’ve prepared. This goes through Cargo, so it
should function identically to cargo build --bin testbin
along with
any additional flags from the builder methods.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TestBinary<'a>
impl<'a> RefUnwindSafe for TestBinary<'a>
impl<'a> Send for TestBinary<'a>
impl<'a> Sync for TestBinary<'a>
impl<'a> Unpin for TestBinary<'a>
impl<'a> UnwindSafe for TestBinary<'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