Struct Edit
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§
§impl<R> Edit<R>
impl<R> Edit<R>
pub fn new(path: Vec<Segment>, op: EditOp) -> Edit<R>
pub fn new(path: Vec<Segment>, op: EditOp) -> Edit<R>
An edit from its parts, as read back from the wire.
pub fn path(&self) -> &[Segment]
pub fn op(&self) -> &EditOp
pub 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.
pub fn coalesces(&self, next: &Edit<R>) -> boolwhere
R: Model,
pub fn coalesces(&self, next: &Edit<R>) -> 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) and typing on at the end of the previous splice (a word)
continue; an edit in a type’s own vocabulary continues as that type
says ([Operations::coalesces]); anything else starts a new step.
pub 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.
pub fn tree_path(&self, room: &str, app: &str, record: &str) -> TreePathwhere
R: Resource,
pub fn tree_path(&self, room: &str, app: &str, record: &str) -> TreePathwhere
R: Resource,
The node of the published tree this edit acts on, for deciding
grants: room › app › kind › record [› item] › field… › field-edit.
The collection field holding an item is not a node of its own.
pub fn apply_local(&self, doc: &mut AutoCommit) -> Result<(), ModelError>where
R: Fields,
pub fn apply_local(&self, doc: &mut AutoCommit) -> 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§
§impl<'de, R> Deserialize<'de> for Edit<R>
impl<'de, R> Deserialize<'de> for Edit<R>
§fn deserialize<D>(
deserializer: D,
) -> Result<Edit<R>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Edit<R>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl<R> Serialize for Edit<R>
impl<R> Serialize for Edit<R>
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl<R: Resource> Submit<R> for Edit<R>
impl<R: Resource> Submit<R> for Edit<R>
Source§fn into_invoke(self) -> Result<Invoke<R>, String>
fn into_invoke(self) -> Result<Invoke<R>, String>
Source§fn control_binding(self, actions: &Actions<R>) -> Option<ActionBinding<()>>
fn control_binding(self, actions: &Actions<R>) -> Option<ActionBinding<()>>
None
(and a failure in tests) when the resource does not publish it.Auto Trait Implementations§
impl<R> Freeze 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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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