Skip to main content

ExternalLink

Struct ExternalLink 

Source
pub struct ExternalLink { /* private fields */ }
Expand description

A link to another site. It always has rel="noopener noreferrer", so the other site learns neither the page it came from nor gets a handle on this window, and screen readers hear that it leaves the app.

let help = ExternalLink::new("https://example.com/help", Text::from("Help center")).new_tab();
let site = ExternalLink::new("https://example.org", Text::from("Website")).user_content();

.user_content() adds nofollow ugc for addresses users typed, so search engines do not credit them. .new_tab() opens it in a new tab and says so; it stays in the same tab unless set. Only https and http addresses become links; anything else, such as javascript:, is shown as plain text.

Implementations§

Source

pub fn new(url: impl Into<String>, text: impl Into<Text>) -> Self

Source

pub fn user_content(self) -> Self

Marks an address a user entered: adds nofollow ugc.

Source

pub fn new_tab(self) -> Self

Opens the link in a new tab.

Source

pub fn html(&self, r: &Render<'_>) -> String

Link markup, for use inside other components.

Trait Implementations§

Source§

fn render(&self, out: &mut String, r: &Render<'_>)

Source§

fn schema(&self) -> Json

Schema used by MCP tools and test generation. Include a "type" key.
Source§

fn grid(&self) -> Option<&dyn GridSource>

Source§

fn form(&self) -> Option<&dyn FormSource>

Source§

fn reveal(&self, _field: &str) -> Option<Revealed>

The raw value of a masked field this component shows, for an audited reveal. The server checks the unmask permission before sending it.
Source§

fn import(&self) -> Option<&dyn ImportSource>

CSV import, for components that import rows (see crate::Import).
Source§

fn children(&self) -> &[Node]

Nodes held by a container. Child i of the node at path p has the path p.i.
Source§

fn eager_children(&self) -> &[Node]

Children rendered with the page. Others, such as closed lazy tabs, load when first shown.
Source§

fn source(&self, _key: &str) -> Option<&dyn DataSource>

Data the component fetches through an action, by key (a field name for lookups).
Source§

fn shortcuts(&self) -> Vec<&str>

Keyboard shortcuts of the component’s own links, as declared, for the clash checks of App::check and App::check_page.
Source§

impl From<ExternalLink> for Node

Source§

fn from(c: ExternalLink) -> 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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more