pub struct LsColors { /* private fields */ }
Expand description
Holds information about how different file system entries should be colorized / styled.
Implementations
sourceimpl LsColors
impl LsColors
sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Creates a new LsColors
instance from the LS_COLORS
environment variable.
sourcepub fn from_string(input: &str) -> Self
pub fn from_string(input: &str) -> Self
Creates a new LsColors
instance from the given string.
sourcepub fn style_for_path<P: AsRef<Path>>(&self, path: P) -> Option<&Style>
pub fn style_for_path<P: AsRef<Path>>(&self, path: P) -> Option<&Style>
Get the ANSI style for a given path.
Note: this function calls Path::symlink_metadata
internally. If you already happen to
have the Metadata
available, use style_for_path_with_metadata
.
sourcepub fn style_for_path_with_metadata<P: AsRef<Path>>(
&self,
path: P,
metadata: Option<&Metadata>
) -> Option<&Style>
pub fn style_for_path_with_metadata<P: AsRef<Path>>(
&self,
path: P,
metadata: Option<&Metadata>
) -> Option<&Style>
Get the ANSI style for a path, given the corresponding Metadata
struct.
Note: The Metadata
struct must have been acquired via Path::symlink_metadata
in
order to colorize symbolic links correctly.
Trait Implementations
impl StructuralPartialEq for LsColors
Auto Trait Implementations
impl RefUnwindSafe for LsColors
impl Send for LsColors
impl Sync for LsColors
impl Unpin for LsColors
impl UnwindSafe for LsColors
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more