Struct write_html::tags::Tag
source · pub struct Tag<'t, A: Attributes, I: Html, const SILENT: bool> { /* private fields */ }
Expand description
Represents a tag.
TODO better docs
Implementations§
source§impl<'n, A: Attributes, I: Html, const SILENT: bool> Tag<'n, A, I, SILENT>
impl<'n, A: Attributes, I: Html, const SILENT: bool> Tag<'n, A, I, SILENT>
sourcepub fn attributes<B: Attributes>(
self,
attributes: B
) -> Tag<'n, Sum<A, B>, I, SILENT>
pub fn attributes<B: Attributes>( self, attributes: B ) -> Tag<'n, Sum<A, B>, I, SILENT>
Adds multiple attributes to the tag.
Arguments
attributes
- The attributes to add.
Example
use write_html::*;
use std::fmt::Write;
let mut s = String::new();
s.write_html(tags::div(Empty, Empty)
.attributes([
("class", "container"),
("id", "main"),
])
).unwrap();
assert_eq!(s, "<div class=\"container\" id=\"main\"></div>");
sourcepub fn attr<Name: AttributeName, Value: AttributeValue>(
self,
name: Name,
value: Value
) -> Tag<'n, Sum<A, [(Name, Value); 1]>, I, SILENT>
pub fn attr<Name: AttributeName, Value: AttributeValue>( self, name: Name, value: Value ) -> Tag<'n, Sum<A, [(Name, Value); 1]>, I, SILENT>
Adds an attribute to the tag.
Trait Implementations§
source§impl<'t, A: Clone + Attributes, I: Clone + Html, const SILENT: bool> Clone for Tag<'t, A, I, SILENT>
impl<'t, A: Clone + Attributes, I: Clone + Html, const SILENT: bool> Clone for Tag<'t, A, I, SILENT>
source§impl<'t, A: Debug + Attributes, I: Debug + Html, const SILENT: bool> Debug for Tag<'t, A, I, SILENT>
impl<'t, A: Debug + Attributes, I: Debug + Html, const SILENT: bool> Debug for Tag<'t, A, I, SILENT>
source§impl<'t, A: Hash + Attributes, I: Hash + Html, const SILENT: bool> Hash for Tag<'t, A, I, SILENT>
impl<'t, A: Hash + Attributes, I: Hash + Html, const SILENT: bool> Hash for Tag<'t, A, I, SILENT>
source§impl<'t, A: Ord + Attributes, I: Ord + Html, const SILENT: bool> Ord for Tag<'t, A, I, SILENT>
impl<'t, A: Ord + Attributes, I: Ord + Html, const SILENT: bool> Ord for Tag<'t, A, I, SILENT>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'t, A: PartialEq + Attributes, I: PartialEq + Html, const SILENT: bool> PartialEq<Tag<'t, A, I, SILENT>> for Tag<'t, A, I, SILENT>
impl<'t, A: PartialEq + Attributes, I: PartialEq + Html, const SILENT: bool> PartialEq<Tag<'t, A, I, SILENT>> for Tag<'t, A, I, SILENT>
source§impl<'t, A: PartialOrd + Attributes, I: PartialOrd + Html, const SILENT: bool> PartialOrd<Tag<'t, A, I, SILENT>> for Tag<'t, A, I, SILENT>
impl<'t, A: PartialOrd + Attributes, I: PartialOrd + Html, const SILENT: bool> PartialOrd<Tag<'t, A, I, SILENT>> for Tag<'t, A, I, SILENT>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'t, A: Copy + Attributes, I: Copy + Html, const SILENT: bool> Copy for Tag<'t, A, I, SILENT>
impl<'t, A: Eq + Attributes, I: Eq + Html, const SILENT: bool> Eq for Tag<'t, A, I, SILENT>
impl<'t, A: Attributes, I: Html, const SILENT: bool> StructuralEq for Tag<'t, A, I, SILENT>
impl<'t, A: Attributes, I: Html, const SILENT: bool> StructuralPartialEq for Tag<'t, A, I, SILENT>
Auto Trait Implementations§
impl<'t, A, I, const SILENT: bool> RefUnwindSafe for Tag<'t, A, I, SILENT>where A: RefUnwindSafe, I: RefUnwindSafe,
impl<'t, A, I, const SILENT: bool> Send for Tag<'t, A, I, SILENT>where A: Send, I: Send,
impl<'t, A, I, const SILENT: bool> Sync for Tag<'t, A, I, SILENT>where A: Sync, I: Sync,
impl<'t, A, I, const SILENT: bool> Unpin for Tag<'t, A, I, SILENT>where A: Unpin, I: Unpin,
impl<'t, A, I, const SILENT: bool> UnwindSafe for Tag<'t, A, I, SILENT>where A: UnwindSafe, I: UnwindSafe,
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