1.6.0 - add optional serde implementations
This commit is contained in:
parent
dce5e7500f
commit
f094c38d18
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "termion"
|
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>"]
|
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."
|
description = "A bindless library for manipulating terminals."
|
||||||
repository = "https://gitlab.redox-os.org/redox-os/termion"
|
repository = "https://gitlab.redox-os.org/redox-os/termion"
|
||||||
|
@ -11,6 +11,7 @@ exclude = ["target", "CHANGELOG.md", "image.png", "Cargo.lock"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
numtoa = { version = "0.1", features = ["std"]}
|
numtoa = { version = "0.1", features = ["std"]}
|
||||||
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "redox"))'.dependencies]
|
[target.'cfg(not(target_os = "redox"))'.dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
//! Mouse and key events.
|
//! Mouse and key events.
|
||||||
|
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
/// An event reported by the terminal.
|
/// An event reported by the terminal.
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
/// A key press.
|
/// A key press.
|
||||||
|
@ -15,6 +19,7 @@ pub enum Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A mouse related event.
|
/// A mouse related event.
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum MouseEvent {
|
pub enum MouseEvent {
|
||||||
/// A mouse button was pressed.
|
/// A mouse button was pressed.
|
||||||
|
@ -32,6 +37,7 @@ pub enum MouseEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A mouse button.
|
/// A mouse button.
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum MouseButton {
|
pub enum MouseButton {
|
||||||
/// The left mouse button.
|
/// The left mouse button.
|
||||||
|
@ -51,6 +57,7 @@ pub enum MouseButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A key.
|
/// A key.
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum Key {
|
pub enum Key {
|
||||||
/// Backspace.
|
/// Backspace.
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
extern crate numtoa;
|
extern crate numtoa;
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
|
extern crate serde;
|
||||||
|
|
||||||
#[cfg(target_os = "redox")]
|
#[cfg(target_os = "redox")]
|
||||||
#[path="sys/redox/mod.rs"]
|
#[path="sys/redox/mod.rs"]
|
||||||
|
|
Loading…
Reference in New Issue