From cdef11178694891eb0ab0224a1ce844daa67bbd2 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Wed, 16 Mar 2022 15:33:43 +0000 Subject: [PATCH] Use u8 instead of char for datastpre key separators --- lib/src/key/database.rs | 12 ++++++------ lib/src/key/db.rs | 20 ++++++++++---------- lib/src/key/dl.rs | 24 ++++++++++++------------ lib/src/key/dt.rs | 24 ++++++++++++------------ lib/src/key/ev.rs | 28 ++++++++++++++-------------- lib/src/key/fd.rs | 28 ++++++++++++++-------------- lib/src/key/ft.rs | 28 ++++++++++++++-------------- lib/src/key/index.rs | 20 ++++++++++---------- lib/src/key/ix.rs | 28 ++++++++++++++-------------- lib/src/key/lv.rs | 28 ++++++++++++++-------------- lib/src/key/namespace.rs | 8 ++++---- lib/src/key/nl.rs | 20 ++++++++++---------- lib/src/key/ns.rs | 16 ++++++++-------- lib/src/key/nt.rs | 20 ++++++++++---------- lib/src/key/point.rs | 20 ++++++++++---------- lib/src/key/sc.rs | 24 ++++++++++++------------ lib/src/key/st.rs | 36 ++++++++++++++++++------------------ lib/src/key/table.rs | 16 ++++++++-------- lib/src/key/tb.rs | 24 ++++++++++++------------ lib/src/key/thing.rs | 22 +++++++++++----------- 20 files changed, 223 insertions(+), 223 deletions(-) diff --git a/lib/src/key/database.rs b/lib/src/key/database.rs index e2b8c08e..a160eba0 100644 --- a/lib/src/key/database.rs +++ b/lib/src/key/database.rs @@ -4,10 +4,10 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Database { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, } @@ -30,10 +30,10 @@ pub fn new(ns: &str, db: &str) -> Database { impl Database { pub fn new(ns: String, db: String) -> Database { Database { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, } } diff --git a/lib/src/key/db.rs b/lib/src/key/db.rs index 049be8d4..ebc9a63e 100644 --- a/lib/src/key/db.rs +++ b/lib/src/key/db.rs @@ -4,12 +4,12 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Db { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, - _c: char, - _d: char, + _b: u8, + _c: u8, + _d: u8, pub db: String, } @@ -32,12 +32,12 @@ pub fn new(ns: &str, db: &str) -> Db { impl Db { pub fn new(ns: String, db: String) -> Db { Db { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '!', - _c: 'd', - _d: 'b', + _b: 0x21, // ! + _c: 0x64, // d + _d: 0x02, // b db, } } diff --git a/lib/src/key/dl.rs b/lib/src/key/dl.rs index d732a39a..3c099c3c 100644 --- a/lib/src/key/dl.rs +++ b/lib/src/key/dl.rs @@ -4,14 +4,14 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Dl { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, - _d: char, - _e: char, + _c: u8, + _d: u8, + _e: u8, pub dl: String, } @@ -34,14 +34,14 @@ pub fn new(ns: &str, db: &str, dl: &str) -> Dl { impl Dl { pub fn new(ns: String, db: String, dl: String) -> Dl { Dl { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '!', - _d: 'd', - _e: 'l', + _c: 0x21, // ! + _d: 0x64, // d + _e: 0x6c, // l dl, } } diff --git a/lib/src/key/dt.rs b/lib/src/key/dt.rs index e858065d..4193d498 100644 --- a/lib/src/key/dt.rs +++ b/lib/src/key/dt.rs @@ -4,14 +4,14 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Dt { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, - _d: char, - _e: char, + _c: u8, + _d: u8, + _e: u8, pub tk: String, } @@ -34,14 +34,14 @@ pub fn new(ns: &str, db: &str, tb: &str) -> Dt { impl Dt { pub fn new(ns: String, db: String, tk: String) -> Dt { Dt { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '!', - _d: 'd', - _e: 't', + _c: 0x21, // ! + _d: 0x64, // d + _e: 0x74, // t tk, } } diff --git a/lib/src/key/ev.rs b/lib/src/key/ev.rs index 50063cf5..9a4798ad 100644 --- a/lib/src/key/ev.rs +++ b/lib/src/key/ev.rs @@ -4,16 +4,16 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Ev { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, - _e: char, - _f: char, + _d: u8, + _e: u8, + _f: u8, pub ev: String, } @@ -36,16 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, ev: &str) -> Ev { impl Ev { pub fn new(ns: String, db: String, tb: String, ev: String) -> Ev { Ev { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '!', - _e: 'e', - _f: 'v', + _d: 0x21, // ! + _e: 0x65, // e + _f: 0x76, // v ev, } } diff --git a/lib/src/key/fd.rs b/lib/src/key/fd.rs index 895f7e6c..52c49085 100644 --- a/lib/src/key/fd.rs +++ b/lib/src/key/fd.rs @@ -4,16 +4,16 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Fd { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, - _e: char, - _f: char, + _d: u8, + _e: u8, + _f: u8, pub fd: String, } @@ -36,16 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, fd: &str) -> Fd { impl Fd { pub fn new(ns: String, db: String, tb: String, fd: String) -> Fd { Fd { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '!', - _e: 'f', - _f: 'd', + _d: 0x21, // ! + _e: 0x66, // f + _f: 0x64, // d fd, } } diff --git a/lib/src/key/ft.rs b/lib/src/key/ft.rs index 7ea37a85..4b4990f2 100644 --- a/lib/src/key/ft.rs +++ b/lib/src/key/ft.rs @@ -4,16 +4,16 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Ft { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, - _e: char, - _f: char, + _d: u8, + _e: u8, + _f: u8, pub ft: String, } @@ -36,16 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, ft: &str) -> Ft { impl Ft { pub fn new(ns: String, db: String, tb: String, ft: String) -> Ft { Ft { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '!', - _e: 'f', - _f: 't', + _d: 0x21, // ! + _e: 0x66, // f + _f: 0x74, // t ft, } } diff --git a/lib/src/key/index.rs b/lib/src/key/index.rs index ac02df7a..23adccc7 100644 --- a/lib/src/key/index.rs +++ b/lib/src/key/index.rs @@ -5,14 +5,14 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Index { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, + _d: u8, pub ix: String, pub fd: Value, } @@ -36,14 +36,14 @@ pub fn new(ns: &str, db: &str, tb: &str, ix: &str, fd: Value) -> Index { impl Index { pub fn new(ns: String, db: String, tb: String, ix: String, fd: Value) -> Index { Index { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '¤', + _d: 0xa4, // ¤ ix, fd, } diff --git a/lib/src/key/ix.rs b/lib/src/key/ix.rs index c9052712..0fcbb7a9 100644 --- a/lib/src/key/ix.rs +++ b/lib/src/key/ix.rs @@ -4,16 +4,16 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Ix { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, - _e: char, - _f: char, + _d: u8, + _e: u8, + _f: u8, pub ix: String, } @@ -36,16 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, ix: &str) -> Ix { impl Ix { pub fn new(ns: String, db: String, tb: String, ix: String) -> Ix { Ix { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '!', - _e: 'i', - _f: 'x', + _d: 0x21, // ! + _e: 0x69, // i + _f: 0x78, // x ix, } } diff --git a/lib/src/key/lv.rs b/lib/src/key/lv.rs index 5556cbf0..7a6df4b4 100644 --- a/lib/src/key/lv.rs +++ b/lib/src/key/lv.rs @@ -4,16 +4,16 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Lv { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, - _e: char, - _f: char, + _d: u8, + _e: u8, + _f: u8, pub lv: String, } @@ -36,16 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, lv: &str) -> Lv { impl Lv { pub fn new(ns: String, db: String, tb: String, lv: String) -> Lv { Lv { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '!', - _e: 'l', - _f: 'v', + _d: 0x21, // ! + _e: 0x6c, // l + _f: 0x76, // v lv, } } diff --git a/lib/src/key/namespace.rs b/lib/src/key/namespace.rs index ac34d167..dab6b378 100644 --- a/lib/src/key/namespace.rs +++ b/lib/src/key/namespace.rs @@ -4,8 +4,8 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Namespace { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, } @@ -28,8 +28,8 @@ pub fn new(ns: &str) -> Namespace { impl Namespace { pub fn new(ns: String) -> Namespace { Namespace { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, } } diff --git a/lib/src/key/nl.rs b/lib/src/key/nl.rs index 3c4d46c9..55d370bf 100644 --- a/lib/src/key/nl.rs +++ b/lib/src/key/nl.rs @@ -4,12 +4,12 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Nl { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, - _c: char, - _d: char, + _b: u8, + _c: u8, + _d: u8, pub us: String, } @@ -32,12 +32,12 @@ pub fn new(ns: &str, us: &str) -> Nl { impl Nl { pub fn new(ns: String, us: String) -> Nl { Nl { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '!', - _c: 'n', - _d: 'l', + _b: 0x21, // ! + _c: 0x6e, // n + _d: 0x6c, // l us, } } diff --git a/lib/src/key/ns.rs b/lib/src/key/ns.rs index 8eb284f4..e645ac10 100644 --- a/lib/src/key/ns.rs +++ b/lib/src/key/ns.rs @@ -4,10 +4,10 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Ns { - __: char, - _a: char, - _b: char, - _c: char, + __: u8, + _a: u8, + _b: u8, + _c: u8, pub ns: String, } @@ -30,10 +30,10 @@ pub fn new(ns: &str) -> Ns { impl Ns { pub fn new(ns: String) -> Ns { Ns { - __: '/', - _a: '!', - _b: 'n', - _c: 's', + __: 0x2f, // / + _a: 0x21, // ! + _b: 0x6e, // n + _c: 0x73, // s ns, } } diff --git a/lib/src/key/nt.rs b/lib/src/key/nt.rs index c4a1b501..81249cd4 100644 --- a/lib/src/key/nt.rs +++ b/lib/src/key/nt.rs @@ -4,12 +4,12 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Nt { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, - _c: char, - _d: char, + _b: u8, + _c: u8, + _d: u8, pub tk: String, } @@ -32,12 +32,12 @@ pub fn new(ns: &str, tk: &str) -> Nt { impl Nt { pub fn new(ns: String, tk: String) -> Nt { Nt { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '!', - _c: 'n', - _d: 't', + _b: 0x21, // ! + _c: 0x6e, // n + _d: 0x74, // t tk, } } diff --git a/lib/src/key/point.rs b/lib/src/key/point.rs index 850d7eb2..2e4ebb59 100644 --- a/lib/src/key/point.rs +++ b/lib/src/key/point.rs @@ -5,14 +5,14 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Point { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, + _d: u8, pub ix: String, pub fd: Value, pub id: String, @@ -37,14 +37,14 @@ pub fn new(ns: &str, db: &str, tb: &str, ix: &str, fd: Value, id: &str) -> Point impl Point { pub fn new(ns: String, db: String, tb: String, ix: String, fd: Value, id: String) -> Point { Point { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '¤', + _d: 0xa4, // ¤ ix, fd, id, diff --git a/lib/src/key/sc.rs b/lib/src/key/sc.rs index 7a177e5a..97e09a4c 100644 --- a/lib/src/key/sc.rs +++ b/lib/src/key/sc.rs @@ -4,14 +4,14 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Sc { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, - _d: char, - _e: char, + _c: u8, + _d: u8, + _e: u8, pub sc: String, } @@ -34,14 +34,14 @@ pub fn new(ns: &str, db: &str, sc: &str) -> Sc { impl Sc { pub fn new(ns: String, db: String, sc: String) -> Sc { Sc { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '!', - _d: 's', - _e: 'c', + _c: 0x21, // ! + _d: 0x73, // s + _e: 0x63, // c sc, } } diff --git a/lib/src/key/st.rs b/lib/src/key/st.rs index 5b49ef80..90e9e588 100644 --- a/lib/src/key/st.rs +++ b/lib/src/key/st.rs @@ -4,18 +4,18 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct St { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, - _d: char, - _e: char, + _c: u8, + _d: u8, + _e: u8, pub sc: String, - _f: char, - _g: char, - _h: char, + _f: u8, + _g: u8, + _h: u8, pub tk: String, } @@ -38,18 +38,18 @@ pub fn new(ns: &str, db: &str, sc: &str, tk: &str) -> St { impl St { pub fn new(ns: String, db: String, sc: String, tk: String) -> St { St { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '!', - _d: 's', - _e: 't', + _c: 0x21, // ! + _d: 0x73, // s + _e: 0x74, // t sc, - _f: '!', - _g: 't', - _h: 'k', + _f: 0x21, // ! + _g: 0x74, // t + _h: 0x6b, // k tk, } } diff --git a/lib/src/key/table.rs b/lib/src/key/table.rs index 57be2c91..1e66f653 100644 --- a/lib/src/key/table.rs +++ b/lib/src/key/table.rs @@ -4,12 +4,12 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Table { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, } @@ -32,12 +32,12 @@ pub fn new(ns: &str, db: &str, tb: &str) -> Table { impl Table { pub fn new(ns: String, db: String, tb: String) -> Table { Table { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, } } diff --git a/lib/src/key/tb.rs b/lib/src/key/tb.rs index 7b39f546..59f4a0ee 100644 --- a/lib/src/key/tb.rs +++ b/lib/src/key/tb.rs @@ -4,14 +4,14 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Tb { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, - _d: char, - _e: char, + _c: u8, + _d: u8, + _e: u8, pub tb: String, } @@ -34,14 +34,14 @@ pub fn new(ns: &str, db: &str, tb: &str) -> Tb { impl Tb { pub fn new(ns: String, db: String, tb: String) -> Tb { Tb { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '!', - _d: 't', - _e: 'b', + _c: 0x21, // ! + _d: 0x74, // t + _e: 0x62, // b tb, } } diff --git a/lib/src/key/thing.rs b/lib/src/key/thing.rs index c16fe1bf..f3dbcccf 100644 --- a/lib/src/key/thing.rs +++ b/lib/src/key/thing.rs @@ -4,15 +4,15 @@ use storekey::{deserialize, serialize}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct Thing { - __: char, - _a: char, + __: u8, + _a: u8, pub ns: String, - _b: char, + _b: u8, pub db: String, - _c: char, + _c: u8, pub tb: String, - _d: char, - pub id: String, + _d: u8, + pub id: Part, } impl From for Vec { @@ -40,14 +40,14 @@ pub fn new(ns: &str, db: &str, tb: &str, id: &str) -> Thing { impl Thing { pub fn new(ns: String, db: String, tb: String, id: String) -> Thing { Thing { - __: '/', - _a: '*', + __: 0x2f, // / + _a: 0x2a, // * ns, - _b: '*', + _b: 0x2a, // * db, - _c: '*', + _c: 0x2a, // * tb, - _d: '*', + _d: 0x2a, // * id, } }