pub struct LinkPayload {
pub href: String,
pub kind: Name,
pub doc_role: Option<DocRole>,
pub label: Option<String>,
pub shows_target: bool,
}Expand description
The payload of flm.pres.link: its target and kind, its role in the
document’s structure, and its accessible name.
The link’s content (the children of the node) is always what a reader
sees. label is an alternative a reader does not
see: the name assistive technology speaks in place of the content, for a
link whose content alone says little (a note’s number, an arrow back to
where the note was referenced).
Fields§
§href: StringThe target: # followed by the anchor for a target in the document, a
URL otherwise.
kind: NameThe link kind (ref, cite, url, term), which cannot be derived
from the target.
doc_role: Option<DocRole>The link’s document role, when it has one: DocRole::NoteRef for a
link to a note, DocRole::BackLink for a link back from one,
DocRole::BiblioRef for a link to a cited work. A backend without
the notion ignores it.
label: Option<String>The link’s accessible name (Footnote 1), spoken in place of its
content by assistive technology, when it has one; the HTML backend
writes it as aria-label. A backend without the notion ignores it,
and the content stays what a reader sees either way.
shows_target: boolWhether the content is the target’s own display: text derived from the
target by the feature that staged the link, rather than words an
author wrote for it. \url{https://example.com/} shows example.com,
derived from its address, whereas
\href{https://example.com}{example.com} shows the words its author
wrote, which happen to match.
The feature that staged the link states this fact; it is never the
result of comparing the content with the target. Any backend may read it: the text backend
prints the target after a link’s content, and not after a link whose
content already is the target’s display unless asked to
(TextRenderOptions).
false for every link whose content was written by an author or is a
reference’s text, which is every link but a \url or an \email.
Implementations§
Source§impl LinkPayload
impl LinkPayload
Sourcepub fn from_projection(
value: &SerialValue,
) -> Result<LinkPayload, DeserializeError>
pub fn from_projection( value: &SerialValue, ) -> Result<LinkPayload, DeserializeError>
The payload rebuilt from its projection, the value
project produced.
§Errors
Returns a DeserializeError mentioning flm.pres.link when the
projection is not a map, when href or kind is missing or is not a
string, when doc_role is present and matches no document role
(DocRole::parse), when label is present and is not a string, or
when shows_target is present and is not a boolean. An absent
shows_target is false, the value the projection leaves out.
Trait Implementations§
Source§impl Clone for LinkPayload
impl Clone for LinkPayload
Source§impl Debug for LinkPayload
impl Debug for LinkPayload
impl Eq for LinkPayload
Source§impl PartialEq for LinkPayload
impl PartialEq for LinkPayload
Source§impl PresPayload for LinkPayload
impl PresPayload for LinkPayload
Source§fn project(&self) -> SerialValue
fn project(&self) -> SerialValue
impl StructuralPartialEq for LinkPayload
Auto Trait Implementations§
impl Forget for LinkPayload
impl Freeze for LinkPayload
impl Move for LinkPayload
impl RefUnwindSafe for LinkPayload
impl Send for LinkPayload
impl Sync for LinkPayload
impl Unpin for LinkPayload
impl UnsafeUnpin for LinkPayloadwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
impl UnwindSafe for LinkPayload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more