Skip to main content

Crate slumber_util

Crate slumber_util 

Source
Expand description

Common utilities that aren’t specific to one other subcrate and are unlikely to change frequently. The main purpose of this is to pull logic out of the core crate, because that one changes a lot and requires constant recompilation.

This crate is not semver compliant. The version is locked to the root slumber crate version. If you choose to depend directly on this crate, you do so at your own risk of breakage.

Modules§

paths
yaml
Utilities for deserializing YAML. This does not use serde, and instead relies on saphyr for YAML parsing and hand-written deserialization. This allows us to provide much better error messages, and also enables source span tracking.

Macros§

deserialize_enum
Deserialize a YAML value as an internally tagged enum. The type field will contain the variant, and all other fields in the mapping will be deserialized using the given function.
impl_deserialize_from
Implement DeserializeYaml for a type T via type U, where T: From<U>, U: DeserializeYaml

Structs§

Mapping
A static mapping between values (of type T) and labels (strings). Used to both stringify from and parse to T.
TimeSpan
A newtype for Duration that provides formatting, parsing, and deserialization. The name is meant to make it harder to confuse with Duration.
TimeSpanParseError
Error for TimeSpan’s FromStr impl

Constants§

NEW_ISSUE_LINK
Link to the GitHub New Issue form

Traits§

OptionExt
Extension trait for Option
ResultTraced
Extension trait for Result
ResultTracedAnyhow
ResultTraced but for the anyhow result. This has to be a separate trait because we can’t put a blanket impl on std Error and anyhow::Result, as the two “could” conflict in the future.

Functions§

doc_link
Get a link to a page on the doc website. This will append the doc prefix, as well as the suffix.
git_link
Get a link to a file in the remote git repo. This is the raw link, not the fancy UI link. It will be pinned to tag of the current crate version.
initialize_tracing
Set up tracing to a log file, and optionally stderr as well. If there’s an error creating the log file, we’ll skip that part. This means in the TUI the error (and all other tracing) will never be visible, but that’s a problem for another day.
serialize_mapping
Serialize a list of tuples as a mapping