Struct tap::attribute::Attributes
source · [−]pub struct Attributes { /* private fields */ }
Expand description
Attributes is a container for Attribute.
Implementations
sourceimpl Attributes
impl Attributes
sourcepub fn new() -> Self
pub fn new() -> Self
Return a new Attributes.
sourcepub fn names(&self) -> Vec<String>
pub fn names(&self) -> Vec<String>
Return the name
of all the attribute contained in this attributes.
sourcepub fn add_attribute<S, V: Into<Value>>(
&mut self,
name: S,
value: V,
descr: Option<S>
) where
S: Into<Cow<'static, str>>,
pub fn add_attribute<S, V: Into<Value>>(
&mut self,
name: S,
value: V,
descr: Option<S>
) where
S: Into<Cow<'static, str>>,
Add a new attribute by passing it’s name
, value
and description
.
sourcepub fn remove_attribute(&mut self, name: &str) -> bool
pub fn remove_attribute(&mut self, name: &str) -> bool
Remove an attribute by name
.
sourcepub fn add_attributes<S>(&mut self, attr: Vec<(S, Value, Option<S>)>) where
S: Into<Cow<'static, str>>,
pub fn add_attributes<S>(&mut self, attr: Vec<(S, Value, Option<S>)>) where
S: Into<Cow<'static, str>>,
Add attributes by passing a Vector of tuple containing the name
, value
and description
of the attribute.
sourcepub fn count(&self) -> usize
pub fn count(&self) -> usize
Return the number of attribute contained in this attributes.
sourcepub fn get_type_id(&self, name: &str) -> Option<ValueTypeId>
pub fn get_type_id(&self, name: &str) -> Option<ValueTypeId>
sourcepub fn attributes(&self) -> LockedAttributes<'_>
pub fn attributes(&self) -> LockedAttributes<'_>
Return an iterator to the contained Attributes.
Trait Implementations
sourceimpl Clone for Attributes
impl Clone for Attributes
sourcefn clone(&self) -> Attributes
fn clone(&self) -> Attributes
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Attributes
impl Debug for Attributes
sourceimpl Default for Attributes
impl Default for Attributes
sourcefn default() -> Attributes
fn default() -> Attributes
Returns the “default value” for a type. Read more
sourceimpl From<Attributes> for Value
impl From<Attributes> for Value
sourcefn from(input: Attributes) -> Self
fn from(input: Attributes) -> Self
Performs the conversion.
sourceimpl PartialEq<Attributes> for Attributes
impl PartialEq<Attributes> for Attributes
sourceimpl Serialize for Attributes
impl Serialize for Attributes
Auto Trait Implementations
impl RefUnwindSafe for Attributes
impl Send for Attributes
impl Sync for Attributes
impl Unpin for Attributes
impl UnwindSafe for Attributes
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more