Skip to main content

moverox_traits_derive/
attributes.rs

1#![expect(
2    clippy::option_if_let_else,
3    reason = "Generated code by `#[darling(default)]`"
4)]
5
6use darling::FromDeriveInput;
7use syn::{Ident, Path, parse_quote};
8
9#[derive(FromDeriveInput)]
10#[darling(attributes(move_))]
11pub(crate) struct MoveAttributes {
12    #[darling(rename = "crate")]
13    pub(crate) thecrate: Option<Path>,
14    pub(crate) address: Option<String>,
15    pub(crate) module: Option<Ident>,
16    #[darling(default)]
17    pub(crate) nameless: bool,
18}
19
20impl MoveAttributes {
21    pub(crate) fn thecrate(&self) -> Path {
22        self.thecrate
23            .as_ref()
24            .cloned()
25            .unwrap_or_else(|| parse_quote!(::moverox_traits))
26    }
27}