Module prelude

Source
Expand description

Prelude exporting types from the Rust standard library (std)

Re-exports§

pub extern crate alloc as alloc_crate;
pub extern crate core;
pub extern crate std;
pub use crate::slice;
pub use std::option::Option::Some;
pub use std::option::Option::None;
pub use std::result::Result::Ok;
pub use std::result::Result::Err;

Modules§

alloc_mod
Memory allocation APIs.
array
Utilities for the array primitive type.
atomic
Atomic types
cell
Shareable mutable containers.
clone
The Clone trait for types that cannot be ‘implicitly copied’.
cmp
Utilities for comparing and ordering values.
env
Inspection and manipulation of the process’s environment.
fmt
Utilities for formatting and printing Strings.
fs
Filesystem manipulation operations.
future
Asynchronous basic functionality.
hash
Generic hashing support.
hint
Hints to compiler that affects how code should be emitted or optimized.
iter
Composable external iteration.
marker
Primitive traits and types representing basic properties of types.
mem
Basic functions for dealing with memory.
num
Additional functionality for numerics.
ops
Overloadable operators.
option
Optional values.
panic
Panic support in the standard library.
path
Cross-platform path manipulation.
ptr
Manually manage memory through raw pointers.
result
Error handling with the Result type.
str
Utilities for the str primitive type.
string
A UTF-8–encoded, growable string.
vec
A contiguous growable array type with heap-allocated contents, written Vec<T>.

Macros§

assert
Asserts that a boolean expression is true at 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).
cfg
Evaluates boolean combinations of configuration flags at compile-time.
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.
dbg
Prints and returns the value of a given expression for quick and dirty debugging.
debug_assert
Asserts that a boolean expression is true at 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.
env
Inspects an environment variable at compile time.
eprint
Prints to the standard error.
eprintln
Prints to the standard error, with a newline.
file
Expands to the file name in which it was invoked.
format
Creates a String using interpolation of runtime expressions.
format_args
Constructs parameters for the other string-formatting macros.
line
Expands to the line number on which it was invoked.
panic
Panics the current thread.
print
Prints to the standard output.
println
Prints to the standard output, with a newline.
stringify
Stringifies its arguments.
thread_local
Declare a new thread local storage key of type std::thread::LocalKey.
todo
Indicates unfinished code.
unreachable
Indicates unreachable code.
vec
Creates a Vec containing the arguments.

Structs§

Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
ArcWeak
Weak is a version of Arc that holds a non-owning reference to the managed allocation.
AtomicBool
A boolean type which can be safely shared between threads.
AtomicI8
An integer type which can be safely shared between threads.
AtomicI16
An integer type which can be safely shared between threads.
AtomicI32
An integer type which can be safely shared between threads.
AtomicI64
An integer type which can be safely shared between threads.
AtomicIsize
An integer type which can be safely shared between threads.
AtomicPtr
A raw pointer type which can be safely shared between threads.
AtomicU8
An integer type which can be safely shared between threads.
AtomicU16
An integer type which can be safely shared between threads.
AtomicU32
An integer type which can be safely shared between threads.
AtomicU64
An integer type which can be safely shared between threads.
AtomicUsize
An integer type which can be safely shared between threads.
Box
A pointer type that uniquely owns a heap allocation of type T.
File
An object providing access to an open file on the filesystem.
ManuallyDrop
A wrapper to inhibit the compiler from automatically calling T’s destructor. This wrapper is 0-cost.
NonZero
A value that is known not to equal zero.
Path
A slice of a path (akin to str).
PathBuf
An owned, mutable path (akin to String).
PhantomData
Zero-sized type used to mark things that “act like” they own a T.
PhantomPinned
A marker type which does not implement Unpin.
Rc
A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’.
RcWeak
Weak is a version of Rc that holds a non-owning reference to the managed allocation.
Saturating
Provides intentionally-saturating arithmetic on T.
String
A UTF-8–encoded, growable string.
TypeId
A TypeId represents a globally unique identifier for a type.
UnsafeCell
The core primitive for interior mutability in Rust.
Vec
A contiguous growable array type, written as Vec<T>, short for ‘vector’.
Wrapping
Provides intentionally-wrapped arithmetic on T.

Enums§

Cow
A clone-on-write smart pointer.
Infallible
The error type for errors that can never happen.
Option
The Option type. See the module level documentation for more.
Result
Result is a type that represents either success (Ok) or failure (Err).

Traits§

Any
A trait to emulate dynamic typing.
AsMut
Used to do a cheap mutable-to-mutable reference conversion.
AsRef
Used to do a cheap reference-to-reference conversion.
Borrow
A trait for borrowing data.
BorrowMut
A trait for mutably borrowing data.
Clone
A common trait for the ability to explicitly duplicate an object.
Copy
Types whose values can be duplicated simply by copying bits.
Debug
? formatting.
Default
A trait for giving a type a useful default value.
Deref
Used for immutable dereferencing operations, like *v.
DerefMut
Used for mutable dereferencing operations, like in *v = 1;.
Display
Format trait for an empty format, {}.
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.
FromIterator
Conversion from an Iterator.
Future
A future represents an asynchronous computation obtained by use of async.
Hash
A hashable type.
Hasher
A trait for hashing an arbitrary stream of bytes.
Into
A value-to-value conversion that consumes the input value. The opposite of From.
IntoFuture
Conversion into a Future.
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.
RefUnwindSafe
A marker trait representing types where a shared reference is considered unwind safe.
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.
ToOwned
A generalization of Clone to borrowed data.
ToString
A trait for converting a value to a String.
TryFrom
Simple and safe type conversions that may fail in a controlled way under some circumstances. It is the reciprocal of TryInto.
TryInto
An attempted conversion that consumes self, which may or may not be expensive.
Unpin
Types that do not require any pinning guarantees.
UnwindSafe
A marker trait which represents “panic safe” types in Rust.

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 val points to in bytes.
alloc
Allocates memory with the global allocator.
alloc_zeroed
Allocates zero-initialized memory with the global allocator.
compiler_fence
A “compiler-only” atomic fence.
dealloc
Deallocates memory with the global allocator.
drop
Disposes of a value.
fence
An atomic fence.
forget
Takes ownership and “forgets” about the value without running its destructor.
identity
The identity function.
needs_drop
Returns true if dropping values of type T matters.
realloc
Reallocates memory with the global allocator.
replace
Moves src into the referenced dest, returning the previous dest value.
size_of
Returns the size of a type in bytes.
size_of_val
Returns the size of the pointed-to value in bytes.
swap
Swaps the values at two mutable locations, without deinitializing either one.
take
Replaces dest with the default value of T, returning the previous dest value.
transmuteDeprecated
Reinterprets the bits of a value of one type as another type.
transmute_copy
Interprets src as having type &Dst, and then reads src without moving the contained value.
type_name
Returns the name of a type as a string slice.
type_name_of_val
Returns the type name of the pointed-to value as a string slice.
zeroed
Returns the value of type T represented by the all-zero byte-pattern.

Unions§

MaybeUninit
A wrapper type to construct uninitialized instances of T.

Derive 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.