Skip to main content

load_fields

Macro load_fields 

Source
macro_rules! load_fields {
    (@field $object:ident, $field:ident: $T:ty) => { ... };
    (@field $object:ident, $field:ident) => { ... };
    ($object:ident, [$($field:ident $(: $ty:ty)?),+ $(,)?]) => { ... };
}
Expand description

Extract a fixed set of named fields from an Object into local bindings.

Each name in the list becomes a let binding of the same name. An optional : T suffix selects the Loadable target type; without it, type inference picks the type from the surrounding context. Errors from individual fields are propagated with ?.

load_fields!(object, [
    dim: usize,
    label,                       // type inferred
    vectors: save::Handle,
]);