Module v1
The first version of the core prelude.
See the module-level documentation for more.
Enums
-
Option
The
Optiontype. See the module level documentation for more. -
Result
Resultis a type that represents either success (Ok) or failure (Err).
Traits
- AsMut Used to do a cheap mutable-to-mutable reference conversion.
- AsRef Used to do a cheap reference-to-reference conversion.
-
AsyncFn
An async-aware version of the
Fntrait. -
AsyncFnMut
An async-aware version of the
FnMuttrait. -
AsyncFnOnce
An async-aware version of the
FnOncetrait. - Clone A common trait that allows explicit creation of a duplicate value.
- Copy Types whose values can be duplicated simply by copying bits.
- Default A trait for giving a type a useful default value.
- DoubleEndedIterator An iterator able to yield elements from both ends.
- Drop Custom code within the destructor.
- Eq Trait for comparisons corresponding to equivalence relations.
- ExactSizeIterator An iterator that knows its exact length.
- Extend Extend a collection with the contents of an iterator.
- Fn The version of the call operator that takes an immutable receiver.
- FnMut The version of the call operator that takes a mutable receiver.
- FnOnce The version of the call operator that takes a by-value receiver.
-
From
Used to do value-to-value conversions while consuming the input value. It is the reciprocal of
Into. -
Into
A value-to-value conversion that consumes the input value. The
opposite of
From. -
IntoIterator
Conversion into an
Iterator. - Iterator A trait for dealing with iterators.
- Ord Trait for types that form a total order.
- PartialEq Trait for comparisons using the equality operator.
- PartialOrd Trait for types that form a partial order.
- Send Types that can be transferred across thread boundaries.
- Sized Types with a constant size known at compile time.
- Sync Types for which it is safe to share references between threads.
- Unpin Types that do not require any pinning guarantees.
Functions
- align_of Returns the [ABI]-required minimum alignment of a type in bytes.
-
align_of_val
Returns the [ABI]-required minimum alignment of the type of the value that
valpoints to in bytes. - drop Disposes of a value.
- size_of Returns the size of a type in bytes.
- size_of_val Returns the size of the pointed-to value in bytes.
Macros
-
Clone
Derive macro generating an impl of the trait
Clone. -
Copy
Derive macro generating an impl of the trait
Copy. -
Debug
Derive macro generating an impl of the trait
Debug. -
Default
Derive macro generating an impl of the trait
Default. -
Eq
Derive macro generating an impl of the trait
Eq. -
Hash
Derive macro generating an impl of the trait
Hash. -
Ord
Derive macro generating an impl of the trait
Ord. The behavior of this macro is described in detail here. -
PartialEq
Derive macro generating an impl of the trait
PartialEq. The behavior of this macro is described in detail here. -
PartialOrd
Derive macro generating an impl of the trait
PartialOrd. The behavior of this macro is described in detail here. - alloc_error_handler Attribute macro applied to a function to register it as a handler for allocation failure.
-
assert
Asserts that a boolean expression is
trueat runtime. -
assert_eq
Asserts that two expressions are equal to each other (using
PartialEq). -
assert_ne
Asserts that two expressions are not equal to each other (using
PartialEq). - bench Attribute macro applied to a function to turn it into a benchmark test.
- cfg Evaluates boolean combinations of configuration flags at compile-time.
- cfg_accessible Keeps the item it's applied to if the passed path is accessible, and removes it otherwise.
-
cfg_eval
Expands all
#[cfg]and#[cfg_attr]attributes in the code fragment it's applied to. -
cfg_select
Selects code at compile-time based on
cfgpredicates. - column Expands to the column number at which it was invoked.
- compile_error Causes compilation to fail with the given error message when encountered.
- concat Concatenates literals into a static string slice.
- concat_bytes Concatenates literals into a byte slice.
-
const_format_args
Same as
format_args, but can be used in some const contexts. -
debug_assert
Asserts that a boolean expression is
trueat runtime. - debug_assert_eq Asserts that two expressions are equal to each other.
- debug_assert_ne Asserts that two expressions are not equal to each other.
- define_opaque Provide a list of type aliases and other opaque-type-containing type definitions to an item with a body. This list will be used in that body to define opaque types' hidden types. Can only be applied to things that have bodies.
- deref Unstable placeholder for deref patterns.
- derive Attribute macro used to apply derive macros.
- derive_const Attribute macro used to apply derive macros for implementing traits in a const context.
- eii Externally Implementable Item: Defines an attribute macro that can override the item this is applied to.
- eii_declaration Impl detail of EII
- env Inspects an environment variable at compile time.
- file Expands to the file name in which it was invoked.
- format_args Constructs parameters for the other string-formatting macros.
- global_allocator Attribute macro applied to a static to register it as a global allocator.
- include Parses a file as an expression or an item according to the context.
- include_bytes Includes a file as a reference to a byte array.
- include_str Includes a UTF-8 encoded file as a string.
- line Expands to the line number on which it was invoked.
- log_syntax Prints passed tokens into the standard output.
- matches Returns whether the given expression matches the provided pattern.
- module_path Expands to a string that represents the current module path.
- option_env Optionally inspects an environment variable at compile time.
- panic Panics the current thread.
-
pattern_type
Creates a pattern type.
type Positive = std::pat::pattern_type!(i32 is 1..); - stringify Stringifies its arguments.
- test Attribute macro applied to a function to turn it into a unit test.
-
test_case
An implementation detail of the
#[test]and#[bench]macros. - todo Indicates unfinished code.
- trace_macros Enables or disables tracing functionality used for debugging other macros.
- try Unwraps a result or propagates its error.
- type_ascribe Unstable placeholder for type ascription.
- unimplemented Indicates unimplemented code by panicking with a message of "not implemented".
- unreachable Indicates unreachable code.
- unsafe_eii Unsafely Externally Implementable Item: Defines an unsafe attribute macro that can override the item this is applied to.
- write Writes formatted data into a buffer.
- writeln Writes formatted data into a buffer, with a newline appended.