pub struct WafArray { /* private fields */ }Expand description
The WAF object representation of a value of type WafObjectType::Array
Implementations§
Source§impl WafArray
impl WafArray
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if this WafArray is indeed WafObjectType::Array.
Sourcepub fn new(nb_entries: usize) -> Result<Self, LengthTooLargeError>
pub fn new(nb_entries: usize) -> Result<Self, LengthTooLargeError>
Creates a new WafArray with the provided size. All values in the array are initialized
to an invalid WafObject instance.
§Errors
Returns an error if nb_entries exceeds MAX_ARRAY_LENGTH.
§Panics
Panics if memory allocation fails (out of memory).
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity of this WafArray.
The capacity is an implementation detail and is only used to for properly deallocating the memory when the array is dropped.
Sourcepub fn truncate(&mut self, new_size: usize)
pub fn truncate(&mut self, new_size: usize)
Truncates this WafArray 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 array, but later discover that you don’t need all the capacity.
Trait Implementations§
Source§impl AsRef<_ddwaf_object> for WafArray
impl AsRef<_ddwaf_object> for WafArray
Source§fn as_ref(&self) -> &ddwaf_object
fn as_ref(&self) -> &ddwaf_object
Source§impl IntoIterator for WafArray
impl IntoIterator for WafArray
Source§impl TypedWafObject for WafArray
impl TypedWafObject for WafArray
Source§const TYPE: WafObjectType = WafObjectType::Array
const TYPE: WafObjectType = WafObjectType::Array
WafObjectType constant corresponding to the typed
object’s type discriminator.