Skip to main content

Keyed

Struct Keyed 

Source
pub struct Keyed<T: AsRawMutObject> { /* private fields */ }
Expand description

An WafObject or TypedWafObject associated with a key.

Implementations§

Source§

impl<T: AsRawMutObject> Keyed<T>

Source

pub fn new(key: impl Into<WafObject>, value: T) -> Self

Creates a new Keyed<WafObject> with the provided key and value.

Source

pub fn key(&self) -> &WafObject

Source

pub fn key_mut(&mut self) -> &mut WafObject

Obtains a mutable reference to the map entry key.

Source

pub fn value(&self) -> &T

Obtains a reference to the map entry value.

Source

pub fn value_mut(&mut self) -> &mut T

Obtains a mutable reference to the map entry value.

Source

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.

Source

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>

Source

pub fn as_type<T: TypedWafObject>(&self) -> Option<&Keyed<T>>

Source

pub fn as_type_mut<T: TypedWafObject>(&mut self) -> Option<&mut Keyed<T>>

Source§

impl Keyed<WafArray>

Source

pub fn iter(&self) -> impl Iterator<Item = &WafObject>

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut WafObject>

Source§

impl Keyed<WafMap>

Source

pub fn iter(&self) -> impl Iterator<Item = &Keyed<WafObject>>

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Keyed<WafObject>>

Trait Implementations§

Source§

impl<T: AsRawMutObject> AsRef<_ddwaf_object_kv> for Keyed<T>

Source§

fn as_ref(&self) -> &_ddwaf_object_kv

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: AsRawMutObject + Clone> Clone for Keyed<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: AsRawMutObject + Debug> Debug for Keyed<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + AsRawMutObject> Default for Keyed<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: AsRawMutObject> Deref for Keyed<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: AsRawMutObject> Drop for Keyed<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T, U: AsRawMutObject> From<(&[u8], T)> for Keyed<U>
where T: Into<U>,

Source§

fn from(value: (&[u8], T)) -> Self

Converts to this type from the input type.
Source§

impl<T, U: AsRawMutObject> From<(&str, T)> for Keyed<U>
where T: Into<U>,

Source§

fn from(value: (&str, T)) -> Self

Converts to this type from the input type.
Source§

impl<T: TypedWafObject> From<(WafObject, T)> for Keyed<T>

Source§

fn from(value: (WafObject, T)) -> Self

Converts to this type from the input type.
Source§

impl From<(WafObject, WafObject)> for Keyed<WafObject>

Source§

fn from(value: (WafObject, WafObject)) -> Self

Converts to this type from the input type.
Source§

impl<T: TypedWafObject> From<Keyed<T>> for Keyed<WafObject>

Source§

fn from(value: Keyed<T>) -> Self

Converts to this type from the input type.
Source§

impl IntoIterator for Keyed<WafArray>

Source§

type Item = WafObject

The type of the elements being iterated over.
Source§

type IntoIter = WafIter<<Keyed<WafArray> as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Keyed<WafMap>

Source§

type Item = Keyed<WafObject>

The type of the elements being iterated over.
Source§

type IntoIter = WafIter<<Keyed<WafMap> as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.