Skip to main content

RawValue

Enum RawValue 

Source
pub enum RawValue {
Show 33 variants Invalid, EnumScalar(u8), U8Scalar(u8), U8zScalar(u8), I8Scalar(i8), U16Scalar(u16), U16zScalar(u16), I16Scalar(i16), U32Scalar(u32), U32zScalar(u32), I32Scalar(i32), U64Scalar(u64), U64zScalar(u64), I64Scalar(i64), F32Scalar(f32), F64Scalar(f64), EnumArray(Box<[u8]>), U8Array(Box<[u8]>), U8zArray(Box<[u8]>), I8Array(Box<[i8]>), U16Array(Box<[u16]>), U16zArray(Box<[u16]>), I16Array(Box<[i16]>), U32Array(Box<[u32]>), U32zArray(Box<[u32]>), I32Array(Box<[i32]>), U64Array(Box<[u64]>), U64zArray(Box<[u64]>), I64Array(Box<[i64]>), F32Array(Box<[f32]>), F64Array(Box<[f64]>), String(Box<str>), Byte(Box<[u8]>),
}
Expand description

A decoded field value.

Variants§

§

Invalid

All elements matched the type’s invalid sentinel.

§

EnumScalar(u8)

§

U8Scalar(u8)

§

U8zScalar(u8)

§

I8Scalar(i8)

§

U16Scalar(u16)

§

U16zScalar(u16)

§

I16Scalar(i16)

§

U32Scalar(u32)

§

U32zScalar(u32)

§

I32Scalar(i32)

§

U64Scalar(u64)

§

U64zScalar(u64)

§

I64Scalar(i64)

§

F32Scalar(f32)

§

F64Scalar(f64)

§

EnumArray(Box<[u8]>)

§

U8Array(Box<[u8]>)

§

U8zArray(Box<[u8]>)

§

I8Array(Box<[i8]>)

§

U16Array(Box<[u16]>)

§

U16zArray(Box<[u16]>)

§

I16Array(Box<[i16]>)

§

U32Array(Box<[u32]>)

§

U32zArray(Box<[u32]>)

§

I32Array(Box<[i32]>)

§

U64Array(Box<[u64]>)

§

U64zArray(Box<[u64]>)

§

I64Array(Box<[i64]>)

§

F32Array(Box<[f32]>)

§

F64Array(Box<[f64]>)

§

String(Box<str>)

UTF-8 string with the trailing 0x00 (and any padding) stripped.

§

Byte(Box<[u8]>)

Opaque byte array (single bytes that are not invalid sentinels also land here — there is no ByteScalar variant since Byte is by definition an array type on the wire).

Implementations§

Source§

impl RawValue

Source

pub fn is_invalid(&self) -> bool

True iff the field collapsed to the invalid sentinel.

Source

pub fn as_str(&self) -> Option<&str>

Borrow the underlying string.

Source

pub fn as_u8(&self) -> Option<u8>

Get a scalar u8 for length-1 single-byte fields.

Source

pub fn as_u16(&self) -> Option<u16>

Get a scalar u16 (also widens single-byte fields).

Source

pub fn as_u32(&self) -> Option<u32>

Get a scalar u32 (also accepts U32z).

Source

pub fn scalar_u64(&self) -> Option<u64>

Best-effort cast of any single-element numeric value to u64. Signed types are widened via two’s complement (matches the prior components::scalar_as_u64 behavior).

Source

pub fn scalar_f64(&self) -> Option<f64>

Best-effort cast of any single-element numeric value to f64.

Source

pub fn to_f64s(&self) -> Option<Vec<f64>>

Iterate any numeric variant (scalar or array) as f64s. Returns None for non-numeric types (String, Invalid).

Trait Implementations§

Source§

impl Clone for RawValue

Source§

fn clone(&self) -> RawValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RawValue

Source§

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

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

impl PartialEq for RawValue

Source§

fn eq(&self, other: &RawValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RawValue

Auto Trait Implementations§

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