#[non_exhaustive]pub struct Target {
pub package_id: PackageId,
pub package: String,
pub name: String,
pub kind: TargetKind,
pub crate_path: String,
pub root: RelPath,
pub shipping: bool,
pub harness: bool,
pub required_features: Vec<String>,
pub test: bool,
pub doctest: bool,
}Expand description
One target of a package.
The test settings (harness, required_features, test and doctest)
are read from the target table, [lib] or [[bin]] and the others, and
take cargo’s default when the table leaves them out or the target has no
table. The build script has no table and is never tested: its harness,
test and doctest are false and it requires no feature.
The struct is #[non_exhaustive]: adding a field is not a breaking change,
so a pattern names the fields it reads and ends in ...
let raf_source::Target {
package, name, kind, crate_path, root, shipping,
harness, required_features, test, doctest,
} = target;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.package_id: PackageIdThe package’s identity within the loaded workspace.
package: StringThe package name.
name: StringThe Cargo name of the target.
kind: TargetKindWhat the target is.
crate_path: StringThe path items of this target are indexed under: the crate name for the
library ([lib] name, or the package name, with - as _),
<pkg>::bin_crate::<bin> for a binary,
<pkg>::{test,bench,example}_crate::<target> for the others and
<pkg>::build_script for the build script.
root: RelPathThe root source file.
shipping: boolTrue for the library, the binaries and the build script.
harness: boolharness: true when cargo test builds the target with the libtest
harness, which is cargo’s default for every target table.
required_features: Vec<String>required-features: the features the target needs before cargo builds
it, in manifest order; empty by default.
test: booltest: true when cargo test tests the target by default. Cargo’s
default is true for the library, the binaries and the tests and false
for benches and examples.
doctest: booldoctest: true when cargo test runs the documentation tests of the
target. Cargo’s default is true for the library and false for every
other target. The value is reported as the manifest writes it; cargo
honours the key only for the library.
Trait Implementations§
impl Eq for Target
impl StructuralPartialEq for Target
Auto Trait Implementations§
impl Forget for Target
impl Freeze for Target
impl Move for Target
impl RefUnwindSafe for Target
impl Send for Target
impl Sync for Target
impl Unpin for Target
impl UnsafeUnpin for Target
impl UnwindSafe for Target
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> EvidenceLease for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more