Struct html_rs::HeadItem

source ·
pub struct HeadItem<'a> { /* private fields */ }

Implementations§

source§

impl<'a> HeadItem<'a>

source

pub fn new<S: AsRef<str>>(tag_str: S) -> HeadItem<'a>

Examples found in repository?
examples/getting_started.rs (line 4)
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§

source§

impl<'a> Debug for HeadItem<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Default for HeadItem<'a>

source§

fn default() -> HeadItem<'a>

Returns the “default value” for a type. Read more
source§

impl Display for HeadItem<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for HeadItem<'a>

source§

fn eq(&self, other: &HeadItem<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for HeadItem<'a>

source§

impl<'a> StructuralPartialEq for HeadItem<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for HeadItem<'a>

§

impl<'a> RefUnwindSafe for HeadItem<'a>

§

impl<'a> Send for HeadItem<'a>

§

impl<'a> Sync for HeadItem<'a>

§

impl<'a> Unpin for HeadItem<'a>

§

impl<'a> UnwindSafe for HeadItem<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.