Primitive Type unit
Expand description
The ()
type, also called “unit”.
The ()
type has exactly one value ()
, and is used when there
is no other meaningful value that could be returned. ()
is most
commonly seen implicitly: functions without a -> ...
implicitly
have return type ()
, that is, these are equivalent:
The semicolon ;
can be used to discard the result of an
expression at the end of a block, making the expression (and thus
the block) evaluate to ()
. For example,
Trait Implementations§
1.28.0 · Source§impl Extend<()> for ()
Available on non-crate feature ferrocene_certified
only.
impl Extend<()> for ()
Available on non-crate feature
ferrocene_certified
only.1.23.0 · Source§impl FromIterator<()> for ()
Available on non-crate feature ferrocene_certified
only.Collapses all unit items from an iterator into one.
impl FromIterator<()> for ()
Available on non-crate feature
ferrocene_certified
only.Collapses all unit items from an iterator into one.
This is more useful when combined with higher-level abstractions, like
collecting to a Result<(), E>
where you only care about errors:
1.0.0 (const: unstable) · Source§impl Ord for ()
Available on non-crate feature ferrocene_certified
only.
impl Ord for ()
Available on non-crate feature
ferrocene_certified
only.1.0.0 (const: unstable) · Source§impl PartialEq for ()
Available on non-crate feature ferrocene_certified
only.
impl PartialEq for ()
Available on non-crate feature
ferrocene_certified
only.1.0.0 (const: unstable) · Source§impl PartialOrd for ()
Available on non-crate feature ferrocene_certified
only.
impl PartialOrd for ()
Available on non-crate feature
ferrocene_certified
only.impl ConstParamTy_ for ()
impl Eq for ()
impl StructuralPartialEq for ()
Auto Trait Implementations§
impl Freeze for ()
impl RefUnwindSafe for ()
impl Send for ()
impl Sync for ()
impl Unpin for ()
impl UnwindSafe for ()
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
Available on non-crate feature
ferrocene_certified
only.Mutably borrows from an owned value. Read more