Struct TextComponent
#[repr(transparent)]pub struct TextComponent {
pub text: Text,
}Fields§
§text: TextImplementations§
§impl TextComponent
impl TextComponent
pub fn from_cow_text<'a>(cow: Cow<'a, Text>) -> Cow<'a, TextComponent>
pub fn from_cow_text<'a>(cow: Cow<'a, Text>) -> Cow<'a, TextComponent>
Zero-copy cast from a Cow<Text> to a Cow<TextComponent>.
§Safety
This is safe because TextComponent is #[repr(transparent)] wrapper
around Text.
pub fn as_text(&self) -> &Text
Trait Implementations§
§impl Clone for TextComponent
impl Clone for TextComponent
§fn clone(&self) -> TextComponent
fn clone(&self) -> TextComponent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for TextComponent
impl Debug for TextComponent
§impl Decode<'_> for TextComponent
impl Decode<'_> for TextComponent
§impl Encode for TextComponent
impl Encode for TextComponent
§impl From<Text> for TextComponent
impl From<Text> for TextComponent
§fn from(value: Text) -> TextComponent
fn from(value: Text) -> TextComponent
Converts to this type from the input type.
§impl<'a> IntoText<'a> for TextComponent
impl<'a> IntoText<'a> for TextComponent
§fn into_cow_text(self) -> Cow<'a, Text>
fn into_cow_text(self) -> Cow<'a, Text>
Converts to a
Text object, either owned or borrowed.Source§fn clear_color(self) -> Text
fn clear_color(self) -> Text
Clears the color of the text. Color of parent
Text object will be
used.Source§fn clear_font(self) -> Text
fn clear_font(self) -> Text
Clears the font of the text. Font of parent
Text object will be
used.Source§fn clear_bold(self) -> Text
fn clear_bold(self) -> Text
Clears the
bold property of the text. Property of the parent Text
object will be used.Source§fn not_italic(self) -> Text
fn not_italic(self) -> Text
Makes the text not italic.
Source§fn clear_italic(self) -> Text
fn clear_italic(self) -> Text
Clears the
italic property of the text. Property of the parent
Text object will be used.Source§fn underlined(self) -> Text
fn underlined(self) -> Text
Makes the text underlined.
Source§fn not_underlined(self) -> Text
fn not_underlined(self) -> Text
Makes the text not underlined.
Source§fn clear_underlined(self) -> Text
fn clear_underlined(self) -> Text
Clears the
underlined property of the text. Property of the parent
Text object will be used.Source§fn strikethrough(self) -> Text
fn strikethrough(self) -> Text
Adds a strikethrough effect to the text.
Source§fn not_strikethrough(self) -> Text
fn not_strikethrough(self) -> Text
Removes the strikethrough effect from the text.
Source§fn clear_strikethrough(self) -> Text
fn clear_strikethrough(self) -> Text
Clears the
strikethrough property of the text. Property of the parent
Text object will be used.Source§fn obfuscated(self) -> Text
fn obfuscated(self) -> Text
Makes the text obfuscated.
Source§fn not_obfuscated(self) -> Text
fn not_obfuscated(self) -> Text
Makes the text not obfuscated.
Source§fn clear_obfuscated(self) -> Text
fn clear_obfuscated(self) -> Text
Clears the
obfuscated property of the text. Property of the parent
Text object will be used.Source§fn insertion(self, insertion: impl Into<Cow<'static, str>>) -> Text
fn insertion(self, insertion: impl Into<Cow<'static, str>>) -> Text
Adds an
insertion property to the text. When shift-clicked, the given
text will be inserted into chat box for the client.Source§fn clear_insertion(self) -> Text
fn clear_insertion(self) -> Text
Clears the
insertion property of the text. Property of the parent
Text object will be used.Source§fn on_click_open_url(self, url: impl Into<Cow<'static, str>>) -> Text
fn on_click_open_url(self, url: impl Into<Cow<'static, str>>) -> Text
On click, opens the given URL. Has to be
http or https protocol.Source§fn on_click_run_command(self, command: impl Into<Cow<'static, str>>) -> Text
fn on_click_run_command(self, command: impl Into<Cow<'static, str>>) -> Text
On click, sends a command. Doesn’t actually have to be a command, can be
a simple chat message.
Source§fn on_click_suggest_command(self, command: impl Into<Cow<'static, str>>) -> Text
fn on_click_suggest_command(self, command: impl Into<Cow<'static, str>>) -> Text
On click, copies the given text to the chat box.
Source§fn on_click_change_page(self, page: impl Into<i32>) -> Text
fn on_click_change_page(self, page: impl Into<i32>) -> Text
On click, turns the page of the opened book to the given number.
Indexing starts at
1.Source§fn on_click_copy_to_clipboard(self, text: impl Into<Cow<'static, str>>) -> Text
fn on_click_copy_to_clipboard(self, text: impl Into<Cow<'static, str>>) -> Text
On click, copies the given text to clipboard.
Source§fn clear_click_event(self) -> Text
fn clear_click_event(self) -> Text
Clears the
click_event property of the text. Property of the parent
Text object will be used.Source§fn on_hover_show_text(self, text: impl IntoText<'static>) -> Text
fn on_hover_show_text(self, text: impl IntoText<'static>) -> Text
On mouse hover, shows the given text in a tooltip.
Source§fn clear_hover_event(self) -> Text
fn clear_hover_event(self) -> Text
Clears the
hover_event property of the text. Property of the parent
Text object will be used.§impl PartialEq for TextComponent
impl PartialEq for TextComponent
impl StructuralPartialEq for TextComponent
Auto Trait Implementations§
impl Freeze for TextComponent
impl RefUnwindSafe for TextComponent
impl Send for TextComponent
impl Sync for TextComponent
impl Unpin for TextComponent
impl UnwindSafe for TextComponent
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> 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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.