Cargo: workspace inheritance
Since 1.64.0, Cargo now supports workspace inheritance, so you can avoid duplicating similar field values between crates while working within a workspace. Workspace inheritance can include things like shared version numbers, repository URLs, or rust-version.
This also helps keep these values in sync between crates when updating them. This makes it easier to handle large workspaces.
File: [ROOT]/Cargo.toml
[workspace]
members = ["a", "b"]
[workspace.package]
version = "1.2.3"
[workspace.dependencies]
serde = "1.0.145"
anyhow = "1.0.65"
File: [ROOT]/a/Cargo.toml
[package]
name = "a"
# use the package version from [ROOT]/Cargo.toml
version.workspace = true
[dependencies]
# use `serde` version from [ROOT]/Cargo.toml
serde = { workspace = true }
# use `anyhow` version from [ROOT]/Cargo.toml
anyhow.workspace = true
For more details, see workspace.package,
workspace.dependencies,
and "inheriting a dependency from a workspace".
References
Related Posts
Cargo: Patch Dependencies
There are several scenarios when you will need to override or patch upstream dependencies. Like testing a bugfix of your crates before pushing to crates.io, a non-working upstream crate has a new feature or a bug fix on the master branch of its git repository that you'd want to try, etc. In these cases, the [patch] section of Cargo.toml might be useful.
Rust: Why ? is good
In Rust, the question mark (?) operator is used as an alternate error propagation method for functions that yield Result or Option types. The ? operator is a shortcut that minimizes the amount of code required in a function to quickly return Err or None from the types Result<T, Err>, or Option.
Apache OpenDAL in Rust to Access Any Kind of Data Services
OpenDAL is a data access layer that allows users to easily and efficiently retrieve data from various storage services in a unified way such as S3, FTP, FS, Google Drive, HDFS, etc. They has been rewritten in Rust for the Core and have a binding from many various language like Python, Node.js, C, etc..
Fossil Data Platform Rewritten in Rust 🦀
My data engineering team at Fossil recently released some of Rust-based components of our Data Platform after faced performance and maintenance challenges of the old Python codebase. I would like to share the insights and lessons learned during the process of migrating Fossil's Data Platform from Python to Rust.