Expand description
In-place constructors.
This module provides a range of helpers such as new::by()
and
new::from()
for creating constructors. It is preferred style to
use moveit::new;
and refer to these helpers with a new::
prefix.
Traits§
- CopyNew
- A copy constructible type: a destination-aware
Clone
. - Emplace
- A pointer type that may be “emplaced” as a stable address which a
New
may be used to construct a value with. - MoveNew
- A move constructible type: a destination-aware
Clone
that destroys the moved-from value. - New
- An in-place constructor for a particular type.
- Swap
- A swappable type, which is able to efficiently swap the contents of two of its values.
- TryNew
- An in-place constructor for a particular type, which can potentially fail.
Functions§
- by
- Returns a
New
that uses the provided closure for constructing aT
. - by_raw⚠
- Returns a
New
that uses the provided closure for construction. - copy
- Returns a new
New
that uses a copy constructor. - default
- Returns a
New
callsDefault
to generate aT
. - from
- Returns a
New
that uses aFrom
implementation to generate aT
. - mov
- Returns a
New
that forwards toMoveNew
. - of
- Returns a
New
that simply returns the given value. - try_by
- Returns a
TryNew
that uses the provided closure for constructing aT
. - try_
by_ ⚠raw - Returns a
TryNew
that uses the provided closure for construction. - try_
from - Returns a
TryNew
that uses aTryFrom
implementation to generate aT
.