pub type ddwaf_object = _ddwaf_object;Aliased Type§
#[repr(C)]pub union ddwaf_object {
pub type_: u8,
pub via: _ddwaf_object__bindgen_ty_1,
}Fields§
§type_: u8§via: _ddwaf_object__bindgen_ty_1Implementations§
Source§impl ddwaf_object
impl ddwaf_object
Sourcepub unsafe fn drop_array(&mut self)
pub unsafe fn drop_array(&mut self)
Drops the array data associated with the receiving ddwaf_object.
§Safety
- The
ddwaf_objectmust be a valid representation of an array. - The array must be an
std::alloc::allocated array ofddwaf_objectof the proper size. - The individual elements of the array must be valid
ddwaf_objects that can be dropped withddwaf_object::drop_object.
§Panics
Panics if the capacity is too large to construct a valid allocation layout. This is only possible on 32-bit targets because the capacity is limited to 28 bits.
Sourcepub unsafe fn drop_map(&mut self)
pub unsafe fn drop_map(&mut self)
Drops the map data associated with the receiving ddwaf_object.
§Safety
- The
ddwaf_objectmust be a valid representation of a map. - The map must be an
std::alloc::allocated array ofddwaf_objectof the proper size. - The individual elements of the map must be valid
ddwaf_objects that can be dropped with bothddwaf_object::drop_objectand [ddwaf_object::drop_key].
§Panics
Panics if the capacity is too large to construct a valid allocation layout. This is only possible on 32-bit targets because the capacity is limited to 28 bits.
Sourcepub unsafe fn drop_object(&mut self)
pub unsafe fn drop_object(&mut self)
Drops the value associated with the receiving ddwaf_object.
§Safety
If the ddwaf_object is a string, array, or map, the respective requirements of the
ddwaf_object::drop_string, ddwaf_object::drop_array, or ddwaf_object::drop_map
methods apply.
The method can’t be called more than once.
Sourcepub unsafe fn drop_string(&mut self)
pub unsafe fn drop_string(&mut self)
Drops the regular string associated with the receiving ddwaf_object.
§Safety
- The
ddwaf_objectmust be a valid representation of a string - The
_ddwaf_object__bindgen_ty_1::str_field must have a_ddwaf_object_string::ptrset from an allocation ofc_charof the size indicated by the_ddwaf_object_string::sizefield done withstd::alloc::alloc.
Sourcepub fn obj_type(&self) -> DDWAF_OBJ_TYPE
pub fn obj_type(&self) -> DDWAF_OBJ_TYPE
Returns the type of the ddwaf_object
Sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if the ddwaf_object is a string.
Sourcepub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Returns true if the ddwaf_object is either array representation.
Sourcepub fn is_map(&self) -> bool
pub fn is_map(&self) -> bool
Returns true if the ddwaf_object is either map representation.
Sourcepub fn array_len(&self) -> usize
pub fn array_len(&self) -> usize
Returns the length of the array associated with the receiving ddwaf_object.
§Panics
Panics if the object is not an array.
Sourcepub fn array_capacity(&self) -> usize
pub fn array_capacity(&self) -> usize
Returns the capacity of the array associated with the receiving ddwaf_object.
§Panics
Panics if the object is not an array.
Sourcepub fn array_ptr(&self) -> *mut ddwaf_object
pub fn array_ptr(&self) -> *mut ddwaf_object
Returns the element pointer of the array associated with the receiving ddwaf_object.
§Panics
Panics if the object is not an array.
Sourcepub unsafe fn set_array_len(&mut self, new_len: usize)
pub unsafe fn set_array_len(&mut self, new_len: usize)
Changes the length of the array associated with the receiving ddwaf_object.
§Safety
Every element before new_len must be initialized and valid to drop.
§Panics
Panics if new_len exceeds the array’s capacity.
Sourcepub fn map_len(&self) -> usize
pub fn map_len(&self) -> usize
Returns the length of the map associated with the receiving ddwaf_object.
§Panics
Panics if the object is not a map.
Sourcepub fn map_capacity(&self) -> usize
pub fn map_capacity(&self) -> usize
Returns the capacity of the map associated with the receiving ddwaf_object.
§Panics
Panics if the object is not a map.
Sourcepub fn map_ptr(&self) -> *mut _ddwaf_object_kv
pub fn map_ptr(&self) -> *mut _ddwaf_object_kv
Returns the entry pointer of the map associated with the receiving ddwaf_object.
§Panics
Panics if the object is not a map.
Sourcepub unsafe fn set_map_len(&mut self, new_len: usize)
pub unsafe fn set_map_len(&mut self, new_len: usize)
Changes the length of the map associated with the receiving ddwaf_object.
§Safety
Every entry before new_len must be initialized and valid to drop.
§Panics
Panics if new_len exceeds the map’s capacity.