Content

Trait Content 

Source
pub trait Content<T>: Selectable {
    // Required methods
    fn selected(&self) -> Option<&T>;
    fn content(&self) -> &Vec<T>;
    fn push(&mut self, t: T);
    fn style(&self, index: usize, style: &Style) -> Style;
}
Expand description

Allow access to a content element of any type. It allows to access the selected element, the whole content, to push new elements and to get the style of an element for display.

Its implementation should be done using the crate::impl_content macro which allows to manipulate any kind of content. It’s used for almost every menu or list of things, as long as the whole content is known at some point.

Major exception is crate::modes::FuzzyFinder which doesn’t store the matches.

Required Methods§

Source

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

Returns the selected element if content isn’t empty

Source

fn content(&self) -> &Vec<T>

Reference to the content as a vector.

Source

fn push(&mut self, t: T)

add an element to the content

Source

fn style(&self, index: usize, style: &Style) -> Style

ratatui::style::Style used to display an element

Implementors§

Source§

impl Content<&'static str> for ContextMenu

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<(char, PathBuf)> for Marks

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<Mountable> for Mount

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<Option<PathBuf>> for TempMarks

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<String> for Completion

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<String> for Picker

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<String> for TuiApplications

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<PathBuf> for Flagged

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<PathBuf> for History

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<PathBuf> for Shortcut

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<Entry> for OpendalContainer

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.

Source§

impl Content<FileInfo> for Directory

Implement a selectable content for this struct. This trait allows to navigate through a vector of element content_type. It implements: is_empty, len, next, prev, selected. selected returns an optional reference to the value.