Use SmolStr for text field in KeyPressed event
This commit is contained in:
parent
64d1ce5532
commit
03f5a351c3
4 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::keyboard::{Key, Location, Modifiers};
|
||||
use crate::SmolStr;
|
||||
|
||||
/// A keyboard event.
|
||||
///
|
||||
|
|
@ -20,7 +21,7 @@ pub enum Event {
|
|||
modifiers: Modifiers,
|
||||
|
||||
/// The text produced by the key press, if any.
|
||||
text: Option<String>,
|
||||
text: Option<SmolStr>,
|
||||
},
|
||||
|
||||
/// A keyboard key was released.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Identify keyboard keys.
|
||||
use smol_str::SmolStr;
|
||||
use crate::SmolStr;
|
||||
|
||||
/// A key on the keyboard.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -75,3 +75,5 @@ pub use size::Size;
|
|||
pub use text::Text;
|
||||
pub use vector::Vector;
|
||||
pub use widget::Widget;
|
||||
|
||||
pub use smol_str::SmolStr;
|
||||
|
|
|
|||
|
|
@ -225,9 +225,7 @@ pub fn window_event(
|
|||
key,
|
||||
modifiers,
|
||||
location,
|
||||
text: text
|
||||
.as_ref()
|
||||
.map(winit::keyboard::SmolStr::to_string),
|
||||
text,
|
||||
}
|
||||
}
|
||||
winit::event::ElementState::Released => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue