Skip to main content

UnitFor

Struct UnitFor 

Source
pub struct UnitFor { /* private fields */ }
Expand description

Flags used in creating Units to indicate the purpose for the target, and to ensure the target’s dependencies have the correct settings.

Implementations§

Source§

impl UnitFor

Source

pub fn new_normal() -> UnitFor

A unit for a normal target/dependency (i.e., not custom build, proc macro/plugin, or test/bench).

Source

pub fn new_host(host_features: bool) -> UnitFor

A unit for a custom build script or proc-macro or its dependencies.

The host_features parameter is whether or not this is for a build dependency or proc-macro (something that requires being built “on the host”). Build scripts for non-host units should use false because they want to use the features of the package they are running for.

Source

pub fn new_compiler() -> UnitFor

A unit for a compiler plugin or their dependencies.

Source

pub fn new_test(config: &Config) -> UnitFor

A unit for a test/bench target or their dependencies.

Note that config is taken here for unstable CLI features to detect whether panic=abort is supported for tests. Historical versions of rustc did not support this, but newer versions do with an unstable compiler flag.

Source

pub fn with_for_host(self, for_host: bool) -> UnitFor

Returns a new copy based on for_host setting.

When for_host is true, this clears panic_abort_ok in a sticky fashion so that all its dependencies also have panic_abort_ok=false. This’ll help ensure that once we start compiling for the host platform (build scripts, plugins, proc macros, etc) we’ll share the same build graph where everything is panic=unwind.

Source

pub fn with_host_features(self, host_features: bool) -> UnitFor

Returns a new copy updating it whether or not it should use features for build dependencies and proc-macros.

This is part of the machinery responsible for handling feature decoupling for build dependencies in the new feature resolver.

Source

pub fn is_for_host(&self) -> bool

Returns true if this unit is for a build script or any of its dependencies, or a proc macro or any of its dependencies.

Source

pub fn is_for_host_features(&self) -> bool

Source

pub fn all_values() -> &'static [UnitFor]

All possible values, used by clean.

Trait Implementations§

Source§

impl Clone for UnitFor

Source§

fn clone(&self) -> UnitFor

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for UnitFor

Source§

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

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

impl Hash for UnitFor

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 Ord for UnitFor

Source§

fn cmp(&self, other: &UnitFor) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for UnitFor

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 PartialOrd for UnitFor

Source§

fn partial_cmp(&self, other: &UnitFor) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for UnitFor

Source§

impl Eq for UnitFor

Source§

impl StructuralPartialEq for UnitFor

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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.