зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-08 08:25:51 +03:00
Make Input serializable
Этот коммит содержится в:
@@ -7,6 +7,8 @@ mod termwiz;
|
|||||||
|
|
||||||
#[cfg(feature = "arbitrary")]
|
#[cfg(feature = "arbitrary")]
|
||||||
use arbitrary::Arbitrary;
|
use arbitrary::Arbitrary;
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Backend-agnostic key input kind.
|
/// Backend-agnostic key input kind.
|
||||||
///
|
///
|
||||||
@@ -14,6 +16,7 @@ use arbitrary::Arbitrary;
|
|||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
|
||||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub enum Key {
|
pub enum Key {
|
||||||
/// Normal letter key input
|
/// Normal letter key input
|
||||||
Char(char),
|
Char(char),
|
||||||
@@ -102,6 +105,7 @@ impl Default for Key {
|
|||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Clone, Default, PartialEq, Hash)]
|
#[derive(Debug, Clone, Default, PartialEq, Hash)]
|
||||||
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
/// Typed key.
|
/// Typed key.
|
||||||
pub key: Key,
|
pub key: Key,
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user