Struct ABuilder

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

Implementations§

Source§

impl ABuilder

Source

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

Source

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

Source

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

Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:

  • Without a value, the browser will suggest a filename/extension, generated from various sources:
  • The Content-Disposition HTTP header
  • The final segment in the URL path
  • The media type (from the (Content-Type header, the start of a data: URL, or Blob.type for a blob: URL)
  • Defining a value suggests it as the filename. / and \ characters are converted to underscores (_). Filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary.

Notes:

  • download only works for same-origin URLs, or the blob: and data: schemes.
  • If Content-Disposition has a different filename than download, the header takes priority. (If Content-Disposition: inline, Firefox prefers the header while Chrome prefers download.)
Source

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

The URL that the hyperlink points to. Links are not restricted to HTTP-based URLs — they can use any URL scheme supported by browsers:

  • Sections of a page with fragment URLs
  • Pieces of media files with media fragments
  • Telephone numbers with tel: URLs
  • Email addresses with mailto: URLs
  • While web browsers may not support other URL schemes, web sites can with registerProtocolHandler()
Source

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

Hints at the human language of the linked URL. No built-in functionality. Allowed values are the same as the global lang attribute.

Source

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

A space-separated list of URLs. When the link is followed, the browser will send POST requests with the body PING to the URLs. Typically for tracking.

Source

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

The relationship of the linked URL as space-separated link types.

Source

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

Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>). The following keywords have special meanings for where to load the URL:

  • _self: the current browsing context. (Default)
  • _blank: usually a new tab, but users can configure browsers to open a new window instead.
  • _parent: the parent browsing context of the current one. If no parent, behaves as _self.
  • _top: the topmost browsing context (the “highest” context that’s an ancestor of the current one). If no ancestors, behaves as _self.

Note: When using target, add rel=“noreferrer noopener” to avoid exploitation of the window.opener API;

Note: Linking to another page with target=“_blank” will run the new page in the same process as your page. If the new page executes JavaScript, your page’s performance may suffer. This can also be avoided by using rel=“noreferrer noopener”.

Source

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

Hints at the linked URL’s format with a MIME type. No built-in functionality.

Source§

impl ABuilder

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source§

impl ABuilder

Source

pub fn text(self, child: impl Text) -> Self

Source

pub fn child<Child>(self, c: Child) -> Self
where Child: Into<Element>,

Trait Implementations§

Source§

impl Builder for ABuilder

Source§

impl DomElement for ABuilder

Source§

impl From<ABuilder> for Element

Source§

fn from(builder: ABuilder) -> Self

Converts to this type from the input type.
Source§

impl From<ABuilder> for ElementBuilder

Source§

fn from(builder: ABuilder) -> 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.