Skip to main content

Model

Struct Model 

Source
pub struct Model {
Show 13 fields pub path: String, pub current_directory: String, pub allowed_types: Vec<String>, pub key_map: KeyMap, pub show_permissions: bool, pub show_size: bool, pub show_hidden: bool, pub dir_allowed: bool, pub file_allowed: bool, pub file_selected: String, pub auto_height: bool, pub cursor: String, pub styles: Styles, /* private fields */
}
Expand description

Model represents a file picker.

Fields§

§path: String

Path is the path which the user has selected with the file picker.

§current_directory: String

CurrentDirectory is the directory that the user is currently in.

§allowed_types: Vec<String>

AllowedTypes specifies which file types the user may select. If empty the user may select any file.

§key_map: KeyMap

The key bindings for the file picker.

§show_permissions: bool

Whether to show permissions.

§show_size: bool

Whether to show file sizes.

§show_hidden: bool

Whether to show hidden files.

§dir_allowed: bool

Whether directories can be selected.

§file_allowed: bool

Whether files can be selected.

§file_selected: String

The currently selected file.

§auto_height: bool

Whether the height is automatically managed.

§cursor: String

The cursor string.

§styles: Styles

The styles of the file picker.

Implementations§

Source§

impl Model

Source

pub fn set_height(&mut self, h: usize)

SetHeight sets the height of the file picker.

Source

pub fn height(&self) -> usize

Height returns the height of the file picker.

Source

pub fn init(&self) -> Cmd

Init initializes the file picker model.

Source

pub fn update(&mut self, msg: &dyn Msg) -> Cmd

Update handles user interactions within the file picker model.

Source

pub fn view(&self) -> String

View returns the view of the file picker.

Source

pub fn did_select_file(&self, msg: &dyn Msg) -> (bool, String)

DidSelectFile returns whether a user has selected a file (on this msg).

Source

pub fn did_select_disabled_file(&self, msg: &dyn Msg) -> (bool, String)

DidSelectDisabledFile returns whether a user tried to select a disabled file (on this msg).

Source

pub fn highlighted_path(&self) -> String

HighlightedPath returns the path of the currently highlighted file or directory.

Trait Implementations§

Source§

impl Debug for Model

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Msg for T
where T: Any + Send + Sync + Debug,

Source§

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

Helper to downcast to Any.
Source§

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

Consumes the boxed message and returns it as a Box<dyn Any>, so the program can move the concrete message out of the trait object (used to dispatch the commands carried by BatchMsg/SequenceMsg).
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.