Trait syn_helpers::Field
source · pub trait Field: HasAttributes {
// Required methods
fn get_type(&self) -> &Type;
fn get_pattern_with_config(
&self,
type_of_self: TypeOfSelf,
name_postfix: &'static str
) -> TokenStream;
fn get_type_that_needs_constraint(&self) -> Option<Type>;
// Provided method
fn get_pattern(&self, type_of_self: TypeOfSelf) -> TokenStream { ... }
}
Expand description
A Field is declaration of some data under a object
Required Methods§
fn get_type(&self) -> &Type
sourcefn get_pattern_with_config(
&self,
type_of_self: TypeOfSelf,
name_postfix: &'static str
) -> TokenStream
fn get_pattern_with_config( &self, type_of_self: TypeOfSelf, name_postfix: &'static str ) -> TokenStream
Get pattern with configuration for the ownership (with TypeOfSelf and whether to prefix the identifier)
sourcefn get_type_that_needs_constraint(&self) -> Option<Type>
fn get_type_that_needs_constraint(&self) -> Option<Type>
Returns the fields type if it used for the trait (only used internally)
Provided Methods§
sourcefn get_pattern(&self, type_of_self: TypeOfSelf) -> TokenStream
fn get_pattern(&self, type_of_self: TypeOfSelf) -> TokenStream
Get a pattern for reading this field