Skip to main content

ScannedExcerpt

Struct ScannedExcerpt 

Source
pub struct ScannedExcerpt {
    pub line: u32,
    pub end_line: u32,
    pub group: String,
    pub label: String,
    pub sort_key: i64,
    pub spans: Vec<RowSpan>,
    pub annotation: Option<RowAnnotation>,
    pub emphasis: bool,
}
Expand description

One agenda row a producer found in a file.

The native mirror of the WIT entry (wit/scanned-excerpt-source.wit). It is a span in a file, not a rendered string, because the agenda is literally a multibuffer of excerpts — which is what buys jump-to-source and edit-propagates-to-source for free (org-mode.md §6.1).

Fields§

§line: u32

0-based first line of the row’s excerpt.

§end_line: u32

0-based last line of the excerpt, inclusive. Equal to line for the one-row-per-headline case.

§group: String

Grouping key. Rows that sort adjacently and share a key render under one header. A key rather than a label because a producer cannot know which of its rows lands first once other files’ rows are interleaved — the host compares keys after the sort.

§label: String

The header title, used when this row turns out to start a group.

§sort_key: i64

The host stable-sorts every file’s rows together on this, ascending. The producer owns what it means.

§spans: Vec<RowSpan>

How this row is coloured, as byte spans into the row’s own first line — NOT into the composed view, which the producer cannot see until every other file’s rows have been interleaved by the sort (OA.5).

Empty is the ordinary case, and means “say nothing about colour”: the source file’s own grammar highlighting is what shows, unchanged. A producer fills this when the row has semantics its grammar does not carry — an agenda’s TODO keyword, priority and tags are org’s, not the org grammar’s, which is why an agenda looked like org text out of order before this existed.

§annotation: Option<RowAnnotation>

A row to hang BELOW this one, or None (HB.5).

The WIT annotation, native side. A row’s text is a verbatim excerpt of a source line, so a producer with something of its own to show — a habit’s consistency graph — has nowhere to put it; this becomes a virtual row anchored below instead.

None is the ordinary case. A scan of plain TODOs grows no second rows.

§emphasis: bool

MH.A6: render this row’s header EMPHASISED, when it turns out to start a group.

Read only on the row that starts the group — the same rule label already lives by, and for the same reason: a producer cannot know which of its rows lands first after the sort, so it sets the field on every row of the group and the host reads whichever one wins. Setting it inconsistently across a group is a producer bug that shows as “sometimes emphasised”.

false is the ordinary case and leaves the header byte-identical to before this field existed.

Trait Implementations§

Source§

impl Clone for ScannedExcerpt

Source§

fn clone(&self) -> ScannedExcerpt

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 ScannedExcerpt

Source§

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

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

impl Eq for ScannedExcerpt

Source§

impl PartialEq for ScannedExcerpt

Source§

fn eq(&self, other: &ScannedExcerpt) -> 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 ScannedExcerpt

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

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

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