1
Fork 0

macros: add more documentation comments

Documentation comments are always good.

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-04-27 05:24:31 +01:00
parent 2647a4812c
commit e8ee0d7a20
3 changed files with 13 additions and 1 deletions

View file

@ -102,6 +102,8 @@ pub(crate) struct FieldInfo<'a> {
pub(crate) span: &'a proc_macro2::Span,
}
/// Small helper trait for abstracting over `Option` fields that contain a value and a `Span`
/// for error reporting if they are set more than once.
pub(crate) trait SetOnce<T> {
fn set_once(&mut self, value: T);
}
@ -122,6 +124,7 @@ impl<T> SetOnce<(T, Span)> for Option<(T, Span)> {
}
pub(crate) trait HasFieldMap {
/// Returns the binding for the field with the given name, if it exists on the type.
fn get_field_binding(&self, field: &String) -> Option<&TokenStream>;
/// In the strings in the attributes supplied to this macro, we want callers to be able to