Enum valence_text::TextContent

source ·
pub enum TextContent {
    Text {
        text: Cow<'static, str>,
    },
    Translate {
        translate: Cow<'static, str>,
        with: Vec<Text>,
    },
    ScoreboardValue {
        score: ScoreboardValueContent,
    },
    EntityNames {
        selector: Cow<'static, str>,
        separator: Option<Text>,
    },
    Keybind {
        keybind: Cow<'static, str>,
    },
    BlockNbt {
        block: Cow<'static, str>,
        nbt: Cow<'static, str>,
        interpret: Option<bool>,
        separator: Option<Text>,
    },
    EntityNbt {
        entity: Cow<'static, str>,
        nbt: Cow<'static, str>,
        interpret: Option<bool>,
        separator: Option<Text>,
    },
    StorageNbt {
        storage: Ident<Cow<'static, str>>,
        nbt: Cow<'static, str>,
        interpret: Option<bool>,
        separator: Option<Text>,
    },
}
Expand description

The text content of a Text object.

Variants§

§

Text

Normal text

Fields

§text: Cow<'static, str>
§

Translate

A piece of text that will be translated on the client based on the client language. If no corresponding translation can be found, the identifier itself is used as the translated text.

Fields

§translate: Cow<'static, str>

A translation identifier, corresponding to the identifiers found in loaded language files.

§with: Vec<Text>

Optional list of text components to be inserted into slots in the translation text. Ignored if translate is not present.

§

ScoreboardValue

Displays a score holder’s current score in an objective.

§

EntityNames

Displays the name of one or more entities found by a selector.

Fields

§selector: Cow<'static, str>

A string containing a selector.

§separator: Option<Text>

An optional custom separator used when the selector returns multiple entities. Defaults to the “, “ text with gray color.

§

Keybind

Displays the name of the button that is currently bound to a certain configurable control on the client.

Fields

§keybind: Cow<'static, str>

A keybind identifier, to be displayed as the name of the button that is currently bound to that action.

§

BlockNbt

Displays NBT values from block entities.

Fields

§block: Cow<'static, str>
§nbt: Cow<'static, str>
§interpret: Option<bool>
§separator: Option<Text>
§

EntityNbt

Displays NBT values from entities.

Fields

§entity: Cow<'static, str>
§nbt: Cow<'static, str>
§interpret: Option<bool>
§separator: Option<Text>
§

StorageNbt

Displays NBT values from command storage.

Fields

§storage: Ident<Cow<'static, str>>
§nbt: Cow<'static, str>
§interpret: Option<bool>
§separator: Option<Text>

Trait Implementations§

source§

impl Clone for TextContent

source§

fn clone(&self) -> TextContent

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TextContent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for TextContent

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for TextContent

source§

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 PartialEq for TextContent

source§

fn eq(&self, other: &TextContent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for TextContent

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for TextContent

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,