Keep annotations on fields
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
62e51b5e33
commit
dc12952e19
@@ -112,6 +112,7 @@ impl EnumVariant {
|
||||
None => i.to_string(),
|
||||
},
|
||||
ty,
|
||||
annotations: AnnotationSet::load(&field.attrs)?,
|
||||
documentation: Documentation::load(&field.attrs),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@ use std::io::Write;
|
||||
|
||||
use crate::bindgen::cdecl;
|
||||
use crate::bindgen::config::Config;
|
||||
use crate::bindgen::ir::{Documentation, Path, Type};
|
||||
use crate::bindgen::ir::{AnnotationSet, Documentation, Path, Type};
|
||||
use crate::bindgen::writer::{Source, SourceWriter};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Field {
|
||||
pub name: String,
|
||||
pub ty: Type,
|
||||
pub annotations: AnnotationSet,
|
||||
pub documentation: Documentation,
|
||||
}
|
||||
|
||||
@@ -17,6 +18,7 @@ impl Field {
|
||||
Field {
|
||||
name,
|
||||
ty,
|
||||
annotations: AnnotationSet::new(),
|
||||
documentation: Documentation::none(),
|
||||
}
|
||||
}
|
||||
@@ -31,6 +33,7 @@ impl Field {
|
||||
.ok_or_else(|| "field is missing identifier".to_string())?
|
||||
.to_string(),
|
||||
ty,
|
||||
annotations: AnnotationSet::load(&field.attrs)?,
|
||||
documentation: Documentation::load(&field.attrs),
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -88,6 +88,7 @@ impl Struct {
|
||||
out.push(Field {
|
||||
name: format!("{}", current),
|
||||
ty,
|
||||
annotations: AnnotationSet::load(&field.attrs)?,
|
||||
documentation: Documentation::load(&field.attrs),
|
||||
});
|
||||
current += 1;
|
||||
@@ -190,6 +191,7 @@ impl Struct {
|
||||
.map(|field| Field {
|
||||
name: field.name.clone(),
|
||||
ty: field.ty.specialize(mappings),
|
||||
annotations: field.annotations.clone(),
|
||||
documentation: field.documentation.clone(),
|
||||
})
|
||||
.collect(),
|
||||
|
||||
@@ -180,6 +180,7 @@ impl Item for Union {
|
||||
overriden_fields.push(Field {
|
||||
name: o[i].clone(),
|
||||
ty: field.ty.clone(),
|
||||
annotations: field.annotations.clone(),
|
||||
documentation: field.documentation.clone(),
|
||||
});
|
||||
}
|
||||
@@ -195,6 +196,7 @@ impl Item for Union {
|
||||
.apply(&field.name, IdentifierType::StructMember)
|
||||
.into_owned(),
|
||||
ty: field.ty.clone(),
|
||||
annotations: field.annotations.clone(),
|
||||
documentation: field.documentation.clone(),
|
||||
})
|
||||
.collect();
|
||||
@@ -254,6 +256,7 @@ impl Item for Union {
|
||||
.map(|field| Field {
|
||||
name: field.name.clone(),
|
||||
ty: field.ty.specialize(&mappings),
|
||||
annotations: field.annotations.clone(),
|
||||
documentation: field.documentation.clone(),
|
||||
})
|
||||
.collect(),
|
||||
|
||||
Reference in New Issue
Block a user