pub struct WafMap { /* private fields */ }Expand description
The WAF object representation of a value of type WafObjectType::Map
Implementations§
Source§impl WafMap
impl WafMap
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if this WafMap is indeed WafObjectType::Map.
Sourcepub const fn capacity(&self) -> u16
pub const fn capacity(&self) -> u16
Returns the capacity of this WafMap.
The capacity is an implementation detail and is only used to for properly deallocating the memory when the map is dropped.
Sourcepub fn truncate(&mut self, new_size: u16)
pub fn truncate(&mut self, new_size: u16)
Truncates this WafMap to the provided size.
Has no effect is the current length is not greater than the new size.
It does not free the extra memory, except insofar as it drops the extra elements. Useful when you pessimistically allocate a larger map, but later discover that you don’t need all the capacity.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Keyed<WafObject>>
pub fn iter(&self) -> impl Iterator<Item = &Keyed<WafObject>>
Returns an iterator over the Keyed<WafObject>s in this WafMap.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Keyed<WafObject>>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Keyed<WafObject>>
Returns a mutable iterator over the Keyed<WafObject>s in this WafMap.
Sourcepub fn get(&self, key: impl AsRef<ddwaf_object>) -> Option<&Keyed<WafObject>>
pub fn get(&self, key: impl AsRef<ddwaf_object>) -> Option<&Keyed<WafObject>>
Returns a reference to the Keyed<WafObject> with the provided key, if one exists.
If multiple such objects exist in the receiver, the first match is returned.
Sourcepub fn get_bstr(&self, key: &[u8]) -> Option<&Keyed<WafObject>>
pub fn get_bstr(&self, key: &[u8]) -> Option<&Keyed<WafObject>>
Returns a reference to the Keyed<WafObject> with the provided key, if one exists.
If multiple such objects exist in the receiver, the first match is returned.
Sourcepub fn get_mut(&mut self, key: &[u8]) -> Option<&mut Keyed<WafObject>>
pub fn get_mut(&mut self, key: &[u8]) -> Option<&mut Keyed<WafObject>>
Returns a mutable reference to the Keyed<WafObject> with the provided key, if one exists.
If multiple such objects exist in the receiver, the first match is returned.
Sourcepub fn get_str(&self, key: &str) -> Option<&Keyed<WafObject>>
pub fn get_str(&self, key: &str) -> Option<&Keyed<WafObject>>
Returns a reference to the Keyed<WafObject> with the provided key, if one exists.
Sourcepub fn get_str_mut(&mut self, key: &str) -> Option<&mut Keyed<WafObject>>
pub fn get_str_mut(&mut self, key: &str) -> Option<&mut Keyed<WafObject>>
Returns a mutable reference to the Keyed<WafObject> with the provided key, if one exists.
Trait Implementations§
Source§impl AsRef<_ddwaf_object> for WafMap
impl AsRef<_ddwaf_object> for WafMap
Source§fn as_ref(&self) -> &ddwaf_object
fn as_ref(&self) -> &ddwaf_object
Source§impl<'de> Deserialize<'de> for WafMap
impl<'de> Deserialize<'de> for WafMap
Source§fn deserialize<D>(deserializer: D) -> Result<WafMap, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<WafMap, D::Error>where
D: Deserializer<'de>,
Source§impl IntoIterator for WafMap
impl IntoIterator for WafMap
Source§impl TypedWafObject for WafMap
impl TypedWafObject for WafMap
Source§const TYPE: WafObjectType = WafObjectType::Map
const TYPE: WafObjectType = WafObjectType::Map
WafObjectType constant corresponding to the typed
object’s type discriminator.