television_channels::channels

Trait OnAir

Source
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. The num_entries parameter specifies the number of entries to return and the offset 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§

Source

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.

Source

fn results(&mut self, num_entries: u32, offset: u32) -> Vec<Entry>

Get the results of the search (that are currently available).

Source

fn get_result(&self, index: u32) -> Option<Entry>

Get a specific result by its index.

Source

fn selected_entries(&self) -> &FxHashSet<Entry>

Get the currently selected entries.

Source

fn toggle_selection(&mut self, entry: &Entry)

Toggles selection for the entry under the cursor.

Source

fn result_count(&self) -> u32

Get the number of results currently available.

Source

fn total_count(&self) -> u32

Get the total number of entries currently available.

Source

fn running(&self) -> bool

Check if the channel is currently running.

Source

fn shutdown(&self)

Turn off

Implementors§