From c6ada504e4cb98b5e8f28ec7e38530d911bdab6d Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 1 Sep 2017 21:49:39 +0100 Subject: [PATCH] remove helpers file --- src/renderers/helpers.rs | 18 ------------------ src/renderers/html_cleanup.rs | 2 +- src/renderers/mod.rs | 19 ++++++++++++++++++- 3 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 src/renderers/helpers.rs diff --git a/src/renderers/helpers.rs b/src/renderers/helpers.rs deleted file mode 100644 index f3fe9fe..0000000 --- a/src/renderers/helpers.rs +++ /dev/null @@ -1,18 +0,0 @@ -use sciter::{Window, Host, Element}; -use std::rc::Rc; -use std::ops::Deref; - - -fn get_root(frame: Window) -> Element { - return frame.get_host().deref().get_root().expect("Failed to get root of window"); -} - -pub fn sciter_start(source: String) -> Element { - let mut frame = Window::new(); - frame.load_html(&source.as_bytes(), None); - return get_root(frame); -} - -pub fn get_html(element: Element) -> String { - return String::from_utf8(element.get_html(true)).expect("Failed to get HTML from element"); -} diff --git a/src/renderers/html_cleanup.rs b/src/renderers/html_cleanup.rs index 5f2d817..0b8cc50 100644 --- a/src/renderers/html_cleanup.rs +++ b/src/renderers/html_cleanup.rs @@ -1,4 +1,4 @@ -use renderers::helpers::{sciter_start, get_html}; +use renderers::{sciter_start, get_html}; use config::Config; diff --git a/src/renderers/mod.rs b/src/renderers/mod.rs index 093c90d..a87b407 100644 --- a/src/renderers/mod.rs +++ b/src/renderers/mod.rs @@ -1,6 +1,23 @@ use config::Config; -mod helpers; +use sciter::{Window, Host, Element}; +use std::rc::Rc; +use std::ops::Deref; pub mod html_cleanup; pub mod strip_blank; + + +fn get_root(frame: Window) -> Element { + return frame.get_host().deref().get_root().expect("Failed to get root of window"); +} + +fn sciter_start(source: String) -> Element { + let mut frame = Window::new(); + frame.load_html(&source.as_bytes(), None); + return get_root(frame); +} + +fn get_html(element: Element) -> String { + return String::from_utf8(element.get_html(true)).expect("Failed to get HTML from element"); +}