Radar · Rust · Archive · Week 16 · Apr 14 – 20, 2025
rust‑query 0.4 release
Worth knowingecosystem
- What changed
- rust‑query 0.4 adds structural types and other new features.
- Production impact
- The source does not say.
- Try it
- Add
rust-query = "0.4"to a Cargo.toml and write a query that uses a structural type. - Source
- this-week-in-rust.org/blog/2025/04/16/this-week-in-rust-595/
Understand it, then run it
rust-query 0.4 adds *structural types* and other new features to the crate. Structural types let you treat a struct as a set of its fields without naming the type itself. This means you can write code that works with any struct that has the required fields, regardless of its concrete name. The crate also introduces several helper macros and functions that simplify building queries.
Run it now
// This program demonstrates the problem that rust‑query 0.4 solves.
// The crate is not yet available in the standard library, so this
// code will not compile until the structural‑type feature ships.
// It shows how you would normally write a query without structural types.
fn main() {
// Imagine we have a struct `User { id: i32, name: String }`.
// With rust‑query 0.4 you could write:
// let users = query::<{ id: i32, name: String }>().execute();
// Here we just print a placeholder.
println!("Structural types are not yet available in this sandbox.");
}
What it printed when we ran it on Rust 1.98.1 (edition 2024)
Structural types are not yet available in this sandbox.
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed