blob: 7ab192daf4b1d4ab2366c274191d608288a87640 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  | 
use rustc_hir::BindingAnnotation;
use rustc_hir::BindingAnnotation::*;
use rustc_hir::Mutability;
#[derive(Clone, PartialEq, TyEncodable, TyDecodable, Debug, Copy, HashStable)]
pub enum BindingMode {
    BindByReference(Mutability),
    BindByValue(Mutability),
}
TrivialTypeFoldableAndLiftImpls! { BindingMode, }
impl BindingMode {
    pub fn convert(ba: BindingAnnotation) -> BindingMode {
        match ba {
            Unannotated => BindingMode::BindByValue(Mutability::Not),
            Mutable => BindingMode::BindByValue(Mutability::Mut),
            Ref => BindingMode::BindByReference(Mutability::Not),
            RefMut => BindingMode::BindByReference(Mutability::Mut),
        }
    }
}
 
  |