pub struct Edit<R> { /* private fields */ }Expand description
A field edit of the record R: a path and an operation. See the module
docs.
Implementations§
Source§impl<R> Edit<R>
impl<R> Edit<R>
Sourcepub fn new(path: Vec<Segment>, op: EditOp) -> Self
pub fn new(path: Vec<Segment>, op: EditOp) -> Self
An edit from its parts, as read back from the wire.
pub fn path(&self) -> &[Segment]
pub fn op(&self) -> &EditOp
Sourcepub fn retyped<S>(self) -> Edit<S>
pub fn retyped<S>(self) -> Edit<S>
The same edit, of the record S: the path and operation it carries
do not depend on the record type.
Sourcepub fn coalesces(&self, next: &Self) -> boolwhere
R: Model,
pub fn coalesces(&self, next: &Self) -> boolwhere
R: Model,
Whether next, by the same actor straight after self, continues
the same gesture: one undo step. Setting one path again (dragging a
slider), typing on at the end of the previous splice (a word) and a
text field’s whole-text replacements that type or erase within one
word (replace_continues) continue; an edit in a type’s own vocabulary continues as that type
says (Operations::coalesces); anything else starts a new step.
Sourcepub fn risk(&self) -> RiskLevelwhere
R: Model,
pub fn risk(&self) -> RiskLevelwhere
R: Model,
How much harm this edit can do: removing an item of a collection is
destructive, like a delete verb, unless the collection is
#[model(remove = "quiet")]; every other edit is low.
Sourcepub fn tree_path(&self, workspace: &str, app: &str, record: &str) -> TreePathwhere
R: Resource,
pub fn tree_path(&self, workspace: &str, app: &str, record: &str) -> TreePathwhere
R: Resource,
The node of the published tree this edit acts on, for deciding
grants: workspace › app › kind › record [› item] › field… › field-edit.
The collection field holding an item is not a node of its own.
Sourcepub fn apply_local(&self, doc: &mut Doc) -> Result<(), ModelError>where
R: Fields,
pub fn apply_local(&self, doc: &mut Doc) -> Result<(), ModelError>where
R: Fields,
Apply to a document held apart from any resource (a form’s local value): no action, no history, ids minted from the document alone.
§Errors
As Self::apply.
Trait Implementations§
Source§impl<'de, R> Deserialize<'de> for Edit<R>
impl<'de, R> Deserialize<'de> for Edit<R>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl<R> JsonSchema for Edit<R>
impl<R> JsonSchema for Edit<R>
Auto Trait Implementations§
impl<R> Forget for Edit<R>
impl<R> Freeze for Edit<R>
impl<R> Move for Edit<R>
impl<R> RefUnwindSafe for Edit<R>
impl<R> Send for Edit<R>
impl<R> Sync for Edit<R>
impl<R> Unpin for Edit<R>
impl<R> UnsafeUnpin for Edit<R>
impl<R> UnwindSafe for Edit<R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FlatFields for Twhere
T: JsonSchema,
impl<T> FlatFields for Twhere
T: JsonSchema,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more