Trait sval::Value

source ·
pub trait Value {
Show 17 methods // Required method fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result; // Provided methods fn tag(&self) -> Option<Tag> { ... } fn to_bool(&self) -> Option<bool> { ... } fn to_f32(&self) -> Option<f32> { ... } fn to_f64(&self) -> Option<f64> { ... } fn to_i8(&self) -> Option<i8> { ... } fn to_i16(&self) -> Option<i16> { ... } fn to_i32(&self) -> Option<i32> { ... } fn to_i64(&self) -> Option<i64> { ... } fn to_i128(&self) -> Option<i128> { ... } fn to_u8(&self) -> Option<u8> { ... } fn to_u16(&self) -> Option<u16> { ... } fn to_u32(&self) -> Option<u32> { ... } fn to_u64(&self) -> Option<u64> { ... } fn to_u128(&self) -> Option<u128> { ... } fn to_text(&self) -> Option<&str> { ... } fn to_binary(&self) -> Option<&[u8]> { ... }
}
Expand description

A producer of structured data.

Required Methods§

source

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

Stream this value through a Stream.

Provided Methods§

source

fn tag(&self) -> Option<Tag>

Get the tag of this value, if there is one.

source

fn to_bool(&self) -> Option<bool>

Try convert this value into a boolean.

source

fn to_f32(&self) -> Option<f32>

Try convert this value into a 32bit binary floating point number.

source

fn to_f64(&self) -> Option<f64>

Try convert this value into a 64bit binary floating point number.

source

fn to_i8(&self) -> Option<i8>

Try convert this value into a signed 8bit integer.

source

fn to_i16(&self) -> Option<i16>

Try convert this value into a signed 16bit integer.

source

fn to_i32(&self) -> Option<i32>

Try convert this value into a signed 32bit integer.

source

fn to_i64(&self) -> Option<i64>

Try convert this value into a signed 64bit integer.

source

fn to_i128(&self) -> Option<i128>

Try convert this value into a signed 128bit integer.

source

fn to_u8(&self) -> Option<u8>

Try convert this value into an unsigned 8bit integer.

source

fn to_u16(&self) -> Option<u16>

Try convert this value into an unsigned 16bit integer.

source

fn to_u32(&self) -> Option<u32>

Try convert this value into an unsigned 32bit integer.

source

fn to_u64(&self) -> Option<u64>

Try convert this value into an unsigned 64bit integer.

source

fn to_u128(&self) -> Option<u128>

Try convert this value into an unsigned 128bit integer.

source

fn to_text(&self) -> Option<&str>

Try convert this value into a text string.

source

fn to_binary(&self) -> Option<&[u8]>

Try convert this value into a bitstring.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Value for bool

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn tag(&self) -> Option<Tag>

source§

fn to_bool(&self) -> Option<bool>

source§

impl Value for char

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl Value for f32

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_f32(&self) -> Option<f32>

source§

impl Value for f64

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_f64(&self) -> Option<f64>

source§

impl Value for i8

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_i8(&self) -> Option<i8>

source§

impl Value for i16

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_i16(&self) -> Option<i16>

source§

impl Value for i32

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_i32(&self) -> Option<i32>

source§

impl Value for i64

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_i64(&self) -> Option<i64>

source§

impl Value for i128

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_i128(&self) -> Option<i128>

source§

impl Value for str

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn tag(&self) -> Option<Tag>

source§

fn to_text(&self) -> Option<&str>

source§

impl Value for u8

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_u8(&self) -> Option<u8>

source§

impl Value for u16

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_u16(&self) -> Option<u16>

source§

impl Value for u32

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_u32(&self) -> Option<u32>

source§

impl Value for u64

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_u64(&self) -> Option<u64>

source§

impl Value for u128

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn to_u128(&self) -> Option<u128>

source§

impl Value for ()

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl Value for String

source§

fn stream<'a, S: Stream<'a> + ?Sized>(&'a self, stream: &mut S) -> Result

source§

fn tag(&self) -> Option<Tag>

source§

fn to_text(&self) -> Option<&str>

source§

impl<'a, T: Value + ?Sized> Value for &'a T

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn tag(&self) -> Option<Tag>

source§

fn to_bool(&self) -> Option<bool>

source§

fn to_f32(&self) -> Option<f32>

source§

fn to_f64(&self) -> Option<f64>

source§

fn to_i8(&self) -> Option<i8>

source§

fn to_i16(&self) -> Option<i16>

source§

fn to_i32(&self) -> Option<i32>

source§

fn to_i64(&self) -> Option<i64>

source§

fn to_i128(&self) -> Option<i128>

source§

fn to_u8(&self) -> Option<u8>

source§

fn to_u16(&self) -> Option<u16>

source§

fn to_u32(&self) -> Option<u32>

source§

fn to_u64(&self) -> Option<u64>

source§

fn to_u128(&self) -> Option<u128>

source§

fn to_text(&self) -> Option<&str>

source§

fn to_binary(&self) -> Option<&[u8]>

source§

impl<K: Value, V: Value> Value for BTreeMap<K, V>

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<K: Value, V: Value, H: BuildHasher> Value for HashMap<K, V, H>

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value> Value for (T0,)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value> Value for (T0, T1)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value> Value for (T0, T1, T2)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value> Value for (T0, T1, T2, T3)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value> Value for (T0, T1, T2, T3, T4)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value> Value for (T0, T1, T2, T3, T4, T5)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value> Value for (T0, T1, T2, T3, T4, T5, T6)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value, T10: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value, T10: Value, T11: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value, T10: Value, T11: Value, T12: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value, T10: Value, T11: Value, T12: Value, T13: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value, T10: Value, T11: Value, T12: Value, T13: Value, T14: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T0: Value, T1: Value, T2: Value, T3: Value, T4: Value, T5: Value, T6: Value, T7: Value, T8: Value, T9: Value, T10: Value, T11: Value, T12: Value, T13: Value, T14: Value, T15: Value> Value for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

impl<T: Value + ?Sized> Value for Box<T>

source§

fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result

source§

fn tag(&self) -> Option<Tag>

source§

fn to_bool(&self) -> Option<bool>

source§

fn to_f32(&self) -> Option<f32>

source§

fn to_f64(&self) -> Option<f64>

source§

fn to_i8(&self) -> Option<i8>

source§

fn to_i16(&self) -> Option<i16>

source§

fn to_i32(&self) -> Option<i32>

source§

fn to_i64(&self) -> Option<i64>

source§

fn to_i128(&self) -> Option<i128>

source§

fn to_u8(&self) -> Option<u8>

source§

fn to_u16(&self) -> Option<u16>

source§

fn to_u32(&self) -> Option<u32>

source§

fn to_u64(&self) -> Option<u64>

source§

fn to_u128(&self) -> Option<u128>

source§

fn to_text(&self) -> Option<&str>

source§

fn to_binary(&self) -> Option<&[u8]>

source§

impl<T: Value> Value for Option<T>

source§

fn stream<'a, S: Stream<'a> + ?Sized>(&'a self, stream: &mut S) -> Result

source§

fn to_bool(&self) -> Option<bool>

source§

fn to_f32(&self) -> Option<f32>

source§

fn to_f64(&self) -> Option<f64>

source§

fn to_i8(&self) -> Option<i8>

source§

fn to_i16(&self) -> Option<i16>

source§

fn to_i32(&self) -> Option<i32>

source§

fn to_i64(&self) -> Option<i64>

source§

fn to_i128(&self) -> Option<i128>

source§

fn to_u8(&self) -> Option<u8>

source§

fn to_u16(&self) -> Option<u16>

source§

fn to_u32(&self) -> Option<u32>

source§

fn to_u64(&self) -> Option<u64>

source§

fn to_u128(&self) -> Option<u128>

source§

fn to_text(&self) -> Option<&str>

source§

fn to_binary(&self) -> Option<&[u8]>

source§

impl<T: Value> Value for [T]

source§

fn stream<'a, S: Stream<'a> + ?Sized>(&'a self, stream: &mut S) -> Result

source§

impl<T: Value> Value for Vec<T>

source§

fn stream<'a, S: Stream<'a> + ?Sized>(&'a self, stream: &mut S) -> Result

source§

impl<T: Value, const N: usize> Value for [T; N]

source§

fn stream<'a, S: Stream<'a> + ?Sized>(&'a self, stream: &mut S) -> Result

Implementors§

source§

impl Value for BinarySlice

source§

impl Value for Null

source§

impl<K: Value, V: Value> Value for MapSlice<K, V>

source§

impl<V: Display> Value for Display<V>

source§

impl<const N: usize> Value for BinaryArray<N>