pub struct Marks {
pub index: usize,
/* private fields */
}Expand description
Holds the marks created by the user.
It’s an ordered map between any char (except :, and control char) and a PathBuf.
Fields§
§index: usizeImplementations§
Source§impl Marks
impl Marks
Sourcepub fn setup(&mut self)
pub fn setup(&mut self)
Reads the marks stored in the config file (~/.config/fm/marks.cfg). If an invalid marks is read, only the valid ones are kept and the file is saved again.
Sourcepub fn get(&self, key: char) -> Option<PathBuf>
pub fn get(&self, key: char) -> Option<PathBuf>
Returns an optional marks associated to a char bind.
Sourcepub fn new_mark(&mut self, ch: char, path: &Path) -> Result<()>
pub fn new_mark(&mut self, ch: char, path: &Path) -> Result<()>
Store a new mark in the config file. If an update is done, the marks are saved again.
§Errors
It may fail if writing to the marks file fails.
pub fn remove_selected(&mut self) -> Result<()>
Sourcepub fn as_strings(&self) -> Vec<String>
pub fn as_strings(&self) -> Vec<String>
Returns a vector of strings like “d: /dev” for every mark.
Sourcepub fn char_for(&self, path: &Path) -> &char
pub fn char_for(&self, path: &Path) -> &char
Returns the char for associated to a path. For marked path, it’s their mark, Otherwise it’s ’ ’
Sourcepub fn move_path(&mut self, old_path: &Path, new_path: &Path) -> Result<()>
pub fn move_path(&mut self, old_path: &Path, new_path: &Path) -> Result<()>
Change mark path from old_path to new_path and write the marks to disk
Sourcepub fn remove_path(&mut self, old_path: &Path) -> Result<()>
pub fn remove_path(&mut self, old_path: &Path) -> Result<()>
Remove a path from marks. Does nothing if the path isn’t marked. If the path is marked, it’s removed everywhere (paths_to_mark, content and used_ch). The marks are then saved.
Trait Implementations§
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: selected, content, push, style.
selected returns an optional reference to the value.
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: selected, content, push, style.
selected returns an optional reference to the value.
Source§impl Selectable 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, set_index and selected_is_last.
impl Selectable 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, set_index and selected_is_last.
Auto Trait Implementations§
impl Freeze for Marks
impl RefUnwindSafe for Marks
impl Send for Marks
impl Sync for Marks
impl Unpin for Marks
impl UnsafeUnpin for Marks
impl UnwindSafe for Marks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.