[][src]Struct moxie_dom::elements::embedding::SourceBuilder

#[must_use = "needs to be built"]pub struct SourceBuilder { /* fields omitted */ }

The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.

A type for initializing the element's attributes before calling build.


impl SourceBuilder[src]

pub fn build(self) -> Source[src]

Initialize the element with all of the attributes so far.

impl SourceBuilder[src]

pub fn media(self, to_set: impl ToString) -> Self[src]

Media query of the resource's intended media; this should be used only in a element.

pub fn sizes(self, to_set: impl ToString) -> Self[src]

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 element is the direct child of a element.

pub fn src(self, to_set: impl ToString) -> Self[src]

Required for

pub fn srcset(self, to_set: impl ToString) -> Self[src]

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 element is the direct child of a element.

pub fn type_(self, to_set: impl ToString) -> Self[src]

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

Trait Implementations

impl Element for SourceBuilder[src]

impl<E> EventTarget<E> for SourceBuilder where
    E: GlobalEvent

impl GlobalEventHandler for SourceBuilder[src]

impl HtmlElement for SourceBuilder[src]

impl Node for SourceBuilder[src]

Auto Trait Implementations

impl !RefUnwindSafe for SourceBuilder

impl !Send for SourceBuilder

impl !Sync for SourceBuilder

impl Unpin for SourceBuilder

impl !UnwindSafe for SourceBuilder

Blanket Implementations

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

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

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

impl<N> Child for N where
    N: Node

impl<T> Downcast for T where
    T: Any

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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.