aboutsummaryrefslogtreecommitdiff
path: root/azalea-chat/src/component.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-chat/src/component.rs')
-rwxr-xr-xazalea-chat/src/component.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs
index 882a521a..9362a66b 100755
--- a/azalea-chat/src/component.rs
+++ b/azalea-chat/src/component.rs
@@ -13,7 +13,7 @@ use std::{
};
/// A chat component, basically anything you can see in chat.
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, PartialEq)]
pub enum Component {
Text(TextComponent),
Translatable(TranslatableComponent),
@@ -63,13 +63,14 @@ impl Component {
///
/// ```rust
/// use azalea_chat::Component;
+ /// use serde::de::Deserialize;
///
/// let component = Component::deserialize(&serde_json::json!({
/// "text": "Hello, world!",
/// "color": "red",
/// })).unwrap();
///
- /// println!("{}", component.to_ansi());
+ /// println!("{}", component.to_ansi(None));
/// ```
pub fn to_ansi(&self, default_style: Option<&Style>) -> String {
// default the default_style to white if it's not set