yoshuawuyts / html

Type-safe HTML support for Rust
Apache License 2.0
244 stars 7 forks source link

Static Lifetimes #76

Open Bodleum opened 9 months ago

Bodleum commented 9 months ago

Do the lifetimes for string inputs need to be 'static? Or can they be shortened to more easily generate HTML code programmatically? For example:

#![recursion_limit = "512"]

use std::fs;

use html::text_content::Division;

fn div(text: &'static str) -> Division {
    Division::builder().text(text).build()
}

fn main() {
    let text = fs::read_to_string("./div").unwrap();
    println!("{}", div(&text));
}