Skip to main content

FootnoteRef

Struct FootnoteRef 

Source
pub struct FootnoteRef {
    pub label: String,
    pub text: Option<String>,
    pub offset: Option<usize>,
    pub end: Option<usize>,
}
Expand description

A footnote reference and the note it names — the answer to Doc::footnote_at.

The two Options move together: a reference whose definition is missing has neither a body to show nor a place to jump to, and one that resolved has both.

Fields§

§label: String

The reference’s label — the 1 of [^1], with neither the ^ that spells it a footnote nor the brackets around it.

§text: Option<String>

The note’s body as source bytes (see wysiwyg::footnote_body_span), or None when the document defines no [^label]: to read one from.

§offset: Option<usize>

Where the note’s body starts, for a “go to note” that moves the caret there. None alongside a None text.

The body rather than the definition, because this is an offset to put a caret on and the [^1]: marker is decoration the caret can’t occupy — aiming at the definition’s first byte snaps to the nearest real stop, which is up in the paragraph above the note. It is also simply where a reader following a reference wants to land: at the note’s first word, ready to read or amend it.

§end: Option<usize>

Where the note’s body ends, exclusive — so a frontend can ask which rendered rows the note occupies and draw those instead of text.

The rows are the note with its markup resolved: see *later* reaches a frontend as an italic run, not as asterisks. text is the source bytes and stays the honest answer for anything that wants the note as written (a search index, a copy); this pair of offsets is for anything that wants it as read. None alongside a None offset.

Trait Implementations§

Source§

impl Clone for FootnoteRef

Source§

fn clone(&self) -> FootnoteRef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FootnoteRef

Source§

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

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

impl Eq for FootnoteRef

Source§

impl PartialEq for FootnoteRef

Source§

fn eq(&self, other: &FootnoteRef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FootnoteRef

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.