diff --git a/src/abstractions.rs b/src/abstractions.rs index 703b025..98cf1d0 100644 --- a/src/abstractions.rs +++ b/src/abstractions.rs @@ -1,6 +1,6 @@ use num_enum::TryFromPrimitive; -use crate::daletl::{self, t_new, Tid}; +use crate::daletl::{self, t_new, Tid, ToDaletl, ToDaletlArgument, ToDaletlBody, ToDaletlTag}; const NB: daletl::Body = daletl::Body::Null; const NA: daletl::Argument = daletl::Argument::Null; @@ -39,14 +39,6 @@ pub enum Tag { Pre(String), } -pub trait ToDaletl { - fn to_daletl(self) -> Vec; -} - -pub trait ToDaletlTag { - fn to_daletl_tag(self) -> daletl::Tag; -} - impl ToDaletlTag for Tag { fn to_daletl_tag(self) -> daletl::Tag { match self { @@ -84,14 +76,6 @@ impl ToDaletlTag for Tag { } } -pub trait ToDaletlBody { - fn to_daletl_body(self) -> daletl::Body; -} - -pub trait ToDaletlArgument { - fn to_daletl_argument(self) -> daletl::Argument; -} - #[derive(Debug, Clone, PartialEq, Eq, TryFromPrimitive)] #[repr(u8)] pub enum HeadingLevel { diff --git a/src/daletl.rs b/src/daletl.rs index 2f4bac9..10f2c65 100644 --- a/src/daletl.rs +++ b/src/daletl.rs @@ -21,10 +21,6 @@ pub fn t_new(id: Tid, body: Body, argument: Argument) -> Tag { Tag::new(id, body, argument) } -pub trait IsNull { - fn is_null(&self) -> bool; -} - #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(untagged)] pub enum Body { @@ -94,3 +90,23 @@ pub enum Tid { Code, Pre, } + +pub trait IsNull { + fn is_null(&self) -> bool; +} + +pub trait ToDaletl { + fn to_daletl(self) -> Vec; +} + +pub trait ToDaletlTag { + fn to_daletl_tag(self) -> Tag; +} + +pub trait ToDaletlBody { + fn to_daletl_body(self) -> Body; +} + +pub trait ToDaletlArgument { + fn to_daletl_argument(self) -> Argument; +} diff --git a/tests/bench.rs b/tests/bench.rs index 399a0cb..12db92c 100644 --- a/tests/bench.rs +++ b/tests/bench.rs @@ -1,9 +1,10 @@ use dalet::{ - abstractions::{Body, HeadingLevel, NotNullBody, Tag, TextOrNullArgument, ToDaletl}, + abstractions::{Body, HeadingLevel, NotNullBody, Tag, TextOrNullArgument}, + daletl::ToDaletl, daletpack::*, }; use flate2::Compression; -use std::io::{read_to_string, Write}; +use std::io::Write; #[macro_export] macro_rules! iprint { diff --git a/tests/gemtext.gmi b/tests/gemtext.gmi index 8428b79..4eb77b8 100644 --- a/tests/gemtext.gmi +++ b/tests/gemtext.gmi @@ -3,7 +3,7 @@ => gemini://example.com A supremely cool Gemini capsule => sftp://example.com -Hi +This is paragraph =>https://example.com A cool website =>gopher://example.com An even cooler gopherhole