mirror of
https://github.com/italicsjenga/valence.git
synced 2025-01-26 05:26:34 +11:00
Tweak text.rs
This commit is contained in:
parent
a997820b7a
commit
f35d8e7b13
1 changed files with 3 additions and 4 deletions
|
@ -24,7 +24,7 @@ use crate::Identifier;
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// With [`TextFormat`] in scope, you can write the following:
|
/// With [`TextFormat`] in scope, you can write the following:
|
||||||
/// ```
|
/// ```
|
||||||
/// use server::text::{Color, Text, TextFormat};
|
/// use valence::text::{Color, Text, TextFormat};
|
||||||
///
|
///
|
||||||
/// let txt = "The text is ".into_text()
|
/// let txt = "The text is ".into_text()
|
||||||
/// + "Red".color(Color::RED)
|
/// + "Red".color(Color::RED)
|
||||||
|
@ -42,6 +42,7 @@ use crate::Identifier;
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, PartialEq, Default, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Default, Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Text {
|
pub struct Text {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
content: TextContent,
|
content: TextContent,
|
||||||
|
@ -70,11 +71,9 @@ pub struct Text {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
insertion: Option<Cow<'static, str>>,
|
insertion: Option<Cow<'static, str>>,
|
||||||
|
|
||||||
#[serde(rename = "clickEvent")]
|
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
click_event: Option<ClickEvent>,
|
click_event: Option<ClickEvent>,
|
||||||
|
|
||||||
#[serde(rename = "hoverEvent")]
|
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
hover_event: Option<HoverEvent>,
|
hover_event: Option<HoverEvent>,
|
||||||
|
|
||||||
|
@ -284,7 +283,7 @@ enum TextContent {
|
||||||
// TODO: nbt
|
// TODO: nbt
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
pub struct Color {
|
pub struct Color {
|
||||||
pub r: u8,
|
pub r: u8,
|
||||||
pub g: u8,
|
pub g: u8,
|
||||||
|
|
Loading…
Add table
Reference in a new issue