pub enum TargetKind {
Library,
HeaderOnly,
Executable,
Test,
Example,
}Expand description
What kind of artifact a target produces.
Target kinds describe artifact role only. Source-language
classification is per-file, based on source extension: .c
compiles as C, .cc / .cpp / .cxx / .c++ / .C compile
as C++. A single target may freely mix C/C++ sources; the
planner selects the compiler per source and selects the link
driver from the direct and transitive source-language closure
(C++ if any object is C++, otherwise C).
The string representations are stable: they are written by the manifest
parser, surfaced by cabin metadata, and consumed by the build graph
planner.
Variants§
Library
Static-archive library (lib<name>.a).
HeaderOnly
A header-only library. Has no translation units of its own;
the planner emits no compile or archive actions, and consumers
pick up its include_dirs through the dependency graph.
Executable
A linked executable. Built by default by cabin build.
Test
A test executable. Built and run by cabin test. Excluded
from the default cabin build selection.
Example
An example executable. Excluded from the default
cabin build selection. Today the only way an example
reaches the build graph is as a transitive dep of another
selected target; a dedicated explicit-kind selector flag
is reserved for future work (the historic --target name
is reserved for platform/toolchain target selection).
Implementations§
Source§impl TargetKind
impl TargetKind
pub const fn as_str(self) -> &'static str
Sourcepub const fn all() -> &'static [TargetKind]
pub const fn all() -> &'static [TargetKind]
All kinds, in declaration order. Useful for error messages that list the supported types.
Sourcepub const fn produces_executable(self) -> bool
pub const fn produces_executable(self) -> bool
Whether this kind produces an executable (linked binary).
Library kinds return false.
Sourcepub const fn produces_archive(self) -> bool
pub const fn produces_archive(self) -> bool
Whether this kind produces a static-archive library (lib<name>.a).
Sourcepub const fn is_header_only(self) -> bool
pub const fn is_header_only(self) -> bool
Whether this kind is a header-only library (no compile/
archive actions; consumers pick up include_dirs).
Sourcepub const fn is_default_buildable(self) -> bool
pub const fn is_default_buildable(self) -> bool
Whether ordinary cabin build selects this kind by default.
Dev-only kinds (test / example) are excluded
from the default set: tests are built by cabin test,
and examples only reach the build graph as a
transitive dep of another selected target.
Header-only libraries are included so the dependency closure walk reaches them; the planner emits no compile or archive actions for them, so saying “yes, this is part of the default selection” is a no-op on Ninja’s side.
Sourcepub const fn is_dev_only(self) -> bool
pub const fn is_dev_only(self) -> bool
Whether this kind is a development-only target — a target
that exists to support workspace development but is not part
of the package’s public surface. Production callers use this
to decide whether dev-dependencies should be activated and
whether the target may be run by cabin test.
Trait Implementations§
Source§impl Clone for TargetKind
impl Clone for TargetKind
Source§fn clone(&self) -> TargetKind
fn clone(&self) -> TargetKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TargetKind
impl Debug for TargetKind
Source§impl<'de> Deserialize<'de> for TargetKind
impl<'de> Deserialize<'de> for TargetKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TargetKind
impl Display for TargetKind
Source§impl Hash for TargetKind
impl Hash for TargetKind
Source§impl PartialEq for TargetKind
impl PartialEq for TargetKind
Source§fn eq(&self, other: &TargetKind) -> bool
fn eq(&self, other: &TargetKind) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TargetKind
impl Serialize for TargetKind
impl Copy for TargetKind
impl Eq for TargetKind
impl StructuralPartialEq for TargetKind
Auto Trait Implementations§
impl Freeze for TargetKind
impl RefUnwindSafe for TargetKind
impl Send for TargetKind
impl Sync for TargetKind
impl Unpin for TargetKind
impl UnsafeUnpin for TargetKind
impl UnwindSafe for TargetKind
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§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.