From 9539b2ad763c78ff9afa05b8d6585df039c54e36 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 20 Apr 2021 04:09:12 +0200 Subject: [PATCH] add serde --- nested/Cargo.toml | 4 ++-- nested/src/lib.rs | 35 +++++++++++++++++++++++++++++++++++ nested/src/terminal/atom.rs | 8 +++++--- nested/src/terminal/style.rs | 3 ++- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/nested/Cargo.toml b/nested/Cargo.toml index 4bd049b..d8a83d0 100644 --- a/nested/Cargo.toml +++ b/nested/Cargo.toml @@ -1,4 +1,3 @@ - [package] authors = ["Michael Sippel "] edition = "2018" @@ -7,10 +6,11 @@ version = "0.1.0" [dependencies] no_deadlocks = "*" -cgmath = "0.17.0" +cgmath = { version = "0.18.0", features = ["serde"] } termion = "1.5.5" signal-hook = "0.3.1" signal-hook-async-std = "0.2.0" +serde = { version = "1.0", features = ["derive"] } [dependencies.async-std] version = "1.7.0" diff --git a/nested/src/lib.rs b/nested/src/lib.rs index 66e9d4e..abee199 100644 --- a/nested/src/lib.rs +++ b/nested/src/lib.rs @@ -1,3 +1,38 @@ +#![feature(trait_alias)] + +pub mod core; +pub mod index; +pub mod grid; +pub mod sequence; +pub mod singleton; +pub mod terminal; +pub mod projection; +pub mod string_editor; +pub mod leveled_term_view; + +/* maybe? +pub use { + cgmath::{Vector2, Point2}, + termion::event::{Event, Key}, + crate::{ + core::{View, Observer, ObserverExt, ObserverBroadcast, ViewPort, OuterViewPort}, + index::{ImplIndexView}, + terminal::{ + TerminalView, + TerminalAtom, + TerminalStyle, + TerminalEvent, + Terminal, + TerminalCompositor + }, + sequence::{VecBuffer, SequenceView}, + grid::{GridOffset, GridWindowIterator}, + singleton::{SingletonView, SingletonBuffer}, + string_editor::{StringEditor, insert_view::StringInsertView}, + leveled_term_view::LeveledTermView + } +}; + */ pub fn magic_header() { eprintln!("<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>"); diff --git a/nested/src/terminal/atom.rs b/nested/src/terminal/atom.rs index 1cf48e9..26460cd 100644 --- a/nested/src/terminal/atom.rs +++ b/nested/src/terminal/atom.rs @@ -1,7 +1,9 @@ +use { + super::TerminalStyle, + serde::{Serialize, Deserialize} +}; -use super::TerminalStyle; - -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Serialize, Deserialize, Debug)] pub struct TerminalAtom { pub c: Option, pub style: TerminalStyle diff --git a/nested/src/terminal/style.rs b/nested/src/terminal/style.rs index 3e9d6eb..4b1d983 100644 --- a/nested/src/terminal/style.rs +++ b/nested/src/terminal/style.rs @@ -1,5 +1,6 @@ +use serde::{Serialize, Deserialize}; -#[derive(Default, Copy, Clone, PartialEq)] +#[derive(Default, Copy, Clone, PartialEq, Serialize, Deserialize, Debug)] pub struct TerminalStyle { pub fg_color: Option<(u8, u8, u8)>, pub bg_color: Option<(u8, u8, u8)>,