diff options
| author | mat <github@matdoes.dev> | 2022-10-21 22:30:19 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-10-21 22:30:19 -0500 |
| commit | 3fbbe5e93d0f7dbd828e8f071d7bfd092d4b2896 (patch) | |
| tree | 16901a63abd8eb6a34d6ee880178102778ae6ac3 /azalea-chat/src/component.rs | |
| parent | 6924502bc43e707008d156e892b2fd15b56cbb1b (diff) | |
| download | azalea-drasl-3fbbe5e93d0f7dbd828e8f071d7bfd092d4b2896.tar.xz | |
have Display implemented for the Components
Diffstat (limited to 'azalea-chat/src/component.rs')
| -rwxr-xr-x | azalea-chat/src/component.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index 81224d9f..12df03cd 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -267,16 +267,9 @@ impl From<String> for Component { impl Display for Component { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - // this contains the final string will all the ansi escape codes - for component in self.clone().into_iter() { - let component_text = match &component { - Self::Text(c) => c.text.to_string(), - Self::Translatable(c) => c.to_string(), - }; - - f.write_str(&component_text)?; + match self { + Component::Text(c) => c.fmt(f), + Component::Translatable(c) => c.fmt(f), } - - Ok(()) } } |
