Struct fm::status::Status

source ·
pub struct Status {
Show 17 fields pub tabs: [Tab; 2], pub index: usize, pub flagged: Flagged, pub marks: Marks, pub dual_pane: bool, pub system_info: System, pub display_full: bool, pub preview_second: bool, pub opener: Opener, pub help: String, pub trash: Trash, pub encrypted_devices: DeviceOpener, pub compression: Compresser, pub nvim_server: String, pub force_clear: bool, pub bulk: Bulk, pub shell_menu: ShellMenu, /* private fields */
}
Expand description

Holds every mutable parameter of the application itself, except for the “display” information. It holds 2 tabs (left & right), even if only one can be displayed sometimes. It knows which tab is selected, which files are flagged, which jump target is selected, a cache of normal file colors, if we have to display one or two tabs and if all details are shown or only the filename. Mutation of this struct are mostly done externally, by the event crate : crate::event_exec.

Fields§

§tabs: [Tab; 2]

Vector of Tab, each of them are displayed in a separate tab.

§index: usize

Index of the current selected tab

§flagged: Flagged

The flagged files

§marks: Marks

Marks allows you to jump to a save mark

§dual_pane: bool

do we display one or two tabs ?

§system_info: System§display_full: bool

do we display all info or only the filenames ?

§preview_second: bool

use the second pane to preview auto

§opener: Opener

The opener used by the application.

§help: String

The help string.

§trash: Trash

The trash

§encrypted_devices: DeviceOpener

Encrypted devices opener

§compression: Compresser

Compression methods

§nvim_server: String

NVIM RPC server address

§force_clear: bool§bulk: Bulk§shell_menu: ShellMenu

Implementations§

source§

impl Status

source

pub const MAX_PERMISSIONS: u32 = 511u32

Max valid permission number, ie 0o777.

source

pub fn new( args: Args, height: usize, term: Arc<Term>, help: String, terminal: &str ) -> FmResult<Self>

Creates a new status for the application. It requires most of the information (arguments, configuration, height of the terminal, the formated help string).

source

pub fn next(&mut self)

Select the other tab if two are displayed. Does nother otherwise.

source

pub fn prev(&mut self)

Select the other tab if two are displayed. Does nother otherwise.

source

pub fn selected(&mut self) -> &mut Tab

Returns a mutable reference to the selected tab.

source

pub fn selected_non_mut(&self) -> &Tab

Returns a non mutable reference to the selected tab.

source

pub fn reset_tabs_view(&mut self) -> FmResult<()>

Reset the view of every tab.

source

pub fn toggle_flag_on_path(&mut self, path: &Path)

Toggle the flagged attribute of a path.

source

pub fn skim_output_to_tab(&mut self) -> FmResult<()>

Replace the tab content with the first result of skim. It calls skim, reads its output, then update the tab content.

source

pub fn skim_line_output_to_tab(&mut self) -> FmResult<()>

Replace the tab content with the first result of skim. It calls skim, reads its output, then update the tab content. The output is splited at : since we only care about the path, not the line number.

source

pub fn filtered_flagged_files(&self) -> Vec<&Path>

Returns a vector of path of files which are both flagged and in current directory. It’s necessary since the user may have flagged files OUTSIDE of current directory before calling Bulkrename. It may be confusing since the same filename can be used in different places.

source

pub fn cut_or_copy_flagged_files( &mut self, cut_or_copy: CopyMove ) -> FmResult<()>

Execute a move or a copy of the flagged files to current directory. A progress bar is displayed (invisible for small files) and a notification is sent every time, even for 0 bytes files…

source

pub fn clear_flags_and_reset_view(&mut self) -> FmResult<()>

Empty the flagged files, reset the view of every tab.

source

pub fn set_permissions<P>(path: P, permissions: u32) -> FmResult<()>where P: AsRef<Path>,

Set the permissions of the flagged files according to a given permission. If the permission are invalid or if the user can’t edit them, it may fail.

source

pub fn select_from_regex(&mut self) -> Result<(), Error>

Flag every file matching a typed regex.

source

pub fn select_tab(&mut self, index: usize) -> FmResult<()>

Select a tab according to its index. It’s deprecated and is left mostly because I’m not sure I want tabs & panes… and I haven’t fully decided yet. Since I’m lazy and don’t want to write it twice, it’s left here.

source

pub fn refresh_disks(&mut self)

Refresh every disk information. It also refreshes the disk list, which is usefull to detect removable medias. It may be very slow… There’s surelly a better way, like doing it only once in a while or on demand.

source

pub fn disks(&self) -> &[Disk]

Returns an array of Disks

source

pub fn disk_spaces_per_tab(&self) -> (String, String)

Returns a pair of disk spaces for both tab.

source

pub fn disks_mounts(disks: &[Disk]) -> Vec<&Path>

Returns the mount points of every disk.

source

pub fn term_size(&self) -> FmResult<(usize, usize)>

Returns the sice of the terminal (width, height)

source

pub fn selected_path_str(&self) -> &str

Returns a string representing the current path in the selected tab.

source

pub fn refresh_users(&mut self) -> FmResult<()>

Refresh the existing users.

source

pub fn remove_tree(&mut self) -> FmResult<()>

Drop the current tree, replace it with an empty one.

source

pub fn read_encrypted_devices(&mut self) -> FmResult<()>

Updates the encrypted devices

source

pub fn force_preview(&mut self, colors: &Colors) -> FmResult<()>

Force a preview on the second pane

source

pub fn set_dual_pane_if_wide_enough(&mut self, width: usize) -> FmResult<()>

Set dual pane if the term is big enough

source

pub fn must_quit(&self) -> bool

True if a quit event was registered in the selected tab.

source

pub fn force_clear(&mut self)

Auto Trait Implementations§

§

impl !RefUnwindSafe for Status

§

impl Send for Status

§

impl !Sync for Status

§

impl Unpin for Status

§

impl !UnwindSafe for Status

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for Twhere T: Any,

source§

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

source§

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

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> UnsafeAny for Twhere T: Any,