Struct SourceBuilder

Source
pub struct SourceBuilder(/* private fields */);

Implementations§

Source§

impl SourceBuilder

Source

pub fn id(self, value: impl AttributeValue<String>) -> Self

Source

pub fn class(self, value: impl AttributeValue<String>) -> Self

Source

pub fn media(self, value: impl AttributeValue<String>) -> Self

Media query of the resource’s intended media; this should be used only in a <picture> element.

Source

pub fn sizes(self, value: impl AttributeValue<String>) -> Self

Is a list of source sizes that describes the final rendered width of the image represented by the source. Each source size consists of a comma-separated list of media condition-length pairs. This information is used by the browser to determine, before laying the page out, which image defined in srcset to use. Please note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example).

The sizes attribute has an effect only when the <source> element is the direct child of a <picture> element.

Source

pub fn src(self, value: impl AttributeValue<String>) -> Self

Required for <audio> and <video>, address of the media resource. The value of this attribute is ignored when the <source> element is placed inside a <picture> element.

Source

pub fn srcset(self, value: impl AttributeValue<String>) -> Self

A list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. Each string is composed of:

  1. One URL specifying an image.
  2. A width descriptor, which consists of a string containing a positive integer directly followed by “w”, such as 300w. The default value, if missing, is the infinity.
  3. A pixel density descriptor, that is a positive floating number directly followed by “x”. The default value, if missing, is 1x.

Each string in the list must have at least a width descriptor or a pixel density descriptor to be valid. Among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. The browser chooses the most adequate image to display at a given point of time.

The srcset attribute has an effect only when the <source> element is the direct child of a <picture> element.

Source

pub fn type_(self, value: impl AttributeValue<String>) -> Self

The MIME media type of the resource, optionally with a codecs parameter.

Source§

impl SourceBuilder

Source

pub fn on_blur( self, f: impl 'static + FnMut(FocusEvent, HtmlSourceElement), ) -> Self

Source

pub fn on_click( self, f: impl 'static + FnMut(MouseEvent, HtmlSourceElement), ) -> Self

Source

pub fn on_change( self, f: impl 'static + FnMut(Event, HtmlSourceElement), ) -> Self

Source

pub fn on_dblclick( self, f: impl 'static + FnMut(MouseEvent, HtmlSourceElement), ) -> Self

Source

pub fn on_focusout( self, f: impl 'static + FnMut(FocusEvent, HtmlSourceElement), ) -> Self

Source

pub fn on_input( self, f: impl 'static + FnMut(InputEvent, HtmlSourceElement), ) -> Self

Source

pub fn on_keydown( self, f: impl 'static + FnMut(KeyboardEvent, HtmlSourceElement), ) -> Self

Source

pub fn on_keyup( self, f: impl 'static + FnMut(KeyboardEvent, HtmlSourceElement), ) -> Self

Source

pub fn effect(self, f: impl Effect<HtmlSourceElement>) -> Self

Trait Implementations§

Source§

impl Builder for SourceBuilder

Source§

impl DomElement for SourceBuilder

Source§

impl From<SourceBuilder> for Element

Source§

fn from(builder: SourceBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<SourceBuilder> for ElementBuilder

Source§

fn from(builder: SourceBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.