Struct malvolio::tags::a::A

source · []
pub struct A { /* private fields */ }
Expand description

A link (anchor).

A::default()
    .attribute(Href::new("https://example.com/mark-read"))
    .text("Mark as read");

See the MDN Web Docs for further information.

Implementations

Creates a new A tag.

Adds the supplied text to this node, overwriting the previously existing text (if text has already been added to the node).

This method sanitises the input (i.e. it escapes HTML); this might not be what you want – if you are absolutely certain that the text you are providing does not come from a potentially malicious source (e.g. user-supplied text can contain script tags which will execute unwanted code) you can use text_unsanitized which is identical to this method, except for that it does not sanitise the inputted text (and is thus slightly faster).

Adds the supplied text to this node, overwriting the previously existing text (if text has already been added to the node).

WARNING: Do not (under any circumstances) use this method with unescaped user-supplied text. It will be rendered and poses a major security threat to your application. If in doubt, use the text method instead of this one (the risk is much lower that way).

Adds an attribute to this node. This method takes one argument which must implement Into<AAttr>.

Attach a new href attribute to this tag.

A::new().href("http://example.com");

Note: this method is a shortcut for

A::new().attribute(Href::new("https://example.com"));

Attach a new id attribute to this tag.

A::new().id("some-id");

Note: this method is a shortcut for

A::new().attribute(Id::new("some-id"));

Read an attribute that has been set.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.