A set of crates providing glue code for Rust applications.
Until stabilized, usage in production code is strongly discouraged.
Certified Non AI Slop
Each crate in the elme framework was crafted by hand keyboard with care.
I take personal credit for the (hopefully) rare case where you believe some code to be of a sloppy nature.
For these cases, please open an issue or submit a PR - it's very much appreciated!
By default, elme ships with 0 dependencies and all modules disabled.
Modules can be enabled via feature flags:
cargo add elme --features [module_name]Cargo.toml example
[dependencies]
elme = { version = "0.0.1", features = ["config","shutdown"] }Note
Opting into modules using feature flags via the
elmecrate provides identical performance to manually depending on each module's respective crate.Therefore, depending on the
elmecrate as opposed to depending on each respective module crate is the recommended versioning strategy.
Module re-exports - each module is gated by a feature flag.
This is the the recommended method of integrating elme modules.
See the following list for feature flags relevant to each module.
elme-config is a very small convenience module.
Supported features:
- A
ConfigureApptrait for an app's root config struct- Contains default impl of a
load()method, reading vals from.envfiles + env vars - Replaces the need for any and all config logic in standard cases
- Contains default impl of a
- Pulls in
configanddotenvydeps, removing one-off dependency burden
| Flag | Description |
|---|---|
config |
Enables this module |
Provides types supporting:
- Managed/unmanaged database wrapper structs
- Managed db's are a superset of unmanaged w/ migration support
- Can optionally be used to scope query availability in associated
Repoimpl's, e.g.- Restrict repos backed by an
UnmanagedDatabaseto read-only queries (select, count, etc) - Provide additional access to mutable queries when the
Repois backed with aManagedDatabase
- Restrict repos backed by an
- Managed/unmanaged db config with types automatically mapped to
PgPoolOptions
And provides utility traits supporting:
Repotrait provides repository pattern on a per-table basis, with associatedRowtypes and a clean interface- Common query operations (insert one, insert many, etc) [
db-op-traitsfeature only]- Boilerplate logic auto impl'd, simply provide the statement and
query.bind()call - Allows for inline chaining of queries - with optional, automatic tx commit/rollback handling
- Boilerplate logic auto impl'd, simply provide the statement and
sqlx used with PostgreSQL databases.
Support may be extended in the future.
| Flag | Description |
|---|---|
db |
Enables this module |
db-op-traits |
Enables the op-traits feature of elme-db This feature includes traits used for repo operations (insert, batch insert, delete, etc) Feature docs |
Provides types for propagating errors, spantraces, and backtraces.
Similar functionality to eyre, color-eyre, anyhow, etc - with the following additions:
- Configuration of backtrace/spantrace format/visibility on a per-destination basis.
- Configuration of ANSI/color output on a per-destination basis.
For example, this could allow for the following (simultaneously):
- Output error messages with color backtraces in full to terminal
- Output error messages with non-color backtraces in full to a file
- Output error message strings to OTEL - with backtraces embedded in structured attra/metadata as opposed to the body
| Flag | Description |
|---|---|
error |
Enables this module |
Dead simple, frustration-free OpenTelemetry bootstrapping.
| Flag | Description |
|---|---|
otel |
Enables this module |
Please forward any letters of gratitude generated by the dependencies section of your
Cargo.tomlfile to our receiving dept.
Zero-effort lifecycle management: graceful shutdown, signal handling, task tracking, and more.
| Flag | Description |
|---|---|
shutdown |
Enables this module |
shutdown-progress |
Enables task + timeout progress bars during teardown |
shutdown-progress-writer |
Provides a tracing-subscriber writer for clean tracing + progress output |