macros: add more documentation comments
Documentation comments are always good. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
2647a4812c
commit
e8ee0d7a20
3 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue