pub struct PAttrs {
pub doc: Vec<String>,
pub facet: Vec<PFacetAttr>,
pub repr: PRepr,
pub rename_all: Option<RenameRule>,
pub crate_path: Option<TokenStream>,
pub errors: Vec<CompileError>,
pub declared_traits: Option<DeclaredTraits>,
pub auto_traits: bool,
}Expand description
Parsed attributes
Fields§
§doc: Vec<String>An array of doc lines
facet: Vec<PFacetAttr>Facet attributes specifically
repr: PReprRepresentation of the facet
rename_all: Option<RenameRule>rename_all rule (if any)
crate_path: Option<TokenStream>Custom crate path (if any), e.g., ::my_crate::facet
errors: Vec<CompileError>Errors to be emitted as compile_error! during code generation
declared_traits: Option<DeclaredTraits>Explicitly declared traits via #[facet(traits(...))]
When present, we skip all impls! checks and only generate vtable
entries for the declared traits.
auto_traits: boolWhether #[facet(auto_traits)] is present
When true, we use the old specialization-based detection.
When false (and no declared_traits), we generate an empty vtable.
Implementations§
Source§impl PAttrs
impl PAttrs
Sourcepub fn parse(attrs: &[Attribute], display_name: &mut String) -> Self
pub fn parse(attrs: &[Attribute], display_name: &mut String) -> Self
Parse attributes from a list of Attributes
Sourcepub fn has_builtin(&self, key: &str) -> bool
pub fn has_builtin(&self, key: &str) -> bool
Check if a builtin attribute with the given key exists
Sourcepub fn is_repr_transparent(&self) -> bool
pub fn is_repr_transparent(&self) -> bool
Check if #[repr(transparent)] is present
Sourcepub fn get_builtin_args(&self, key: &str) -> Option<String>
pub fn get_builtin_args(&self, key: &str) -> Option<String>
Get the args of a builtin attribute with the given key (if present)
Sourcepub fn facet_crate(&self) -> TokenStream
pub fn facet_crate(&self) -> TokenStream
Get the facet crate path, defaulting to ::facet if not specified
Sourcepub fn has_any_namespaced(&self) -> bool
pub fn has_any_namespaced(&self) -> bool
Check if any namespaced attribute exists (e.g., kdl::child, args::short)
When a namespaced attribute is present, rename on a container may be valid
because it controls how the type appears in that specific context.
Sourcepub fn get_builtin_span(&self, key: &str) -> Option<Span>
pub fn get_builtin_span(&self, key: &str) -> Option<Span>
Get the span of a builtin attribute with the given key (if present)