Enum minecraft_json::minecraft::text::StringLike [−][src]
Expand description
A string containing plain text to display directly. Can also be a number or boolean that is displayed directly.
use std::str::FromStr; assert_equiv!(r#""some text""#, StringLike::String("some text".to_string())); assert_equiv!(r#"42"#, StringLike::Number(serde_json::Number::from(42))); assert_equiv!(r#"1.9E10"#, StringLike::Number(serde_json::Number::from_str("1.9E10").unwrap())); assert_equiv!("true", StringLike::Boolean(true));
Variants
Boolean(bool)
A boolean is converted to a string (“true” or “false”) to display directly.
This is the same as an object that only has a text
tag.
For example, true
, "true"
, and {"text": "true"}
are equivalent.
Number(Number)
A number is converted to a string to display directly.
This is the same as an object that only has a text
tag.
For example, 1.9E10
, "1.9E10"
, and {"text": "1.9E10"}
are equivalent.
String(String)
A string containing plain text to display directly.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.