Files
craft-libs/crates/tracked/Cargo.toml
T
aiongg b083a40316 craft-tracked: Tracked<T>, PlainData and its derive, field! and Bind::tracked
Tracked<T> owns its value, a process-unique source id and a write count. Deref
reads; DerefMut, edit and a Field's writes move the count, and a clone is a new
source. T must be PlainData, a marker with no implementation for interior
mutability, raw pointers, dyn objects or closures, so no write can bypass the
count. #[derive(PlainData)] in ui-macros checks every field through a field-check
helper the plain-data derives share; #[plain_data(assume = "reason")] skips one
field of a foreign plain type.

field!(a.b) builds a read and a write projection from a field path only.
Bind::tracked(&mut t, field!(a.b)) reads through the read projection and moves
the revision only when an edit changes the field.
2026-11-19 06:47:09 +00:00

18 lines
503 B
TOML

[package]
name = "craft-tracked"
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
repository.workspace = true
description = "Tracked<T>: app data whose every write moves a revision, so a reader compares two integers instead of the data"
[lints]
workspace = true
# No dependencies, so engine crates can hold and move a revision without the UI.
[dev-dependencies]
# `#[derive(PlainData)]` in the doc tests.
craft-ui-macros = { workspace = true }