pub trait OnAir: Send {
// Required methods
fn find(&mut self, pattern: &str);
fn results(&mut self, num_entries: u32, offset: u32) -> Vec<Entry>;
fn get_result(&self, index: u32) -> Option<Entry>;
fn selected_entries(&self) -> &FxHashSet<Entry>;
fn toggle_selection(&mut self, entry: &Entry);
fn result_count(&self) -> u32;
fn total_count(&self) -> u32;
fn running(&self) -> bool;
fn shutdown(&self);
}
Expand description
The interface that all television channels must implement.
§Note
The OnAir
trait requires the Send
trait to be implemented as well.
This is necessary to allow the channels to be used with the tokio
runtime, which requires Send
in order to be able to send tasks between
worker threads safely.
§Methods
find
: Find entries that match the given pattern. This method does not return anything and instead typically stores the results internally for later retrieval allowing to perform the search in the background while incrementally polling the results.ⓘfn find(&mut self, pattern: &str);
results
: Get the results of the search (at a given point in time, see above). This method returns a specific portion of entries that match the search pattern. Thenum_entries
parameter specifies the number of entries to return and theoffset
parameter specifies the starting index of the entries to return.ⓘfn results(&mut self, num_entries: u32, offset: u32) -> Vec<Entry>;
get_result
: Get a specific result by its index.ⓘfn get_result(&self, index: u32) -> Option<Entry>;
result_count
: Get the number of results currently available.ⓘfn result_count(&self) -> u32;
total_count
: Get the total number of entries currently available (e.g. the haystack).ⓘfn total_count(&self) -> u32;
Required Methods§
Sourcefn find(&mut self, pattern: &str)
fn find(&mut self, pattern: &str)
Find entries that match the given pattern.
This method does not return anything and instead typically stores the
results internally for later retrieval allowing to perform the search
in the background while incrementally polling the results with
results
.
Sourcefn results(&mut self, num_entries: u32, offset: u32) -> Vec<Entry>
fn results(&mut self, num_entries: u32, offset: u32) -> Vec<Entry>
Get the results of the search (that are currently available).
Sourcefn get_result(&self, index: u32) -> Option<Entry>
fn get_result(&self, index: u32) -> Option<Entry>
Get a specific result by its index.
Sourcefn selected_entries(&self) -> &FxHashSet<Entry>
fn selected_entries(&self) -> &FxHashSet<Entry>
Get the currently selected entries.
Sourcefn toggle_selection(&mut self, entry: &Entry)
fn toggle_selection(&mut self, entry: &Entry)
Toggles selection for the entry under the cursor.
Sourcefn result_count(&self) -> u32
fn result_count(&self) -> u32
Get the number of results currently available.
Sourcefn total_count(&self) -> u32
fn total_count(&self) -> u32
Get the total number of entries currently available.