pub struct Keyed<T: AsRawMutObject> { /* private fields */ }Expand description
An WafObject or TypedWafObject associated with a key.
Implementations§
Source§impl<T: AsRawMutObject> Keyed<T>
impl<T: AsRawMutObject> Keyed<T>
Sourcepub fn new(key: impl Into<WafObject>, value: T) -> Self
pub fn new(key: impl Into<WafObject>, value: T) -> Self
Creates a new Keyed<WafObject> with the provided key and value.
pub fn key(&self) -> &WafObject
Sourcepub fn key_str(&self) -> Result<&str, Box<dyn Error>>
pub fn key_str(&self) -> Result<&str, Box<dyn Error>>
Obtains the key associated with this Keyed<WafObject> as a string.
§Errors
Returns an error if the underlying key data is not a valid UTF-8 string, under the same conditions as
std::str::from_utf8 or if the key is not a WafString.
Sourcepub fn key_bytes(&self) -> Result<&[u8], ObjectTypeError>
pub fn key_bytes(&self) -> Result<&[u8], ObjectTypeError>
Obtains the key associated with this Keyed<WafObject> as a byte slice.
§Errors
Returns an error if the underlying key data is not a WafString.
Source§impl Keyed<WafObject>
impl Keyed<WafObject>
pub fn as_type<T: TypedWafObject>(&self) -> Option<&Keyed<T>>
pub fn as_type_mut<T: TypedWafObject>(&mut self) -> Option<&mut Keyed<T>>
Trait Implementations§
Source§impl<T: AsRawMutObject> AsRef<_ddwaf_object_kv> for Keyed<T>
impl<T: AsRawMutObject> AsRef<_ddwaf_object_kv> for Keyed<T>
Source§fn as_ref(&self) -> &_ddwaf_object_kv
fn as_ref(&self) -> &_ddwaf_object_kv
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl IntoIterator for Keyed<WafArray>
impl IntoIterator for Keyed<WafArray>
Source§impl IntoIterator for Keyed<WafMap>
impl IntoIterator for Keyed<WafMap>
Auto Trait Implementations§
impl<T> Freeze for Keyed<T>
impl<T> RefUnwindSafe for Keyed<T>where
T: RefUnwindSafe,
impl<T> Send for Keyed<T>where
T: Send,
impl<T> Sync for Keyed<T>where
T: Sync,
impl<T> Unpin for Keyed<T>where
T: Unpin,
impl<T> UnwindSafe for Keyed<T>where
T: 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