pub struct ValueAndType {
pub value: Value,
pub typ: AnalysedType,
}Fields§
§value: Value§typ: AnalysedTypeImplementations§
Source§impl ValueAndType
impl ValueAndType
pub fn new(value: Value, typ: AnalysedType) -> Self
pub fn into_list_items(self) -> Option<Vec<ValueAndType>>
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for ValueAndType
impl<'__de, __Context> BorrowDecode<'__de, __Context> for ValueAndType
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl Clone for ValueAndType
impl Clone for ValueAndType
Source§fn clone(&self) -> ValueAndType
fn clone(&self) -> ValueAndType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValueAndType
impl Debug for ValueAndType
Source§impl<__Context> Decode<__Context> for ValueAndType
impl<__Context> Decode<__Context> for ValueAndType
Source§impl<'de> Deserialize<'de> for ValueAndType
impl<'de> Deserialize<'de> for ValueAndType
Source§fn deserialize<D>(deserializer: D) -> Result<ValueAndType, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<ValueAndType, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ValueAndType
Available on crate feature host only.
impl Display for ValueAndType
Available on crate feature
host only.Source§impl Encode for ValueAndType
impl Encode for ValueAndType
Source§impl From<ValueAndType> for AnalysedType
impl From<ValueAndType> for AnalysedType
Source§fn from(value_and_type: ValueAndType) -> Self
fn from(value_and_type: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl From<ValueAndType> for Value
impl From<ValueAndType> for Value
Source§fn from(value_and_type: ValueAndType) -> Self
fn from(value_and_type: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl From<ValueAndType> for ValueAndType
impl From<ValueAndType> for ValueAndType
Source§fn from(value: ValueAndType) -> Self
fn from(value: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl From<ValueAndType> for ValueAndType
impl From<ValueAndType> for ValueAndType
Source§fn from(value: ValueAndType) -> Self
fn from(value: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl From<ValueAndType> for ValueAndType
impl From<ValueAndType> for ValueAndType
Source§fn from(value: ValueAndType) -> Self
fn from(value: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl From<ValueAndType> for WitType
Available on crate feature host only.
impl From<ValueAndType> for WitType
Available on crate feature
host only.Source§fn from(value_and_type: ValueAndType) -> Self
fn from(value_and_type: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl From<ValueAndType> for WitValue
Available on crate feature host only.
impl From<ValueAndType> for WitValue
Available on crate feature
host only.Source§fn from(value_and_type: ValueAndType) -> Self
fn from(value_and_type: ValueAndType) -> Self
Converts to this type from the input type.
Source§impl IntoValue for ValueAndType
Available on crate feature host only.
impl IntoValue for ValueAndType
Available on crate feature
host only.fn into_value(self) -> Value
fn get_type() -> AnalysedType
Source§impl ParseFromJSON for ValueAndType
impl ParseFromJSON for ValueAndType
Source§fn parse_from_json(value: Option<Value>) -> ParseResult<Self>
fn parse_from_json(value: Option<Value>) -> ParseResult<Self>
Parse from
serde_json::Value.Source§fn parse_from_json_string(s: &str) -> Result<Self, ParseError<Self>>
fn parse_from_json_string(s: &str) -> Result<Self, ParseError<Self>>
Parse from JSON string.
Source§impl PartialEq for ValueAndType
impl PartialEq for ValueAndType
Source§impl Serialize for ValueAndType
impl Serialize for ValueAndType
Source§impl ToJSON for ValueAndType
impl ToJSON for ValueAndType
Source§impl TryFrom<ValueAndType> for ValueAndType
impl TryFrom<ValueAndType> for ValueAndType
Source§impl Type for ValueAndType
impl Type for ValueAndType
Source§const IS_REQUIRED: bool = true
const IS_REQUIRED: bool = true
If it is
true, it means that this type is required.Source§type RawValueType = ValueAndType
type RawValueType = ValueAndType
The raw type used for validator. Read more
Source§type RawElementValueType = ValueAndType
type RawElementValueType = ValueAndType
The raw element type used for validator.
Source§fn schema_ref() -> MetaSchemaRef
fn schema_ref() -> MetaSchemaRef
Get schema reference of this type.
Source§fn as_raw_value(&self) -> Option<&Self::RawValueType>
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Returns a reference to the raw value.
Source§fn raw_element_iter<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>
fn raw_element_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = &'a Self::RawElementValueType> + 'a>
Returns an iterator for traversing the elements.
Source§impl ValueAndTypeJsonExtensions for ValueAndType
impl ValueAndTypeJsonExtensions for ValueAndType
Source§fn parse_with_type(
json_val: &JsonValue,
typ: &AnalysedType,
) -> Result<Self, Vec<String>>
fn parse_with_type( json_val: &JsonValue, typ: &AnalysedType, ) -> Result<Self, Vec<String>>
Parses a JSON value representation (with no type information) into a typed value based
on the given type information.
Source§impl WasmValue for ValueAndType
impl WasmValue for ValueAndType
Source§type Type = AnalysedType
type Type = AnalysedType
A type representing types of these values.
Source§fn kind(&self) -> WasmTypeKind
fn kind(&self) -> WasmTypeKind
The kind of type of this value.
Source§fn make_string(val: Cow<'_, str>) -> Self
fn make_string(val: Cow<'_, str>) -> Self
Returns a new WasmValue of the given type. Read more
Source§fn make_list(
ty: &Self::Type,
vals: impl IntoIterator<Item = Self>,
) -> Result<Self, WasmValueError>
fn make_list( ty: &Self::Type, vals: impl IntoIterator<Item = Self>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_record<'a>(
ty: &Self::Type,
fields: impl IntoIterator<Item = (&'a str, Self)>,
) -> Result<Self, WasmValueError>
fn make_record<'a>( ty: &Self::Type, fields: impl IntoIterator<Item = (&'a str, Self)>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_tuple(
ty: &Self::Type,
vals: impl IntoIterator<Item = Self>,
) -> Result<Self, WasmValueError>
fn make_tuple( ty: &Self::Type, vals: impl IntoIterator<Item = Self>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_variant(
ty: &Self::Type,
case: &str,
val: Option<Self>,
) -> Result<Self, WasmValueError>
fn make_variant( ty: &Self::Type, case: &str, val: Option<Self>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_enum(ty: &Self::Type, case: &str) -> Result<Self, WasmValueError>
fn make_enum(ty: &Self::Type, case: &str) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_option(
ty: &Self::Type,
val: Option<Self>,
) -> Result<Self, WasmValueError>
fn make_option( ty: &Self::Type, val: Option<Self>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_result(
ty: &Self::Type,
val: Result<Option<Self>, Option<Self>>,
) -> Result<Self, WasmValueError>
fn make_result( ty: &Self::Type, val: Result<Option<Self>, Option<Self>>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn make_flags<'a>(
ty: &Self::Type,
names: impl IntoIterator<Item = &'a str>,
) -> Result<Self, WasmValueError>
fn make_flags<'a>( ty: &Self::Type, names: impl IntoIterator<Item = &'a str>, ) -> Result<Self, WasmValueError>
Returns a new WasmValue of the given type. Read more
Source§fn unwrap_bool(&self) -> bool
fn unwrap_bool(&self) -> bool
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_s8(&self) -> i8
fn unwrap_s8(&self) -> i8
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_s16(&self) -> i16
fn unwrap_s16(&self) -> i16
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_s32(&self) -> i32
fn unwrap_s32(&self) -> i32
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_s64(&self) -> i64
fn unwrap_s64(&self) -> i64
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_u8(&self) -> u8
fn unwrap_u8(&self) -> u8
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_u16(&self) -> u16
fn unwrap_u16(&self) -> u16
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_u32(&self) -> u32
fn unwrap_u32(&self) -> u32
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_u64(&self) -> u64
fn unwrap_u64(&self) -> u64
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_f32(&self) -> f32
fn unwrap_f32(&self) -> f32
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_f64(&self) -> f64
fn unwrap_f64(&self) -> f64
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_char(&self) -> char
fn unwrap_char(&self) -> char
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_string(&self) -> Cow<'_, str>
fn unwrap_string(&self) -> Cow<'_, str>
Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
Source§fn unwrap_list(&self) -> Box<dyn Iterator<Item = Cow<'_, Self>> + '_>
fn unwrap_list(&self) -> Box<dyn Iterator<Item = Cow<'_, Self>> + '_>
Returns an iterator of the element Vals of the list. Read more
Source§fn unwrap_record(
&self,
) -> Box<dyn Iterator<Item = (Cow<'_, str>, Cow<'_, Self>)> + '_>
fn unwrap_record( &self, ) -> Box<dyn Iterator<Item = (Cow<'_, str>, Cow<'_, Self>)> + '_>
Returns an iterator of the field names and Vals of the record. Read more
Source§fn unwrap_tuple(&self) -> Box<dyn Iterator<Item = Cow<'_, Self>> + '_>
fn unwrap_tuple(&self) -> Box<dyn Iterator<Item = Cow<'_, Self>> + '_>
Returns an iterator of the field Vals of the tuple. Read more
Source§fn unwrap_variant(&self) -> (Cow<'_, str>, Option<Cow<'_, Self>>)
fn unwrap_variant(&self) -> (Cow<'_, str>, Option<Cow<'_, Self>>)
Returns the variant case name and optional payload WasmValue of the variant. Read more
impl IsObjectType for ValueAndType
impl StructuralPartialEq for ValueAndType
Auto Trait Implementations§
impl Freeze for ValueAndType
impl RefUnwindSafe for ValueAndType
impl Send for ValueAndType
impl Sync for ValueAndType
impl Unpin for ValueAndType
impl UnwindSafe for ValueAndType
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more