MCPcopy Create free account
hub / github.com/RustCrypto/utils / parse_attr

Method parse_attr

zeroize_derive/src/lib.rs:213–230  ·  view source on GitHub ↗

Parse attribute and handle `#[zeroize(...)]` attributes

(&mut self, attr: &Attribute, variant: Option<&Variant>, binding: Option<&Field>)

Source from the content-addressed store, hash-verified

211
212 /// Parse attribute and handle `#[zeroize(...)]` attributes
213 fn parse_attr(&mut self, attr: &Attribute, variant: Option<&Variant>, binding: Option<&Field>) {
214 let meta_list = match &attr.meta {
215 Meta::List(list) => list,
216 _ => return,
217 };
218
219 // Ignore any non-zeroize attributes
220 if !meta_list.path.is_ident(ZEROIZE_ATTR) {
221 return;
222 }
223
224 for meta in attr
225 .parse_args_with(Punctuated::<Meta, Comma>::parse_terminated)
226 .unwrap_or_else(|e| panic!("error parsing attribute: {attr:?} ({e})"))
227 {
228 self.parse_meta(&meta, variant, binding);
229 }
230 }
231
232 /// Parse `#[zeroize(...)]` attribute metadata (e.g. `drop`)
233 fn parse_meta(&mut self, meta: &Meta, variant: Option<&Variant>, binding: Option<&Field>) {

Callers 1

parseMethod · 0.80

Calls 1

parse_metaMethod · 0.80

Tested by

no test coverage detected