pub enum CustomAttribute {
Flag(String),
KeyValue {
key: String,
value: Value,
},
}
Expand description
A custom attribute on a container, variant, or field.
Applied by using the #[configurable(metadata(...))]
helper. Two forms are supported:
- as a flag (
#[configurable(metadata(some_flag))]
) - as a key/value pair (
#[configurable(metadata(status = "beta"))]
)
Custom attributes are added to the relevant schema definition as a custom field, _metadata
, and stored as an
object. For key/value pairs, they are added as-is to the object. For flags, the flag name is the property name, and
the value will always be true
.
Variants§
Flag(String)
A standalone flag.
Common for marking items as supporting a particular feature i.e. marking fields that can use the event template syntax.
KeyValue
A key/value pair.
Used for most metadata, where a given key could have many different possible values i.e. the status of a component (alpha, beta, stable, deprecated, etc).
Implementations§
Trait Implementations§
source§impl Clone for CustomAttribute
impl Clone for CustomAttribute
source§fn clone(&self) -> CustomAttribute
fn clone(&self) -> CustomAttribute
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for CustomAttribute
impl RefUnwindSafe for CustomAttribute
impl Send for CustomAttribute
impl Sync for CustomAttribute
impl Unpin for CustomAttribute
impl UnwindSafe for CustomAttribute
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)