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.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs
index e4c0ab72..882a521a 100755
--- a/azalea-chat/src/component.rs
+++ b/azalea-chat/src/component.rs
@@ -1,17 +1,16 @@
-use std::{
- fmt::Display,
- io::{Cursor, Write},
-};
-
-use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
-use serde::{de, Deserialize, Deserializer};
-
use crate::{
base_component::BaseComponent,
style::{ChatFormatting, Style},
text_component::TextComponent,
translatable_component::{StringOrComponent, TranslatableComponent},
};
+use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
+use once_cell::sync::Lazy;
+use serde::{de, Deserialize, Deserializer};
+use std::{
+ fmt::Display,
+ io::{Cursor, Write},
+};
/// A chat component, basically anything you can see in chat.
#[derive(Clone, Debug)]
@@ -20,12 +19,10 @@ pub enum Component {
Translatable(TranslatableComponent),
}
-lazy_static! {
- pub static ref DEFAULT_STYLE: Style = Style {
- color: Some(ChatFormatting::White.try_into().unwrap()),
- ..Style::default()
- };
-}
+pub static DEFAULT_STYLE: Lazy<Style> = Lazy::new(|| Style {
+ color: Some(ChatFormatting::White.try_into().unwrap()),
+ ..Style::default()
+});
/// A chat component
impl Component {