Struct rbx_types::Attributes
source · pub struct Attributes { /* private fields */ }
Implementations§
source§impl Attributes
impl Attributes
sourcepub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
pub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
Reads from a serialized attributes string, and produces a new Attributes
from it.
sourcepub fn to_writer<W: Write>(&self, writer: W) -> Result<(), Error>
pub fn to_writer<W: Write>(&self, writer: W) -> Result<(), Error>
Writes the attributes as a serialized string to the writer.
sourcepub fn get<K: Borrow<str>>(&self, key: K) -> Option<&Variant>
pub fn get<K: Borrow<str>>(&self, key: K) -> Option<&Variant>
Get the attribute with the following key.
sourcepub fn insert(&mut self, key: String, value: Variant) -> Option<Variant>
pub fn insert(&mut self, key: String, value: Variant) -> Option<Variant>
Inserts an attribute with the given key and value. Will return the attribute that used to be there if one existed.
sourcepub fn with<K: Into<String>, V: Into<Variant>>(self, key: K, value: V) -> Self
pub fn with<K: Into<String>, V: Into<Variant>>(self, key: K, value: V) -> Self
Inserts an attribute with the given key and value. Will overwrite the attribute that used to be there if one existed.
sourcepub fn remove<K: Hash + Eq + Borrow<str>>(&mut self, key: K) -> Option<Variant>
pub fn remove<K: Hash + Eq + Borrow<str>>(&mut self, key: K) -> Option<Variant>
Removes an attribute with the given key. Will return the value that was there if one existed.
Trait Implementations§
source§impl Clone for Attributes
impl Clone for Attributes
source§fn clone(&self) -> Attributes
fn clone(&self) -> Attributes
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 moresource§impl Debug for Attributes
impl Debug for Attributes
source§impl Default for Attributes
impl Default for Attributes
source§fn default() -> Attributes
fn default() -> Attributes
Returns the “default value” for a type. Read more
source§impl From<Attributes> for Variant
impl From<Attributes> for Variant
source§fn from(value: Attributes) -> Self
fn from(value: Attributes) -> Self
Converts to this type from the input type.
source§impl FromIterator<(String, Variant)> for Attributes
impl FromIterator<(String, Variant)> for Attributes
source§impl IntoIterator for Attributes
impl IntoIterator for Attributes
source§impl PartialEq for Attributes
impl PartialEq for Attributes
source§fn eq(&self, other: &Attributes) -> bool
fn eq(&self, other: &Attributes) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq 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§
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