pub struct LsColors { /* fields omitted */ }
Holds information about how different file system entries should be colorized / styled.
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 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.
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.
Constructs a default LsColors
instance with some
default styles.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
type Owned = T
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
type Error = !
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
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.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static