pub struct Attr<T: FromInput>(/* private fields */);Expand description
Element extractor that resolves a #[derive(Attribute)] struct from the
input’s attributes.
Use as an element parameter type to auto-extract a parsed attribute config
without passing it as a prop at the call site. Access the inner value via
Deref or consume with inner().
ⓘ
#[zyn::element]
fn my_element(#[zyn(input)] cfg: zyn::Attr<MyConfig>) -> proc_macro2::TokenStream {
// cfg.my_field — accessed via Deref
}Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Attr<T>where
T: Freeze,
impl<T> RefUnwindSafe for Attr<T>where
T: RefUnwindSafe,
impl<T> Send for Attr<T>where
T: Send,
impl<T> Sync for Attr<T>where
T: Sync,
impl<T> Unpin for Attr<T>where
T: Unpin,
impl<T> UnsafeUnpin for Attr<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Attr<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more