pub struct WithAttributes<Attr, Value>(pub Attr, pub Value);Expand description
Adds attributes to ANY item.
The first tuple value must be a sequence. The second must be a writable value.
Rust attributes can be put in many places, so this enables you to add attributes to any writable item. For example, adding attributes to function parameters can be done like so:
let function_param = WithAttributes(
SingularSeq(Cfg(Target::Os("linux"))),
FunctionParam(Str("conditional_param"), Str("Fd"))
);Will render as:
ⓘ
#[cfg(target_os = "linux")] conditional_param: FdTuple Fields§
§0: Attr§1: ValueTrait Implementations§
Auto Trait Implementations§
impl<Attr, Value> Freeze for WithAttributes<Attr, Value>
impl<Attr, Value> RefUnwindSafe for WithAttributes<Attr, Value>where
Attr: RefUnwindSafe,
Value: RefUnwindSafe,
impl<Attr, Value> Send for WithAttributes<Attr, Value>
impl<Attr, Value> Sync for WithAttributes<Attr, Value>
impl<Attr, Value> Unpin for WithAttributes<Attr, Value>
impl<Attr, Value> UnwindSafe for WithAttributes<Attr, Value>where
Attr: UnwindSafe,
Value: 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