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).
Media
A video, track or other media item: its thumbnail, title, who made it (the channel or artist), and its duration.
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).
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.
Implementations§
§impl SearchRow
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
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
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>
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>
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 snippet(self, text: impl Into<String>) -> SearchRow
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
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
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
pub fn duration(self, text: impl Into<String>) -> SearchRow
A media item’s duration, already formatted (“12:04”).
Trait Implementations§
impl StructuralPartialEq for SearchRow
Auto Trait Implementations§
impl Freeze for SearchRow
impl !RefUnwindSafe for SearchRow
impl Send for SearchRow
impl Sync for SearchRow
impl Unpin for SearchRow
impl UnsafeUnpin for SearchRow
impl !UnwindSafe for SearchRow
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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 Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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