Enum minecraft_json::minecraft::text::StringLike[][src]

pub enum StringLike {
    Boolean(bool),
    Number(Number),
    String(String),
}
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

Formats the value using the given formatter. Read more

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 !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.