Struct lscolors::LsColors

source ·
pub struct LsColors { /* private fields */ }
Expand description

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

Implementations

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

Creates a new LsColors instance from the LS_COLORS environment variable.

Creates a new LsColors instance from the given string.

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.

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.

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

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Constructs a default LsColors instance with some default styles.

This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.