MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / add_field

Function add_field

flow-derive/src/utils.rs:79–86  ·  view source on GitHub ↗
(item: &mut ItemStruct, field: TokenStream)

Source from the content-addressed store, hash-verified

77}
78
79pub fn add_field(item: &mut ItemStruct, field: TokenStream) -> Result<()> {
80 match item.fields {
81 Fields::Named(ref mut fields) => fields.named.push(Field::parse_named.parse2(field)?),
82 Fields::Unnamed(ref mut fields) => fields.unnamed.push(Field::parse_unnamed.parse2(field)?),
83 _ => unreachable!(),
84 }
85 Ok(())
86}
87
88pub type ExtractParams<'a> = (&'a Ident, &'a Option<Ident>, &'a Type);
89

Callers 1

ports_expandFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected