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 const fn is_valid(&self) -> bool
pub const fn is_valid(&self) -> bool
Returns true if this WafMap is indeed WafObjectType::Map.
Sourcepub fn new(nb_entries: u64) -> Self
pub fn new(nb_entries: u64) -> Self
Creates a new WafMap
with the provided size. All values in the map are initialized
to an invalid WafObject
instance with a blank key.
§Panics
Panics when the provided nbEntries
is larger than what the current platform can represent in an usize
.
This can only happen on platforms where usize
is 32-bit wide.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of this WafMap
.
§Panics
Panics if the map is larger than usize::MAX
elements. This can only happen on platforms
where usize
is 32-bit wide.
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: &[u8]) -> Option<&Keyed<WafObject>>
pub fn get(&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.