Link

Struct Link 

Source
pub struct Link<'source> { /* private fields */ }
Expand description

Link node for wiki-style links.

Implementations§

Source§

impl<'source> Link<'source>

Source

pub fn new(source: &'source str, open: Range<usize>, line: Range<usize>) -> Self

Create a new link.

Source

pub fn href(&self) -> &str

Get the link href.

If an owned value has been set it is preferred.

Source

pub fn label(&self) -> &str

Get the link label.

If an owned value has been set it is preferred.

Source

pub fn title(&self) -> &str

Get the link title.

If an owned value has been set it is preferred.

Source

pub fn href_span(&self) -> &Range<usize>

Get the span for the href.

Source

pub fn label_span(&self) -> &Range<usize>

Get the span for the label.

Source

pub fn title_span(&self) -> &Range<usize>

Get the span for the title.

Source

pub fn href_end(&mut self, end: usize)

Update the end of the href span.

Source

pub fn label_start(&mut self, start: usize)

Update the start of the label span.

Source

pub fn label_end(&mut self, end: usize)

Update the end of the label span.

Source

pub fn title_start(&mut self, start: usize)

Update the start of the title span.

Source

pub fn title_end(&mut self, end: usize)

Update the end of the title span.

Source

pub fn set_href(&mut self, value: String)

Set an owned value for the href.

Only available when the parser detects escape sequences in the input.

Source

pub fn set_label(&mut self, value: String)

Set an owned value for the label.

Only available when the parser detects escape sequences in the input.

Source

pub fn set_title(&mut self, value: String)

Set an owned value for the title.

Only available when the parser detects escape sequences in the input.

Source

pub fn is_escaped(&self) -> bool

Determine if this link has been escaped using a leading backslash.

Trait Implementations§

Source§

impl Debug for Link<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Link<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'source> Element<'source> for Link<'source>

Source§

fn open(&self) -> &'source str

Get the string for the open tag.
Source§

fn close(&self) -> &'source str

Get the string for the close tag. Read more
Source§

fn open_span(&self) -> &Range<usize>

Get the span for the open tag.
Source§

fn close_span(&self) -> &Option<Range<usize>>

Get the span for the close tag.
Source§

fn is_closed(&self) -> bool

Determine if this element has been closed.
Source§

fn exit(&mut self, span: Range<usize>)

Mark this element as correctly terminated.
Source§

fn span(&self) -> Range<usize>

The full byte range for this element; if the element is not closed only the open span is returned.
Source§

impl<'source> Lines for Link<'source>

Source§

fn lines(&self) -> &Range<usize>

Reference to the line range for the node.
Source§

fn lines_mut(&mut self) -> &mut Range<usize>

Mutable reference to the line range for the node.
Source§

fn lines_end(&mut self, line: &usize)

Set the end of the lines range.
Source§

impl<'source> PartialEq for Link<'source>

Source§

fn eq(&self, other: &Link<'source>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'source> Slice<'source> for Link<'source>

Source§

fn as_str(&self) -> &'source str

String slice of the full span for this node.
Source§

fn source(&self) -> &'source str

The underlying template source.
Source§

impl<'source> Eq for Link<'source>

Source§

impl<'source> StructuralPartialEq for Link<'source>

Auto Trait Implementations§

§

impl<'source> Freeze for Link<'source>

§

impl<'source> RefUnwindSafe for Link<'source>

§

impl<'source> Send for Link<'source>

§

impl<'source> Sync for Link<'source>

§

impl<'source> Unpin for Link<'source>

§

impl<'source> UnwindSafe for Link<'source>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.