pub struct Unit {
inner: Rc<UnitInner>,
}
Expand description
All information needed to define a unit.
A unit is an object that has enough information so that cargo knows how to build it.
For example, if your package has dependencies, then every dependency will be built as a library
unit. If your package is a library, then it will be built as a library unit as well, or if it
is a binary with main.rs
, then a binary will be output. There are also separate unit types
for test
ing and check
ing, amongst others.
The unit also holds information about all possible metadata about the package in pkg
.
A unit needs to know extra information in addition to the type and root source file. For example, it needs to know the target architecture (OS, chip arch etc.) and it needs to know whether you want a debug or release build. There is enough information in this struct to figure all that out.
Fields§
§inner: Rc<UnitInner>
Implementations§
Methods from Deref<Target = UnitInner>§
sourcepub fn requires_upstream_objects(&self) -> bool
pub fn requires_upstream_objects(&self) -> bool
Returns whether compilation of this unit requires all upstream artifacts to be available.
This effectively means that this unit is a synchronization point (if the
return value is true
) that all previously pipelined units need to
finish in their entirety before this one is started.
sourcepub fn is_local(&self) -> bool
pub fn is_local(&self) -> bool
Returns whether or not this is a “local” package.
A “local” package is one that the user can likely edit, or otherwise wants warnings, etc.
sourcepub fn show_warnings(&self, config: &Config) -> bool
pub fn show_warnings(&self, config: &Config) -> bool
Returns whether or not warnings should be displayed for this unit.
Trait Implementations§
source§impl Ord for Unit
impl Ord for Unit
source§impl PartialEq<Unit> for Unit
impl PartialEq<Unit> for Unit
source§impl PartialOrd<Unit> for Unit
impl PartialOrd<Unit> for Unit
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Unit
Auto Trait Implementations§
impl RefUnwindSafe for Unit
impl !Send for Unit
impl !Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes