pub fn patch<T, U>(path: Path<T, U>, value: impl Assign<U>) -> Assignment<T>Expand description
Partially update a sub-field of an embedded type.
Takes a Path<T, U> (identifying which sub-field to update) and a
value (impl Assign<U> — either a plain value or a nested
Assignment<U> for deeper patching). Returns an Assignment<T>
that can be passed to the parent field’s setter.
§Examples
ⓘ
// Update a single sub-field
user.update()
.critter(stmt::patch(Creature::fields().human().profession(), "doctor"))
.exec(&mut db)
.await?;
// Nested patching
user.update()
.kind(stmt::patch(
Kind::variants().admin().perm(),
stmt::patch(Permission::fields().everything(), true),
))
.exec(&mut db)
.await?;