pub enum Value {
Show 22 variants
usize(usize),
u8(u8),
u16(u16),
u32(u32),
u64(u64),
u128(u128),
i8(i8),
i16(i16),
i32(i32),
i64(i64),
i128(i128),
bool(bool),
char(char),
f32(f32),
f64(f64),
String(String),
StructValue(Box<StructValue>),
EnumValue(Box<EnumValue>),
TupleStructValue(TupleStructValue),
TupleValue(TupleValue),
List(Vec<Value>),
Map(BTreeMap<Value, Value>),
}
Expand description
A type erased value type.
Constructed with Reflect::to_value
.
Variants§
usize(usize)
u8(u8)
u16(u16)
u32(u32)
u64(u64)
u128(u128)
i8(i8)
i16(i16)
i32(i32)
i64(i64)
i128(i128)
bool(bool)
char(char)
f32(f32)
f64(f64)
String(String)
StructValue(Box<StructValue>)
EnumValue(Box<EnumValue>)
TupleStructValue(TupleStructValue)
TupleValue(TupleValue)
List(Vec<Value>)
Map(BTreeMap<Value, Value>)
Trait Implementations§
Source§impl DescribeType for Value
impl DescribeType for Value
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ColorRgba8> for Value
Available on crate feature macaw
only.
impl From<ColorRgba8> for Value
Available on crate feature
macaw
only.Source§fn from(data: ColorRgba8) -> Value
fn from(data: ColorRgba8) -> Value
Converts to this type from the input type.
Source§impl From<Infallible> for Value
impl From<Infallible> for Value
Source§fn from(value: Infallible) -> Value
fn from(value: Infallible) -> Value
Converts to this type from the input type.
Source§impl From<NonZero<i128>> for Value
impl From<NonZero<i128>> for Value
Source§fn from(n: NonZeroI128) -> Self
fn from(n: NonZeroI128) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<i16>> for Value
impl From<NonZero<i16>> for Value
Source§fn from(n: NonZeroI16) -> Self
fn from(n: NonZeroI16) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<i32>> for Value
impl From<NonZero<i32>> for Value
Source§fn from(n: NonZeroI32) -> Self
fn from(n: NonZeroI32) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<i64>> for Value
impl From<NonZero<i64>> for Value
Source§fn from(n: NonZeroI64) -> Self
fn from(n: NonZeroI64) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<u128>> for Value
impl From<NonZero<u128>> for Value
Source§fn from(n: NonZeroU128) -> Self
fn from(n: NonZeroU128) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<u16>> for Value
impl From<NonZero<u16>> for Value
Source§fn from(n: NonZeroU16) -> Self
fn from(n: NonZeroU16) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<u32>> for Value
impl From<NonZero<u32>> for Value
Source§fn from(n: NonZeroU32) -> Self
fn from(n: NonZeroU32) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<u64>> for Value
impl From<NonZero<u64>> for Value
Source§fn from(n: NonZeroU64) -> Self
fn from(n: NonZeroU64) -> Self
Converts to this type from the input type.
Source§impl From<NonZero<usize>> for Value
impl From<NonZero<usize>> for Value
Source§fn from(n: NonZeroUsize) -> Self
fn from(n: NonZeroUsize) -> Self
Converts to this type from the input type.
Source§impl<T> From<Option<T>> for Valuewhere
T: FromReflect + DescribeType,
impl<T> From<Option<T>> for Valuewhere
T: FromReflect + DescribeType,
Source§impl<Idx> From<Range<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
impl<Idx> From<Range<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
Source§impl<Idx> From<RangeFrom<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
impl<Idx> From<RangeFrom<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
Source§impl<Idx> From<RangeTo<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
impl<Idx> From<RangeTo<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
Source§impl<Idx> From<RangeToInclusive<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
impl<Idx> From<RangeToInclusive<Idx>> for Valuewhere
Idx: FromReflect + DescribeType,
Source§fn from(data: RangeToInclusive<Idx>) -> Value
fn from(data: RangeToInclusive<Idx>) -> Value
Converts to this type from the input type.
Source§impl From<StructValue> for Value
impl From<StructValue> for Value
Source§fn from(value: StructValue) -> Self
fn from(value: StructValue) -> Self
Converts to this type from the input type.
Source§impl From<TupleStructValue> for Value
impl From<TupleStructValue> for Value
Source§fn from(value: TupleStructValue) -> Self
fn from(value: TupleStructValue) -> Self
Converts to this type from the input type.
Source§impl From<TupleValue> for Value
impl From<TupleValue> for Value
Source§fn from(value: TupleValue) -> Self
fn from(value: TupleValue) -> Self
Converts to this type from the input type.
Source§impl FromReflect for Value
impl FromReflect for Value
fn from_reflect(reflect: &dyn Reflect) -> Option<Self>
Source§impl Ord for Value
impl Ord for Value
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl<'a_, C_: Context> Readable<'a_, C_> for Value
impl<'a_, C_: Context> Readable<'a_, C_> for Value
fn read_from<R_: Reader<'a_, C_>>(_reader_: &mut R_) -> Result<Self, C_::Error>
fn minimum_bytes_needed() -> usize
Source§fn read_from_buffer(buffer: &'a [u8]) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn read_from_buffer(buffer: &'a [u8]) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
Deserializes from a given buffer. Read more
Source§fn read_with_length_from_buffer(
buffer: &'a [u8],
) -> (Result<Self, <C as Context>::Error>, usize)where
Self: DefaultContext<Context = C>,
C: Default,
fn read_with_length_from_buffer(
buffer: &'a [u8],
) -> (Result<Self, <C as Context>::Error>, usize)where
Self: DefaultContext<Context = C>,
C: Default,
Deserializes from a given buffer while also returning the amount of bytes consumed. Read more
Source§fn read_from_buffer_copying_data(
buffer: &[u8],
) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn read_from_buffer_copying_data(
buffer: &[u8],
) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
Deserializes from a given buffer. Read more
Source§fn read_with_length_from_buffer_copying_data(
buffer: &[u8],
) -> (Result<Self, <C as Context>::Error>, usize)where
Self: DefaultContext<Context = C>,
C: Default,
fn read_with_length_from_buffer_copying_data(
buffer: &[u8],
) -> (Result<Self, <C as Context>::Error>, usize)where
Self: DefaultContext<Context = C>,
C: Default,
Deserializes from a given buffer while also returning the amount of bytes consumed. Read more
Source§fn read_from_stream_unbuffered(
stream: impl Read,
) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn read_from_stream_unbuffered(
stream: impl Read,
) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
Reads from a given stream without any buffering. Read more
Source§fn read_from_stream_buffered(
stream: impl Read,
) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn read_from_stream_buffered(
stream: impl Read,
) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
Reads from a given stream with internal buffering. Read more
fn read_from_file(path: impl AsRef<Path>) -> Result<Self, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn read_from_buffer_with_ctx( context: C, buffer: &'a [u8], ) -> Result<Self, <C as Context>::Error>
fn read_with_length_from_buffer_with_ctx( context: C, buffer: &'a [u8], ) -> (Result<Self, <C as Context>::Error>, usize)
fn read_from_buffer_copying_data_with_ctx( context: C, buffer: &[u8], ) -> Result<Self, <C as Context>::Error>
fn read_with_length_from_buffer_copying_data_with_ctx( context: C, buffer: &[u8], ) -> (Result<Self, <C as Context>::Error>, usize)
fn read_with_length_from_buffer_copying_data_with_ctx_mut( context: &mut C, buffer: &[u8], ) -> (Result<Self, <C as Context>::Error>, usize)
fn read_from_stream_unbuffered_with_ctx<S>(
context: C,
stream: S,
) -> Result<Self, <C as Context>::Error>where
S: Read,
fn read_from_stream_buffered_with_ctx<S>(
context: C,
stream: S,
) -> Result<Self, <C as Context>::Error>where
S: Read,
fn read_from_file_with_ctx( context: C, path: impl AsRef<Path>, ) -> Result<Self, <C as Context>::Error>
Source§impl Reflect for Value
impl Reflect for Value
fn type_descriptor(&self) -> Cow<'static, TypeDescriptor>
fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
fn as_reflect(&self) -> &dyn Reflect
fn as_reflect_mut(&mut self) -> &mut dyn Reflect
fn reflect_owned(self: Box<Self>) -> ReflectOwned
fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
fn patch(&mut self, value: &dyn Reflect)
fn to_value(&self) -> Value
fn clone_reflect(&self) -> Box<dyn Reflect>
fn debug(&self, f: &mut Formatter<'_>) -> Result
fn type_id(&self) -> TypeId
fn type_name(&self) -> &str
fn into_tuple(self: Box<Self>) -> Option<Box<dyn Tuple>>
fn as_tuple(&self) -> Option<&dyn Tuple>
fn as_tuple_mut(&mut self) -> Option<&mut dyn Tuple>
fn into_struct(self: Box<Self>) -> Option<Box<dyn Struct>>
fn as_struct(&self) -> Option<&dyn Struct>
fn as_struct_mut(&mut self) -> Option<&mut dyn Struct>
fn into_tuple_struct(self: Box<Self>) -> Option<Box<dyn TupleStruct>>
fn as_tuple_struct(&self) -> Option<&dyn TupleStruct>
fn as_tuple_struct_mut(&mut self) -> Option<&mut dyn TupleStruct>
fn into_enum(self: Box<Self>) -> Option<Box<dyn Enum>>
fn as_enum(&self) -> Option<&dyn Enum>
fn as_enum_mut(&mut self) -> Option<&mut dyn Enum>
fn into_list(self: Box<Self>) -> Option<Box<dyn List>>
fn as_list(&self) -> Option<&dyn List>
fn as_list_mut(&mut self) -> Option<&mut dyn List>
fn into_array(self: Box<Self>) -> Option<Box<dyn Array>>
fn as_array(&self) -> Option<&dyn Array>
fn as_array_mut(&mut self) -> Option<&mut dyn Array>
fn into_map(self: Box<Self>) -> Option<Box<dyn Map>>
fn as_map(&self) -> Option<&dyn Map>
fn as_map_mut(&mut self) -> Option<&mut dyn Map>
fn into_scalar(self: Box<Self>) -> Option<ScalarOwned>
fn as_scalar(&self) -> Option<ScalarRef<'_>>
fn as_scalar_mut(&mut self) -> Option<ScalarMut<'_>>
Source§impl<C_: Context> Writable<C_> for Value
impl<C_: Context> Writable<C_> for Value
fn write_to<T_: ?Sized + Writer<C_>>( &self, _writer_: &mut T_, ) -> Result<(), C_::Error>
fn write_to_buffer(
&self,
buffer: &mut [u8],
) -> Result<(), <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn write_to_vec(&self) -> Result<Vec<u8>, <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn write_to_stream<S>(&self, stream: S) -> Result<(), <C as Context>::Error>
fn write_to_file(
&self,
path: impl AsRef<Path>,
) -> Result<(), <C as Context>::Error>where
Self: DefaultContext<Context = C>,
C: Default,
fn write_to_buffer_with_ctx( &self, context: C, buffer: &mut [u8], ) -> Result<(), <C as Context>::Error>
fn write_to_buffer_with_ctx_mut( &self, context: &mut C, buffer: &mut [u8], ) -> Result<(), <C as Context>::Error>
fn write_to_vec_with_ctx( &self, context: C, ) -> Result<Vec<u8>, <C as Context>::Error>
fn write_to_vec_with_ctx_mut( &self, context: &mut C, ) -> Result<Vec<u8>, <C as Context>::Error>
fn write_to_stream_with_ctx<S>(
&self,
context: C,
stream: S,
) -> Result<(), <C as Context>::Error>where
S: Write,
fn write_to_file_with_ctx( &self, context: C, path: impl AsRef<Path>, ) -> Result<(), <C as Context>::Error>
fn bytes_needed(&self) -> Result<usize, <C as Context>::Error>
impl Eq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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