Skip to main content

TargetKind

Enum TargetKind 

Source
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. The only way an example reaches the build graph is as a transitive dep of another selected target.

Implementations§

Source§

impl TargetKind

Source

pub const fn as_str(self) -> &'static str

Source

pub const fn all() -> &'static [TargetKind]

All kinds, in declaration order. Useful for error messages that list the supported types.

Source

pub const fn produces_executable(self) -> bool

Whether this kind produces an executable (linked binary). Library kinds return false.

Source

pub const fn produces_archive(self) -> bool

Whether this kind produces a static-archive library (lib<name>.a).

Source

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).

Source

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.

Source

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.

Source

pub const fn is_test(self) -> bool

Whether cabin test runs this kind after building it. Today only test runs; example is build-only.

Trait Implementations§

Source§

impl Clone for TargetKind

Source§

fn clone(&self) -> TargetKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TargetKind

Source§

impl Debug for TargetKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TargetKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TargetKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TargetKind

Source§

impl Hash for TargetKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TargetKind

Source§

fn eq(&self, other: &TargetKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TargetKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TargetKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.