pub trait HasField<Field, T, R>where
Field: TypedString,{
// Required methods
fn get_field<'a>(&'a self) -> &'a T
where Field: 'a;
fn get_field_mut<'a>(&'a mut self) -> &'a mut T
where Field: 'a;
fn take_field(self) -> T;
}Expand description
A trait that indicate that an anonymous struct contains a certain field.
§Generic parameters
Field: Typed field name, seestringz::ident!.T: The type of data carried by the field.R: Type used to indicate the position of the field in the struct. Usually automatically inferred by Rust.
§Example
See the section “as generic type”.
Required Methods§
Sourcefn get_field<'a>(&'a self) -> &'a Twhere
Field: 'a,
fn get_field<'a>(&'a self) -> &'a Twhere
Field: 'a,
Get the immutable reference to the data carried by the field.
Sourcefn get_field_mut<'a>(&'a mut self) -> &'a mut Twhere
Field: 'a,
fn get_field_mut<'a>(&'a mut self) -> &'a mut Twhere
Field: 'a,
Get the mutable reference to the data carried by the field.
Sourcefn take_field(self) -> T
fn take_field(self) -> T
Consume the struct and take the data carried by the field.