WIP
A library render text to html in Rust.
Add this to your Cargo.toml
:
toml
[dependencies]
text2html = "0.0.1"
Example: ```rust pub struct Content <'b> { pub c: &'b String, } impl <'b> Content <'b> { pub fn new(s: &'b String) -> Self { Content { c: s, } } } impl <'b> Text for Content <'b> { fn datasource(&mut self) -> String { self.c.toowned() } }
pub struct TextBuilder <'a> {
pub sc: &'a String,
}
impl <'a> TextBuilder <'a> {
pub fn new(s: &'a String) -> Self {
TextBuilder {
sc: s,
}
}
}
impl <'a> TextBuilder <'a> {
pub fn build(&mut self) -> Box
fn main() { let text = "Hello world.".to_string(); let mut builder = TextBuilder::new( &text ).build(); HtmlRender::new().render(&mut builder); } ```