Struct Search

Source
pub struct Search<T: FlowContent> { /* private fields */ }
Expand description

Builder for the <search> HTML element.

§Examples

use gen_html::{Render, content::search};

let html = search("Some text");
assert_eq!(html.render_to_string(), "<search>Some text</search>");

Implementations§

Source§

impl<T: FlowContent> Search<T>

Source

pub fn id(self, id: Id) -> Self

Sets the id attribute.

Source

pub fn class(self, class: impl Into<ClassList>) -> Self

Sets the class attribute.

Source

pub fn data( self, key: impl Into<Cow<'static, str>>, value: impl Into<Cow<'static, str>>, ) -> Self

Sets the data-* attribute.

§Panics

If key isn’t kebab-case.

§Example
use gen_html::{text_content::p, Render};

let html = p("Salmon").data("animal-type", "fish");
assert_eq!(html.render_to_string(), "<p data-animal-type=\"fish\">Salmon</p>");
Source

pub fn lang(self, lang: Lang) -> Self

Sets the lang attribute.

Trait Implementations§

Source§

impl<T: Default + FlowContent> Default for Search<T>

Source§

fn default() -> Search<T>

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

impl<T: Render + FlowContent> Render for Search<T>

Source§

fn render(self, t: &mut dyn Write) -> Result

Renders the HTML to a target. Read more
Source§

fn render_to_string(self) -> String

Renders the HTML to a string. Read more
Source§

impl<T: FlowContent> FlowContent for Search<T>

Source§

impl<T: FlowContent + NonInteractiveContent> NonInteractiveContent for Search<T>

Auto Trait Implementations§

§

impl<T> Freeze for Search<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Search<T>
where T: RefUnwindSafe,

§

impl<T> Send for Search<T>
where T: Send,

§

impl<T> Sync for Search<T>
where T: Sync,

§

impl<T> Unpin for Search<T>
where T: Unpin,

§

impl<T> UnwindSafe for Search<T>
where T: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.