pub struct Value<'a> { /* private fields */ }Expand description
A container for SCALE encoded data that can serialize types directly with the help of a type registry and without using an intermediate representation.
Implementations§
Source§impl<'a> Value<'a>
impl<'a> Value<'a>
Sourcepub fn new(data: &'a [u8], ty_id: TypeId, registry: &'a Registry) -> Self
pub fn new(data: &'a [u8], ty_id: TypeId, registry: &'a Registry) -> Self
Wrap raw SCALE-encoded data as a typed value.
pub fn as_u8(&self) -> Option<u8>
pub fn as_u16(&self) -> Option<u16>
pub fn as_u32(&self) -> Option<u32>
pub fn as_u64(&self) -> Option<u64>
pub fn as_u128(&self) -> Option<u128>
pub fn as_i8(&self) -> Option<i8>
pub fn as_i16(&self) -> Option<i16>
pub fn as_i32(&self) -> Option<i32>
pub fn as_i64(&self) -> Option<i64>
pub fn as_i128(&self) -> Option<i128>
pub fn as_bool(&self) -> Option<bool>
pub fn as_char(&self) -> Option<char>
pub fn as_str(&self) -> Option<&'a str>
pub fn is_u8(&self) -> bool
pub fn is_u16(&self) -> bool
pub fn is_u32(&self) -> bool
pub fn is_u64(&self) -> bool
pub fn is_u128(&self) -> bool
pub fn is_i8(&self) -> bool
pub fn is_i16(&self) -> bool
pub fn is_i32(&self) -> bool
pub fn is_i64(&self) -> bool
pub fn is_i128(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_char(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_sequence(&self) -> bool
pub fn is_array(&self) -> bool
pub fn is_tuple(&self) -> bool
pub fn is_compact(&self) -> bool
pub fn is_variant(&self) -> bool
pub fn is_composite(&self) -> bool
pub fn sequence_len(&self) -> Option<usize>
pub fn sequence_get(&self, index: usize) -> Option<Value<'a>>
pub fn sequence_iter(&self) -> Option<SeqIter<'a>>
pub fn array_len(&self) -> Option<u32>
pub fn array_get(&self, index: u32) -> Option<Value<'a>>
pub fn field_count(&self) -> Option<usize>
pub fn field_at(&self, index: usize) -> Option<Value<'a>>
pub fn field(&self, name: &str) -> Option<Value<'a>>
pub fn fields_iter(&self) -> Option<FieldIter<'a>>
pub fn tuple_len(&self) -> Option<usize>
pub fn tuple_get(&self, index: usize) -> Option<Value<'a>>
pub fn tuple_iter(&self) -> Option<TupleIter<'a>>
pub fn variant_index(&self) -> Option<u8>
pub fn variant_name(&self) -> Option<&str>
pub fn variant_data(&self) -> Option<Value<'a>>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Value<'a>
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnsafeUnpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
Blanket Implementations§
Source§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
Source§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more