field_access

Macro field_access 

Source
macro_rules! field_access {
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: $field_ty:ty $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: as_ref { $get_ty:ty, $set_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: cow { $cow_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option { $field_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option_deref { $get_ty:ty, $set_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option_ref { $get_ty:ty, $set_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option_ref { $field_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option_cow_ref { $cow_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option_cow_ref { $cow_ty:ty, $own_ty:ty } $(,)?
        )+
    }) => { ... };
    ($ty:ident {
        $(
            $(#[$field_doc:meta])*
            $field:ident: option_cow_deref { $cow_ty:ty, $own_ty:ty } $(,)?
        )+
    }) => { ... };
}
Expand description

Helper to define field access functions for types.

Helps to cut down boilerplate, especially for types with many fields.