pub trait DeriveInputExt {
    // Required methods
    fn append_derives(&mut self, derives: Punctuated<Path, Comma>);
    fn contains_namespace(&self, namespace: &Path) -> bool;
    fn namespace_parameter(&self, namespace: &Path) -> Option<Meta>;
    fn namespace_parameters(&self, namespace: &Path) -> Vec<Meta>;
    fn contains_tag(&self, namespace: &Path, tag: &Path) -> bool;
    fn tag_parameter(&self, namespace: &Path, tag: &Path) -> Option<Meta>;
    fn tag_parameters(&self, namespace: &Path, tag: &Path) -> Vec<Meta>;
}
Expand description

Functions to make it ergonomic to work with struct ASTs.

Required Methods§

source

fn append_derives(&mut self, derives: Punctuated<Path, Comma>)

Appends derives to the list of derives.

Note: This can only be used with attribute macros, and not derive macros.

  • If the derive attribute does not exist, one will be created.
  • If the derive attribute exists, and there are existing derives that overlap with the derives to append, this macro will panic with the overlapping derives.
  • If the derive attribute exists, and there are no overlapping derives, then they will be combined.
Panics

Panics if there are existing derives that overlap with the derives to append.

source

fn contains_namespace(&self, namespace: &Path) -> bool

Returns whether the type contains a given #[namespace] attribute.

Parameters
  • namespace: The path() of the first-level attribute.
source

fn namespace_parameter(&self, namespace: &Path) -> Option<Meta>

Returns the parameter from #[namespace(parameter)].

Parameters
  • namespace: The path() of the first-level attribute.
Panics

Panics if there is more than one parameter for the tag.

source

fn namespace_parameters(&self, namespace: &Path) -> Vec<Meta>

Returns the parameters from #[namespace(param1, param2, ..)].

Parameters
  • namespace: The path() of the first-level attribute.
source

fn contains_tag(&self, namespace: &Path, tag: &Path) -> bool

Returns whether the type contains a given #[namespace(tag)] attribute.

Parameters
  • namespace: The path() of the first-level attribute.
  • tag: The path() of the second-level attribute.
source

fn tag_parameter(&self, namespace: &Path, tag: &Path) -> Option<Meta>

Returns the parameter from #[namespace(tag(parameter))].

Parameters
  • namespace: The path() of the first-level attribute.
  • tag: The path() of the second-level attribute.
Panics

Panics if there is more than one parameter for the tag.

source

fn tag_parameters(&self, namespace: &Path, tag: &Path) -> Vec<Meta>

Returns the parameters from #[namespace(tag(param1, param2, ..))].

Parameters
  • namespace: The path() of the first-level attribute.
  • tag: The path() of the second-level attribute.

Implementations on Foreign Types§

source§

impl DeriveInputExt for DeriveInput

source§

fn append_derives(&mut self, derives_to_append: Punctuated<Path, Comma>)

source§

fn contains_namespace(&self, namespace: &Path) -> bool

source§

fn namespace_parameter(&self, namespace: &Path) -> Option<Meta>

source§

fn namespace_parameters(&self, namespace: &Path) -> Vec<Meta>

source§

fn contains_tag(&self, namespace: &Path, tag: &Path) -> bool

source§

fn tag_parameter(&self, namespace: &Path, tag: &Path) -> Option<Meta>

source§

fn tag_parameters(&self, namespace: &Path, tag: &Path) -> Vec<Meta>

Implementors§