pub struct Style<'a> { /* private fields */ }
Implementations§
source§impl<'a> Style<'a>
impl<'a> Style<'a>
sourcepub fn new<S: AsRef<str>>(css: S) -> Style<'a>
pub fn new<S: AsRef<str>>(css: S) -> Style<'a>
Examples found in repository?
examples/getting_started.rs (line 5)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fn main() {
let title = HeadItem::new("<title>It works!</title>");
let style = Style::new("body { color: #000000; }");
let script1 = Script::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let body = Body::new().script(script1);
let script2 = Script::new(
format!(
r#"console.log("Hello from file {} at line {}")"#,
file!(),
line!(),
)
.as_str(),
);
let html = Html::new()
.head(title)
.add_style(style)
.add_script(script2)
.body(body);
#[cfg(feature = "debug")]
dbg!(&html);
println!("{html}");
}
Trait Implementations§
impl<'a> Eq for Style<'a>
impl<'a> StructuralPartialEq for Style<'a>
Auto Trait Implementations§
impl<'a> Freeze for Style<'a>
impl<'a> RefUnwindSafe for Style<'a>
impl<'a> Send for Style<'a>
impl<'a> Sync for Style<'a>
impl<'a> Unpin for Style<'a>
impl<'a> UnwindSafe for Style<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more