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 inner(&self) -> &T

Obtains a reference to the wrapped value.

Source

pub fn key(&self) -> &[u8]

Obtains the key associated with this Keyed<WafObject>, as-is.

§Panics

Panics if the underlying object’s key is too long to be represented on this platform. This can only happen on platforms where usize is 32-bit wide.

Source

pub fn key_str(&self) -> Result<&str, Utf8Error>

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.

Source

pub fn set_key(&mut self, key: &[u8]) -> &mut Self

Sets the key associated with this Keyed<WafObject>.

Source

pub fn set_key_str(&mut self, key: &str) -> &mut Self

Sets the key associated with this Keyed<WafObject> to the provided string.

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> for Keyed<T>

Source§

fn as_ref(&self) -> &ddwaf_object

Converts this type into a shared reference of the (usually inferred) input type.
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((key, 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((key, value): (&str, T)) -> 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>
where T: Freeze,

§

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> 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, 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.