Avoid extra text allocations in websocket example

This commit is contained in:
Héctor Ramón Jiménez 2024-04-02 09:29:16 +02:00
parent dee43d5f66
commit 488cac7148
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 18 additions and 9 deletions

View file

@ -2,7 +2,7 @@ mod echo;
use iced::alignment::{self, Alignment};
use iced::widget::{
button, column, container, row, scrollable, text, text_input, value,
button, column, container, row, scrollable, text, text_input,
};
use iced::{color, Command, Element, Length, Subscription};
use once_cell::sync::Lazy;
@ -96,7 +96,7 @@ impl WebSocket {
.into()
} else {
scrollable(
column(self.messages.iter().map(value).map(Element::from))
column(self.messages.iter().map(text).map(Element::from))
.spacing(10),
)
.id(MESSAGE_LOG.clone())