1 use rustc_hir::{BindingAnnotation, ByRef, Mutability}; 2 3 #[derive(Clone, PartialEq, TyEncodable, TyDecodable, Debug, Copy, HashStable)] 4 pub enum BindingMode { 5 BindByReference(Mutability), 6 BindByValue(Mutability), 7 } 8 9 TrivialTypeTraversalAndLiftImpls! { BindingMode, } 10 11 impl BindingMode { convert(BindingAnnotation(by_ref, mutbl): BindingAnnotation) -> BindingMode12 pub fn convert(BindingAnnotation(by_ref, mutbl): BindingAnnotation) -> BindingMode { 13 match by_ref { 14 ByRef::No => BindingMode::BindByValue(mutbl), 15 ByRef::Yes => BindingMode::BindByReference(mutbl), 16 } 17 } 18 } 19