Expand description
Operator traits (Deref, DerefMut, Index, Add, …).
Structs§
- Range
- A (half-open) range bounded inclusively below and exclusively above
(
start..end). - Range
From - A range only bounded inclusively below (
start..). - Range
Full - An unbounded range (
..). - Range
Inclusive - A range bounded inclusively below and above (
start..=end). - RangeTo
- A range only bounded exclusively above (
..end). - Range
ToInclusive - A range only bounded inclusively above (
..=end). - Yeet
Experimental - Implement
FromResidual<Yeet<T>>on your type to enabledo yeet exprsyntax in functions returning your type.
Enums§
- Bound
- An endpoint of a range of keys.
- Control
Flow - Used to tell an operation whether it should exit early or go on as usual.
- Coroutine
State Experimental - The result of a coroutine resumption.
- OneSided
Range Bound Experimental - An internal helper for
split_offfunctions indicating which end aOneSidedRangeis bounded on.
Traits§
- Add
- The addition operator
+. - AddAssign
- The addition assignment operator
+=. - AsyncFn
- An async-aware version of the
Fntrait. - Async
FnMut - An async-aware version of the
FnMuttrait. - Async
FnOnce - An async-aware version of the
FnOncetrait. - BitAnd
- The bitwise AND operator
&. - BitAnd
Assign - The bitwise AND assignment operator
&=. - BitOr
- The bitwise OR operator
|. - BitOr
Assign - The bitwise OR assignment operator
|=. - BitXor
- The bitwise XOR operator
^. - BitXor
Assign - The bitwise XOR assignment operator
^=. - Deref
- Used for immutable dereferencing operations, like
*v. - Deref
Mut - Used for mutable dereferencing operations, like in
*v = 1;. - Div
- The division operator
/. - DivAssign
- The division assignment operator
/=. - Drop
- Custom code within the destructor.
- 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.
- Index
- Used for indexing operations (
container[index]) in immutable contexts. - Index
Mut - Used for indexing operations (
container[index]) in mutable contexts. - Mul
- The multiplication operator
*. - MulAssign
- The multiplication assignment operator
*=. - Neg
- The unary negation operator
-. - Not
- The unary logical negation operator
!. - Range
Bounds RangeBoundsis implemented by Rust’s built-in range types, produced by range syntax like..,a..,..b,..=c,d..e, orf..=g.- Rem
- The remainder operator
%. - RemAssign
- The remainder assignment operator
%=. - Shl
- The left shift operator
<<. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ << _, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha << banda.shl(b)are one and the same from an evaluation standpoint, they are different when it comes to type inference. - ShlAssign
- The left shift assignment operator
<<=. - Shr
- The right shift operator
>>. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ >> _, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha >> banda.shr(b)are one and the same from an evaluation standpoint, they are different when it comes to type inference. - ShrAssign
- The right shift assignment operator
>>=. - Sub
- The subtraction operator
-. - SubAssign
- The subtraction assignment operator
-=. - Coerce
Unsized Experimental - Trait that indicates that this is a pointer or a wrapper for one, where unsizing can be performed on the pointee.
- Coroutine
Experimental - The trait implemented by builtin coroutine types.
- Deref
Pure Experimental - Perma-unstable marker trait. Indicates that the type has a well-behaved
Deref(and, if applicable,DerefMut) implementation. This is relied on for soundness of deref patterns. - Dispatch
From Dyn Experimental DispatchFromDynis used in the implementation of dyn-compatibility checks (specifically allowing arbitrary self types), to guarantee that a method’s receiver type can be dispatched on.- From
Residual Experimental - Used to specify which residuals can be converted into which
crate::ops::Trytypes. - Into
Bounds Experimental - Used to convert a range into start and end bounds, consuming the range by value.
- OneSided
Range Experimental OneSidedRangeis implemented for built-in range types that are unbounded on one side. For example,a..,..band..=cimplementOneSidedRange, but..,d..e, andf..=gdo not.- Receiver
Experimental - Indicates that a struct can be used as a method receiver.
That is, a type can use this type as a type of
self, like this: - Residual
Experimental - Allows retrieving the canonical type implementing
Trythat has this type as its residual and allows it to hold anOas its output. - Try
Experimental - The
?operator andtry {}blocks.