Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Migration Guide

From 0.x to 1.0

Version 1.0 freezes the public API and introduces some breaking changes.

1. RokError is non_exhaustive

You can no longer exhaustively match on RokError:

#![allow(unused)]
fn main() {
// 0.x
match err {
    RokError::NotFound(_) => ...,
    RokError::InvalidJson(_) => ...,
    // ... all variants
}

// 1.0 (requires wildcard arm)
match err {
    RokError::NotFound(_) => ...,
    RokError::InvalidJson(_) => ...,
    _ => ..., // Required
}
}

2. Lazy API Changes

The Lazy struct now uses once_cell::sync::Lazy internally:

#![allow(unused)]
fn main() {
// 0.x
let lazy = Lazy::new(|| 42);
assert!(lazy.is_initialized()); // removed

// 1.0
let lazy: Lazy<i32, fn() -> i32> = Lazy::new(|| 42);
let value = *lazy.get(); // returns &T instead of T
}

3. MSRV Bump

Minimum Supported Rust Version is now 1.92.

Update Error Handling

Add wildcard arm to prevent future breakage:

#![allow(unused)]
fn main() {
match error {
    RokError::NotFound(msg) => handle_not_found(msg),
    RokError::ValidationFailure { field, reason } => handle_validation(field, reason),
    _ => handle_internal_error(error),
}
}

Update Rust Toolchain

rustup update
rustup default stable