Merge branch 'add-serde' into 'master'

1.6.0 - add optional serde implementations

See merge request redox-os/termion!176
This commit is contained in:
Jeremy Soller 2022-10-21 06:55:35 +00:00
commit 583bb40f32
3 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "termion"
version = "1.5.6"
version = "1.6.0"
authors = ["ticki <Ticki@users.noreply.github.com>", "gycos <alexandre.bury@gmail.com>", "IGI-111 <igi-111@protonmail.com>"]
description = "A bindless library for manipulating terminals."
repository = "https://gitlab.redox-os.org/redox-os/termion"
@ -11,6 +11,7 @@ exclude = ["target", "CHANGELOG.md", "image.png", "Cargo.lock"]
[dependencies]
numtoa = { version = "0.1", features = ["std"]}
serde = { version = "1.0", features = ["derive"], optional = true }
[target.'cfg(not(target_os = "redox"))'.dependencies]
libc = "0.2"

View File

@ -1,9 +1,13 @@
//! Mouse and key events.
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::io::{Error, ErrorKind};
use std::str;
/// An event reported by the terminal.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Event {
/// A key press.
@ -15,6 +19,7 @@ pub enum Event {
}
/// A mouse related event.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum MouseEvent {
/// A mouse button was pressed.
@ -32,6 +37,7 @@ pub enum MouseEvent {
}
/// A mouse button.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum MouseButton {
/// The left mouse button.
@ -51,6 +57,7 @@ pub enum MouseButton {
}
/// A key.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Key {
/// Backspace.

View File

@ -12,6 +12,8 @@
#![warn(missing_docs)]
extern crate numtoa;
#[cfg(feature = "serde")]
extern crate serde;
#[cfg(target_os = "redox")]
#[path="sys/redox/mod.rs"]