[][src]Struct lscolors::LsColors

pub struct LsColors { /* fields omitted */ }

Holds information about how different file system entries should be colorized / styled.

Methods

impl LsColors
[src]

pub fn empty() -> Self
[src]

Construct an empty LsColors instance with no pre-defined styles.

pub fn from_env() -> Option<Self>
[src]

Creates a new LsColors instance from the LS_COLORS environment variable.

pub fn from_string(input: &str) -> Self
[src]

Creates a new LsColors instance from the given string.

pub fn style_for_path<P: AsRef<Path>>(&self, path: P) -> Option<&Style>
[src]

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.

pub fn style_for_path_with_metadata<P: AsRef<Path>>(
    &self,
    path: P,
    metadata: Option<&Metadata>
) -> Option<&Style>
[src]

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.

Important traits for StyledComponents<'a>
pub fn style_for_path_components<'a>(
    &'a self,
    path: &'a Path
) -> StyledComponents<'a>
[src]

Get ANSI styles for each component of a given path. Components already include the path separator symbol, if required. For a path like foo/bar/test.md, this would return an iterator over three pairs for the three path components foo/, bar/ and test.md together with their respective styles.

pub fn style_for_indicator(&self, indicator: Indicator) -> Option<&Style>
[src]

Get the ANSI style for a certain Indicator (regular file, directory, symlink, ...). Note that this function implements a fallback logic for some of the indicators (just like ls). For example, the style for mi (missing file) falls back to or (orphaned symbolic link) if it has not been specified explicitly.

Trait Implementations

impl Default for LsColors
[src]

fn default() -> Self
[src]

Constructs a default LsColors instance with some default styles.

impl Clone for LsColors
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for LsColors
[src]

Auto Trait Implementations

impl Send for LsColors

impl Sync for LsColors

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]