pub struct TranslatableComponent {
pub base: BaseComponent,
pub key: String,
pub fallback: Option<String>,
pub args: Vec<PrimitiveOrComponent>,
}Expand description
A message whose content depends on the client’s language.
Fields§
§base: BaseComponent§key: String§fallback: Option<String>§args: Vec<PrimitiveOrComponent>Implementations§
Source§impl TranslatableComponent
impl TranslatableComponent
pub fn new( key: String, args: Vec<PrimitiveOrComponent>, ) -> TranslatableComponent
pub fn with_fallback( key: String, fallback: Option<String>, args: Vec<PrimitiveOrComponent>, ) -> TranslatableComponent
Sourcepub fn read(&self) -> Result<TextComponent, Error>
pub fn read(&self) -> Result<TextComponent, Error>
Convert the key and args to a FormattedText.
Trait Implementations§
Source§impl Clone for TranslatableComponent
impl Clone for TranslatableComponent
Source§fn clone(&self) -> TranslatableComponent
fn clone(&self) -> TranslatableComponent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TranslatableComponent
impl Debug for TranslatableComponent
Source§impl Display for TranslatableComponent
impl Display for TranslatableComponent
Source§impl From<&str> for TranslatableComponent
impl From<&str> for TranslatableComponent
Source§fn from(s: &str) -> TranslatableComponent
fn from(s: &str) -> TranslatableComponent
Converts to this type from the input type.
Source§impl From<TranslatableComponent> for FormattedText
impl From<TranslatableComponent> for FormattedText
Source§fn from(c: TranslatableComponent) -> FormattedText
fn from(c: TranslatableComponent) -> FormattedText
Converts to this type from the input type.
Source§impl PartialEq for TranslatableComponent
impl PartialEq for TranslatableComponent
Source§fn eq(&self, other: &TranslatableComponent) -> bool
fn eq(&self, other: &TranslatableComponent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for TranslatableComponent
impl Serialize for TranslatableComponent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl Serialize for TranslatableComponent
Available on crate feature simdnbt only.
impl Serialize for TranslatableComponent
Available on crate feature
simdnbt only.fn to_compound(self) -> NbtCompound
fn to_nbt(self) -> BaseNbt
impl StructuralPartialEq for TranslatableComponent
Auto Trait Implementations§
impl Freeze for TranslatableComponent
impl RefUnwindSafe for TranslatableComponent
impl Send for TranslatableComponent
impl Sync for TranslatableComponent
impl Unpin for TranslatableComponent
impl UnsafeUnpin for TranslatableComponent
impl UnwindSafe for TranslatableComponent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of [
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [
CompactString]. Read more§impl<T> ToNbtTag for Twhere
T: Serialize,
impl<T> ToNbtTag for Twhere
T: Serialize,
fn to_nbt_tag(self) -> NbtTag
fn to_optional_nbt_tag(self) -> Option<NbtTag>
§impl<T> TypeData for T
impl<T> TypeData for T
§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of this value.