html icon indicating copy to clipboard operation
html copied to clipboard

Static Lifetimes

Open Bodleum opened this issue 1 year ago • 0 comments

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));
}

Bodleum avatar Dec 13 '23 15:12 Bodleum