pub struct Attribute<T: ?Sized> { /* private fields */ }Expand description
Typed name of an ɴsɪ attribute.
T is the data shape the attribute accepts. Slice-typed T = [U] means
the attribute carries an array of U.
Implementations§
Source§impl<T: ?Sized> Attribute<T>
impl<T: ?Sized> Attribute<T>
Sourcepub const fn new(name: &'static str) -> Self
pub const fn new(name: &'static str) -> Self
Create a new typed attribute name. const-callable so consumers can
declare attribute constants in their own crates.
Sourcepub fn ustr(&self) -> Ustr
pub fn ustr(&self) -> Ustr
Interned, null-terminated identifier suitable for C-FFI use. The
underlying Ustr caches the interning so repeated calls
for the same name reuse the same allocation – there is no per-call
CString dance.
Available with the ustr feature.
Sourcepub fn as_c_ptr(&self) -> *const c_char
pub fn as_c_ptr(&self) -> *const c_char
Raw C-FFI pointer to the null-terminated identifier. The lifetime is
effectively 'static because ustr::Ustr never frees its strings.
Pass this directly to C functions expecting a const char*.
Available with the ustr feature.
Trait Implementations§
impl<T: ?Sized> Copy for Attribute<T>
impl<T: ?Sized> Send for Attribute<T>
impl<T: ?Sized> Sync for Attribute<T>
Auto Trait Implementations§
impl<T> Freeze for Attribute<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Attribute<T>where
T: ?Sized,
impl<T> Unpin for Attribute<T>where
T: ?Sized,
impl<T> UnsafeUnpin for Attribute<T>where
T: ?Sized,
impl<T> UnwindSafe for Attribute<T>where
T: ?Sized,
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