You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Serenity is currently packaged as one massive crate that bundles several modules. Each of these modules may be included/excluded via Cargo's feature flags (see example below).
I propose that we modularize Serenity as sub-crates (i.e., serenity-model, serenity-http, serenity-cache, etc.) instead of modules. In doing so, the main serenity crate effectively becomes a "stub crate" which simply re-exports from its sub-crates.
Advantages
No user-facing breaking changes are necessary.
We may simply re-export the sub-crates from the main serenity crate as if they were modules.
From the consumer's perspective, dependencies can be made on specific sub-crates.
We no longer have to download the entire repository of module source files.
If we aim to target only one feature (e.g., the data models), we may opt to just directly depend on the sub-crate (i.e., serenity-model) rather than the serenity crate proper.
Sub-crate compilation may be further parallelized.
This is because serenity will no longer be just a single compilation unit.
Cargo may freely compile sub-crates in parallel as long as dependencies are preserved.
Greater flexibility in patch releases.
Sub-crates no longer have to wait for a proper release of the main serenity crate to be bumped.
Disadvantages
Certain optimizations (e.g., function inlining) may be less visible to the compiler by default (via cargo build --release) when compiling sub-crates (i.e., separate compilation units).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Proposal
Serenity is currently packaged as one massive crate that bundles several modules. Each of these modules may be included/excluded via Cargo's feature flags (see example below).
serenity/Cargo.toml
Lines 172 to 188 in f42ec02
I propose that we modularize Serenity as sub-crates (i.e.,
serenity-model
,serenity-http
,serenity-cache
, etc.) instead of modules. In doing so, the mainserenity
crate effectively becomes a "stub crate" which simply re-exports from its sub-crates.Advantages
serenity
crate as if they were modules.serenity-model
) rather than theserenity
crate proper.serenity
will no longer be just a single compilation unit.serenity
crate to be bumped.Disadvantages
cargo build --release
) when compiling sub-crates (i.e., separate compilation units).Prior Art
futures-rs
- Zero-cost asynchronous programming in Rust.Beta Was this translation helpful? Give feedback.
All reactions