RustConf 2026 gathered the Rust systems programming community for sessions on production patterns. UUID v7 appeared across multiple talks — in database ORMs, Axum web services, and binary protocol implementations. The consensus: the uuid crate’s v7 feature provides enough to replace all custom timestamp+random ID schemes in Rust services. See UUID in Rust for the full implementation guide.
Event details
| Conference | RustConf 2026 |
| Date | September 10–11, 2026 |
| Location | Seattle, WA, USA |
| Focus | UUID v7 in Rust — uuid crate, Diesel, Axum, binary protocols |
Key sessions
uuid crate v7 API
use uuid::{Uuid, Timestamp, NoContext};
use std::time::{SystemTime, UNIX_EPOCH};
fn new_uuid_v7() -> Uuid {
let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let ts = Timestamp::from_unix(NoContext, now.as_secs(), now.subsec_nanos());
Uuid::new_v7(ts)
}
// Simpler with uuid7 crate
// use uuid7::uuid7;
// let id = uuid7();
fn extract_timestamp_ms(id: &Uuid) -> u64 {
let b = id.as_bytes();
// Top 48 bits = Unix milliseconds
u64::from_be_bytes([0, 0, b[0], b[1], b[2], b[3], b[4], b[5]])
}
Axum handler with UUID v7
use axum::{
extract::{Path, State},
response::Json,
routing::{get, post},
Router,
};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Serialize)]
struct Order {
id: Uuid,
customer_id: Uuid,
status: String,
}
#[derive(Deserialize)]
struct CreateOrder {
customer_id: Uuid,
total: f64,
}
async fn create_order(
State(pool): State<DbPool>,
Json(body): Json<CreateOrder>,
) -> Json<Order> {
let id = new_uuid_v7();
let order = db::insert_order(&pool, id, body.customer_id, body.total).await;
Json(order)
}
async fn get_order(
State(pool): State<DbPool>,
Path(id): Path<Uuid>, // Axum parses UUID from path string
) -> Json<Order> {
let order = db::get_order(&pool, id).await;
Json(order)
}
pub fn router(pool: DbPool) -> Router {
Router::new()
.route("/orders", post(create_order))
.route("/orders/:id", get(get_order))
.with_state(pool)
}
Diesel + UUID v7 (see full guide)
See UUID v7 in Diesel ORM for Rust for the complete Diesel integration including schema macros, Insertable structs, and cursor pagination.
Zero-copy UUID v7 from binary buffer
// Parse UUID v7 from a 16-byte buffer without allocation
use uuid::Uuid;
fn parse_uuid_v7_bytes(buf: &[u8; 16]) -> Option<Uuid> {
let id = Uuid::from_bytes(*buf);
// Verify version = 7
if id.get_version_num() == 7 { Some(id) } else { None }
}
// Serialize UUID v7 to 16-byte buffer (for binary protocols)
fn uuid_to_bytes(id: Uuid) -> [u8; 16] {
*id.as_bytes()
}
Conference takeaways
uuidcrate v7 feature —Uuid::new_v7(ts)is production-ready; use a thread-local ClockSequence for monotonic ordering- Axum path extraction —
Path<Uuid>parses UUID v7 strings with zero extra code - Diesel
uuidfeature — mapsUuidto PostgreSQLuuidcolumns transparently - Binary protocols — UUID v7 is 16 bytes;
Uuid::from_bytesis zero-copy - No MAC leakage — UUID v7’s 74 random bits replace UUID v1’s MAC address field
Further reading
- UUID in Rust — uuid Crate Guide
- UUID v7 in Diesel ORM for Rust
- UUID v7 in Actix-web
- RustConf 2025 — UUID v7 in Rust
- UUID Bit Fields — Version and Variant
External references
Frequently asked questions
How do I generate UUID v7 in Rust?
Add uuid = { version = "1", features = ["v7"] } to Cargo.toml. Generate with Uuid::new_v7(Timestamp::now(NoContext)). In production, use a thread-local monotonic counter: implement ClockSequence to prevent collisions when multiple UUIDs are generated within the same millisecond. The uuid7 crate provides a simpler API: uuid7::uuid7(). See UUID in Rust.
How does UUID v7 integrate with Axum in Rust?
Use UUID v7 in Axum route handlers by deriving Deserialize for path parameters: Path(id): Path<Uuid>. Axum parses the UUID string automatically. For response bodies, derive Serialize on your model structs containing Uuid fields. Generate UUID v7 before inserting into the database: let id = Uuid::new_v7(ts). See UUID v7 in Actix-web.
How do I extract the timestamp from a UUID v7 in Rust?
Use uuid.get_timestamp() from the uuid crate — it returns Option<Timestamp>. For UUID v7, the timestamp is the Unix millisecond epoch. Convert with ts.to_unix().0 * 1000 + ts.to_unix().1 as u64 / 1_000_000. Alternatively, read the top 6 bytes directly: u64::from_be_bytes([0,0, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]]) . See UUID Bit Fields.