pub enum SimpleValue {
Bool(bool),
Number(Number),
Text(CompactString),
Image(Image),
Audio(Audio),
List(Vec<SimpleValue>),
}
Variants§
Implementations§
Source§impl SimpleValue
impl SimpleValue
Sourcepub fn into_json<C: CustomTypes<S>, S: System<C>>(
self,
) -> Result<Json, IntoJsonError<C, S>>
pub fn into_json<C: CustomTypes<S>, S: System<C>>( self, ) -> Result<Json, IntoJsonError<C, S>>
Converts this SimpleValue
into its equivalent JSON form.
Note that SimpleValue::Image
and SimpleValue::Audio
cannot be encoded as standard JSON;
for this, you may instead use SimpleValue::into_netsblox_json
.
Sourcepub fn from_json(value: Json) -> Result<Self, FromJsonError>
pub fn from_json(value: Json) -> Result<Self, FromJsonError>
Converts a JSON object into its equivalent SimpleValue
.
Note that SimpleValue::Image
and SimpleValue::Audio
cannot be decoded from standard JSON;
for this, you may instead use SimpleValue::from_netsblox_json
.
Sourcepub fn into_netsblox_json(self) -> Json
pub fn into_netsblox_json(self) -> Json
Converts this SimpleValue
into an encoded JSON equivalent suitable for communication with NetsBlox.
Sourcepub fn from_netsblox_json(value: Json) -> Result<Self, FromNetsBloxJsonError>
pub fn from_netsblox_json(value: Json) -> Result<Self, FromNetsBloxJsonError>
Converts a JSON object returned from NetsBlox into its equivalent SimpleValue
form.
Sourcepub fn parse_number(s: &str) -> Option<Number>
pub fn parse_number(s: &str) -> Option<Number>
Parses a string into a number just as the runtime would do natively.
Sourcepub fn stringify_number(v: Number) -> Text
pub fn stringify_number(v: Number) -> Text
Stringifies a number just as the runtime would do natively.
Trait Implementations§
Source§impl Clone for SimpleValue
impl Clone for SimpleValue
Source§fn clone(&self) -> SimpleValue
fn clone(&self) -> SimpleValue
Returns a copy 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 SimpleValue
impl Debug for SimpleValue
Source§impl From<Audio> for SimpleValue
impl From<Audio> for SimpleValue
Source§impl From<CheckedFloat<f64, NumberChecker>> for SimpleValue
impl From<CheckedFloat<f64, NumberChecker>> for SimpleValue
Source§impl From<CompactString> for SimpleValue
impl From<CompactString> for SimpleValue
Source§fn from(x: CompactString) -> Self
fn from(x: CompactString) -> Self
Converts to this type from the input type.
Source§impl From<Image> for SimpleValue
impl From<Image> for SimpleValue
Source§impl From<String> for SimpleValue
impl From<String> for SimpleValue
Source§impl From<Vec<SimpleValue>> for SimpleValue
impl From<Vec<SimpleValue>> for SimpleValue
Source§fn from(x: Vec<SimpleValue>) -> Self
fn from(x: Vec<SimpleValue>) -> Self
Converts to this type from the input type.
Source§impl From<bool> for SimpleValue
impl From<bool> for SimpleValue
Source§impl PartialEq for SimpleValue
impl PartialEq for SimpleValue
impl Eq for SimpleValue
impl StructuralPartialEq for SimpleValue
Auto Trait Implementations§
impl Freeze for SimpleValue
impl RefUnwindSafe for SimpleValue
impl Send for SimpleValue
impl Sync for SimpleValue
impl Unpin for SimpleValue
impl UnwindSafe for SimpleValue
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