Enum rustc_hir::hir::BindingAnnotation
source · [−]pub enum BindingAnnotation {
Unannotated,
Mutable,
Ref,
RefMut,
}Expand description
Explicit binding annotations given in the HIR for a binding. Note that this is not the final binding mode that we infer after type inference.
Variants
Unannotated
No binding annotation given: this means that the final binding mode
will depend on whether we have skipped through a & reference
when matching. For example, the x in Some(x) will have binding
mode None; if you do let Some(x) = &Some(22), it will
ultimately be inferred to be by-reference.
Note that implicit reference skipping is not implemented yet (#42640).
Mutable
Annotated with mut x – could be either ref or not, similar to None.
Ref
Annotated as ref, like ref x
RefMut
Annotated as ref mut x.
Trait Implementations
sourceimpl Clone for BindingAnnotation
impl Clone for BindingAnnotation
sourcefn clone(&self) -> BindingAnnotation
fn clone(&self) -> BindingAnnotation
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for BindingAnnotation
impl Debug for BindingAnnotation
sourceimpl<__E: Encoder> Encodable<__E> for BindingAnnotation
impl<__E: Encoder> Encodable<__E> for BindingAnnotation
sourceimpl<__CTX> HashStable<__CTX> for BindingAnnotation where
__CTX: HashStableContext,
impl<__CTX> HashStable<__CTX> for BindingAnnotation where
__CTX: HashStableContext,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
impl Copy for BindingAnnotation
impl StructuralPartialEq for BindingAnnotation
Auto Trait Implementations
impl RefUnwindSafe for BindingAnnotation
impl Send for BindingAnnotation
impl Sync for BindingAnnotation
impl Unpin for BindingAnnotation
impl UnwindSafe for BindingAnnotation
Blanket Implementations
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
fn allocate_on(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Unannotated: 0 bytesMutable: 0 bytesRef: 0 bytesRefMut: 0 bytes