windows-bindgen 0.101.0

Code generator for Windows metadata
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

pub trait FieldExt {
    fn field_type(&self, enclosing: Option<&CppStruct>, reader: &Reader) -> Type;
}

impl FieldExt for Field {
    fn field_type(&self, enclosing: Option<&CppStruct>, reader: &Reader) -> Type {
        let ty = Type::from_metadata_type(&self.ty(), enclosing, &[], reader);

        // Legacy Win32 metadata spells field pointee constness with `ConstAttribute`.
        if reader.legacy() && self.has_attribute("ConstAttribute") {
            ty.to_const_type().to_const_ptr()
        } else {
            ty
        }
    }
}