#[non_exhaustive]pub struct Style {
pub color: Option<TextColor>,
pub shadow_color: Option<u32>,
pub bold: Option<bool>,
pub italic: Option<bool>,
pub underlined: Option<bool>,
pub strikethrough: Option<bool>,
pub obfuscated: Option<bool>,
pub click_event: Option<ClickEvent>,
pub hover_event: Option<HoverEvent>,
pub insertion: Option<String>,
pub font: Option<String>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.color: Option<TextColor>§shadow_color: Option<u32>§bold: Option<bool>§italic: Option<bool>§underlined: Option<bool>§strikethrough: Option<bool>§obfuscated: Option<bool>§click_event: Option<ClickEvent>§hover_event: Option<HoverEvent>§insertion: Option<String>§font: Option<String>Represented as an Identifier.
Implementations§
Source§impl Style
impl Style
pub fn color(self, value: impl Into<Option<TextColor>>) -> Style
pub fn shadow_color(self, value: impl Into<Option<u32>>) -> Style
pub fn bold(self, value: impl Into<Option<bool>>) -> Style
pub fn italic(self, value: impl Into<Option<bool>>) -> Style
pub fn underlined(self, value: impl Into<Option<bool>>) -> Style
pub fn strikethrough(self, value: impl Into<Option<bool>>) -> Style
pub fn obfuscated(self, value: impl Into<Option<bool>>) -> Style
pub fn click_event(self, value: impl Into<Option<ClickEvent>>) -> Style
pub fn hover_event(self, value: impl Into<Option<HoverEvent>>) -> Style
pub fn insertion(self, value: impl Into<Option<String>>) -> Style
pub fn font(self, value: impl Into<Option<String>>) -> Style
pub fn serialize_map<S>(
&self,
state: &mut <S as Serializer>::SerializeMap,
) -> Result<(), <S as Serializer>::Error>where
S: Serializer,
Source§impl Style
impl Style
pub fn new() -> Style
pub fn empty() -> Style
pub fn deserialize(json: &Value) -> Style
Sourcepub fn compare_ansi(&self, after: &Style) -> String
pub fn compare_ansi(&self, after: &Style) -> String
find the necessary ansi code to get from this style to another
Sourcepub fn merged_with(&self, other: &Style) -> Style
pub fn merged_with(&self, other: &Style) -> Style
Returns a new style that is a merge of self and other.
For any field that other does not specify (is None), self’s value is
used.
Sourcepub fn apply_formatting(&mut self, formatting: &ChatFormatting)
pub fn apply_formatting(&mut self, formatting: &ChatFormatting)
Apply a ChatFormatting to this style
pub fn get_html_style(&self) -> String
Trait Implementations§
Source§impl Serialize for Style
impl Serialize for Style
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 Style
Available on crate feature simdnbt only.
impl Serialize for Style
Available on crate feature
simdnbt only.fn to_compound(self) -> NbtCompound
fn to_nbt(self) -> BaseNbt
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
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> FromNbtTag for Twhere
T: Deserialize,
impl<T> FromNbtTag for Twhere
T: Deserialize,
fn from_nbt_tag(tag: NbtTag<'_, '_>) -> Option<T>
fn from_optional_nbt_tag( tag: Option<NbtTag<'_, '_>>, ) -> Result<Option<Self>, DeserializeError>
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§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> 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.