pub struct Div {
pub children: Vec<Tag>,
pub classes: HashSet<TagClass>,
pub ids: Vec<String>,
pub attributes: HashMap<String, String>,
}
Fields§
§children: Vec<Tag>
§classes: HashSet<TagClass>
§ids: Vec<String>
§attributes: HashMap<String, String>
Implementations§
Source§impl Div
impl Div
pub fn add_class(self, class: TagClass) -> Self
pub fn add_id(self, id: impl Into<String>) -> Self
pub fn add_attribute(self, key: String, value: String) -> Self
Sourcepub fn styles(self, str_styles: &str) -> Self
pub fn styles(self, str_styles: &str) -> Self
Examples found in repository?
examples/testing.rs (lines 32-37)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
fn main() {
let root = Html::with_head(Head::empty()).body_from_iter([
Link::text("http://localhost:3000", "testing")
.preload(LinkLoadType::WhenIdle)
.styles(
"
color: blue;
background-color: red;
",
)
.add_id("testing")
.into_tag(),
Link::text("http://localhost:3000".to_string(), "testing")
.styles(
"
color: blue;
background-color: red;
",
)
.into_tag(),
Div::text("testing")
.styles(css!(
"
background-color: green;
color: blue;
"
))
.into_tag(),
]);
println!("{}", titan_html::render(root));
}
Source§impl Div
impl Div
Sourcepub fn text(value: impl Into<String>) -> Div
pub fn text(value: impl Into<String>) -> Div
Examples found in repository?
examples/testing.rs (line 31)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
fn main() {
let root = Html::with_head(Head::empty()).body_from_iter([
Link::text("http://localhost:3000", "testing")
.preload(LinkLoadType::WhenIdle)
.styles(
"
color: blue;
background-color: red;
",
)
.add_id("testing")
.into_tag(),
Link::text("http://localhost:3000".to_string(), "testing")
.styles(
"
color: blue;
background-color: red;
",
)
.into_tag(),
Div::text("testing")
.styles(css!(
"
background-color: green;
color: blue;
"
))
.into_tag(),
]);
println!("{}", titan_html::render(root));
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Div
impl RefUnwindSafe for Div
impl Send for Div
impl Sync for Div
impl Unpin for Div
impl UnwindSafe for Div
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more