Skip to main content

SearchRow

Enum SearchRow 

pub enum SearchRow {
    Message {
        sender: String,
        subject: String,
        snippet: Option<String>,
        date: Option<String>,
        unread: bool,
    },
    Media {
        thumbnail: Option<AppImage>,
        title: String,
        byline: Option<String>,
        duration: Option<String>,
    },
    FileHit {
        path: String,
        line: Option<u32>,
        snippet: String,
        matched: Option<Range<usize>>,
    },
    Command(Box<CommandRow>),
    Item {
        app: String,
        kind: String,
        id: String,
    },
}
Expand description

The shape of one search hit’s row.

Variants§

§

Message

A message: who sent it, its subject, a snippet of its body, when it arrived, and whether it is unread (a dot before the sender).

Fields

§sender: String
§subject: String
§snippet: Option<String>
§unread: bool
§

Media

A video, track or other media item: its thumbnail, title, who made it (the channel or artist), and its duration.

Fields

§thumbnail: Option<AppImage>
§title: String
§byline: Option<String>
§duration: Option<String>
§

FileHit

A match inside a file: the file’s path, the line, and the matched line itself with the matched span marked (byte range into snippet).

Fields

§path: String
§line: Option<u32>
§snippet: String
§matched: Option<Range<usize>>
§

Command(Box<CommandRow>)

A command, place or person: the title over an optional description (the result’s subtitle), with what leads and trails it.

§

Item

An item of a published resource: the app that keeps it, the item’s kind and its id. A hit is a reference to what it opens, never a copy of it: choosing one runs the app’s open at the item, and the row it is drawn with is the app’s own. An entry the app gives a shape of its own (Self::Message, Self::Media) says how it reads already; one without any is this.

Fields

§app: String

The app that keeps the item (so.tilo.notes).

§kind: String

The item’s kind (notes.notebook.pages).

§id: String

The item’s id in that app.

Implementations§

§

impl SearchRow

pub fn message( sender: impl Into<String>, subject: impl Into<String>, ) -> SearchRow

pub fn media(title: impl Into<String>) -> SearchRow

pub fn file_hit( path: impl Into<String>, snippet: impl Into<String>, ) -> SearchRow

A file-hit row for snippet, the matched line of path.

pub fn item( app: impl Into<String>, kind: impl Into<String>, id: impl Into<String>, ) -> SearchRow

The item id of the kind kind in app, as a reference.

pub fn item_of(app: impl Into<String>, resource: &str) -> Option<SearchRow>

The item row for resource (notes.notebook/pages/<id>) of app: what a hit on a resource an app publishes as items is drawn with. None when resource names no item of an app (a whole notebook, an app’s own surface), which is drawn as the generic row.

pub fn item_resource(&self) -> Option<String>

The resource id of the item this row is, when it is one: <resource>/<collection>/<id> (notes.notebook/pages/<id>), the address its app’s open shows. None for a row that names no item.

pub fn item_app(&self) -> Option<&str>

The app keeping the item this row is, when it is one.

pub fn snippet(self, text: impl Into<String>) -> SearchRow

The message’s body snippet, or a file hit’s matched line.

pub fn date(self, text: impl Into<String>) -> SearchRow

When a message arrived, already formatted (“Tue”, “12 Mar”).

pub fn unread(self, on: bool) -> SearchRow

pub fn thumbnail(self, image: AppImage) -> SearchRow

pub fn byline(self, text: impl Into<String>) -> SearchRow

The channel, artist or author of a media item.

pub fn duration(self, text: impl Into<String>) -> SearchRow

A media item’s duration, already formatted (“12:04”).

pub fn line(self, number: u32) -> SearchRow

The 1-based line of a file hit.

pub fn matched(self, range: Range<usize>) -> SearchRow

The matched span of a file hit’s snippet, as a byte range. A range that is not on character boundaries of the snippet is ignored.

pub fn spoken(&self) -> String

The text a screen reader announces for the row, in reading order.

pub fn location(&self) -> Option<String>

The row’s location line: path:line for a file hit.

Trait Implementations§

§

impl Clone for SearchRow

§

fn clone(&self) -> SearchRow

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
§

impl Debug for SearchRow

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for SearchRow

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl StructuralPartialEq for SearchRow

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
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

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<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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
§

impl<T> CommonTraits for T
where T: AsAny + Any + Debug + WasmNotSendSync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,