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
sourceimpl A
impl A
sourcepub fn text<S>(self, text: S) -> Self where
S: Into<Cow<'static, str>>,
pub fn text<S>(self, text: S) -> Self where
S: Into<Cow<'static, str>>,
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).
sourcepub fn text_unsanitized<S>(self, text: S) -> Self where
S: Into<Cow<'static, str>>,
pub fn text_unsanitized<S>(self, text: S) -> Self where
S: Into<Cow<'static, str>>,
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).
sourcepub fn attribute<I>(self, attribute: I) -> Self where
I: Into<AAttr>,
pub fn attribute<I>(self, attribute: I) -> Self where
I: Into<AAttr>,
Adds an attribute to this node. This method takes one argument which
must implement Into<AAttr>
.
sourcepub fn href<C>(self, href: C) -> Self where
C: Into<Cow<'static, str>>,
pub fn href<C>(self, href: C) -> Self where
C: Into<Cow<'static, str>>,
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"));
Trait Implementations
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more