Skip to main content

ListingEntry

Struct ListingEntry 

Source
pub struct ListingEntry {
    pub path: PathBuf,
    pub is_dir: bool,
    pub icon_byte: u32,
    pub name_byte_len: u32,
}
Expand description

One row of a listing, in the shape entry presentation needs: where it points and whether it is a directory.

This is the type the minor and both majors share. It exists because activation alone needs no dependency between them — the [ActivationPolicy] names major ids — but the entry data does: the mode has to know, per row, what to draw an icon for. Both majors already modelled this, differently (crate::oil::OilEntry as { name, is_dir }, crate::file_tree::FileTreeEntry as { path, depth, kind }), and converging those two onto this one is DL.6.

Fields§

§path: PathBuf

Path the row refers to. Absolute where the major knows the directory; otherwise a bare file name, which is enough for the icon lookup (it inspects only the file name and extension).

§is_dir: bool§icon_byte: u32

Byte offset within the row where the icon is spliced.

0 for a flat listing (oil), whose rows are bare filenames. The file tree indents and prefixes an expand marker, so its icon anchors after those — at byte 0 the glyph would land to the left of the indent and the tree’s shape would collapse.

§name_byte_len: u32

Byte length of the entry NAME, which begins at Self::icon_byte (the icon is virtual text and occupies no source byte).

Carried rather than re-derived, because neither the path nor the icon anchor is enough to recover it. path.file_name() is wrong for the tree’s root row, whose text is the whole path; and “icon_byte to end of line” needs the rope, which would put a per-publish as_string() of the entire listing on the actor thread to learn something both majors already computed when they rendered the row.

Trait Implementations§

Source§

impl Clone for ListingEntry

Source§

fn clone(&self) -> ListingEntry

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 ListingEntry

Source§

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

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

impl Eq for ListingEntry

Source§

impl PartialEq for ListingEntry

Source§

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

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