edit-session 0.1.0-beta.2

Toolkit-independent preview, validation and commit lifecycle
Documentation

edit-session

Beta 0.1.0-beta.2 includes the runnable local-helper comparison and the dependency source guide. Read the compatibility boundary before upgrading.

A small, toolkit-independent Rust library for preview, validation and commit lifecycles. no_std, zero runtime dependencies, Rust 1.88+. MIT OR Apache-2.0.

Use it when several controls edit one draft and the host should commit one final change. The host owns validation, preview rendering, commands, undo and document identity. This crate does not provide widgets or an undo stack.

Installation

Add a published copy of this prerelease to your dependencies:

[dependencies]
edit-session = "=0.1.0-beta.2"

This is an experimental beta. Pin an exact version and keep Cargo.lock for applications. Read the compatibility policy before upgrading. For other distribution options and current publication status, see the project README.

Example

use edit_session::EditSession;

let context = ("document-7", "layer-2", 42_u64);
let live_opacity = 100_u8;
let mut draft = EditSession::new(live_opacity, context);
draft.propose::<&str>(Ok(75)).unwrap();
draft.propose::<&str>(Ok(50)).unwrap();

if let Some(change) = draft.finish(&live_opacity, &context).unwrap() {
    assert_eq!(change.after, 50);
    // Send change.after to the host's validated command once.
}

finish consumes the session. If the host command can reject a change and the UI must retain the draft for retry, use the borrowed-preview/check pattern in the tested recovery example. Check the live value and context again on every attempt.

The separate interaction-check runner is optional and is not a dependency of this crate.