pub struct Field {
ident: Ident,
ty: Type,
is_a_byte_buf: bool,
third_party_type: Option<ThirdPartyType>,
}
Fields§
§ident: Ident
§ty: Type
§is_a_byte_buf: bool
§third_party_type: Option<ThirdPartyType>
Implementations§
Source§impl Field
impl Field
pub fn from(f: &Field) -> Self
Sourcepub fn writer_snippet(&self) -> TokenStream
pub fn writer_snippet(&self) -> TokenStream
Takes the parsed field of the struct and emits a valid column writer snippet. Should match exactly what you would write by hand.
Can only generate writers for basic structs, for example:
struct Record {
a_bool: bool,
maybe_a_bool: Option<bool>
}
but not
struct UnsupportedNestedRecord { a_property: bool, nested_record: Record }
because this parsing logic is not sophisticated enough for definition levels beyond 2.
Sourcepub fn reader_snippet(&self) -> TokenStream
pub fn reader_snippet(&self) -> TokenStream
Takes the parsed field of the struct and emits a valid column reader snippet. Should match exactly what you would write by hand.
Can only generate writers for basic structs, for example:
struct Record { a_bool: bool }
but not
struct UnsupportedNestedRecord { a_property: bool, nested_record: Record }
because this parsing logic is not sophisticated enough for definition levels beyond 2.
Option
types and references not supported, but the column itself can be nullable
(i.e., def_level==1), as long as the values are all valid.