Enum TextEdit
pub enum TextEdit {
Splice {
at: usize,
delete: usize,
insert: String,
},
ReplaceText {
text: String,
},
}Expand description
One edit of plain text. Positions count characters (Unicode scalar values), whatever the document’s own text encoding.
Variants§
Splice
Replace delete characters at at with insert: typing is a
splice that deletes nothing, Backspace one that inserts nothing.
ReplaceText
Replace the whole text with text, written as the smallest splice
that turns what the document holds into it, so a collaborator’s
concurrent typing elsewhere survives.
Implementations§
§impl TextEdit
impl TextEdit
pub fn apply_under(
&self,
doc: &mut AutoCommit,
obj: &ExId,
) -> Result<(), ActionError>
pub fn apply_under( &self, doc: &mut AutoCommit, obj: &ExId, ) -> Result<(), ActionError>
Apply this edit to the text object obj of another resource.
§Errors
Returns ActionError::Refused when obj is not a text object or
the splice reaches past the end of the text; nothing is written.
pub fn apply_to(
&self,
doc: &mut AutoCommit,
obj: &ExId,
current: &str,
) -> Result<(), ActionError>
pub fn apply_to( &self, doc: &mut AutoCommit, obj: &ExId, current: &str, ) -> Result<(), ActionError>
Self::apply_under when the caller already read current, the
text obj holds now: a large text is not read a second time.
§Errors
Trait Implementations§
§impl Action for TextEdit
impl Action for TextEdit
§fn apply(&self, doc: &mut AutoCommit) -> Result<(), ActionError>
fn apply(&self, doc: &mut AutoCommit) -> Result<(), ActionError>
A record’s own text, created by the first edit.
§fn locus(&self) -> ExecutionLocus
fn locus(&self) -> ExecutionLocus
ExecutionLocus::ClientLocal.§fn risk(&self) -> RiskLevel
fn risk(&self) -> RiskLevel
Destructive,
trimming one is not), and the host asks for the same confirmation a
declared destructive action gets whenever
requires_confirmation
holds. Must be a pure function of self. Defaults to
Low.§fn inverse_before(&self, doc: &AutoCommit) -> Option<Self>where
Self: Sized,
fn inverse_before(&self, doc: &AutoCommit) -> Option<Self>where
Self: Sized,
apply records an
outside consequence in the document (an outbox entry, a filesystem op
queue). Computed against the document before this action runs, so a
delete can still read the row it removes. Read more§fn inverse_encoded(&self, doc: &AutoCommit) -> Option<EncodedAction>
fn inverse_encoded(&self, doc: &AutoCommit) -> Option<EncodedAction>
inverse_before as an encoded action, so the
door can undo through apply after the concrete type has been erased. Read more§fn change_kind(&self) -> ChangeKind
fn change_kind(&self) -> ChangeKind
ActionContext, where a
workspace activity feed reads it. Must be a pure function of self.
Defaults to Content.§fn action_kind(&self) -> ActionKind
fn action_kind(&self) -> ActionKind
§fn incoming_message(&self) -> bool
fn incoming_message(&self) -> bool
INCOMING_MESSAGE_FACET. Must be a
pure function of self.§fn irreversible(&self) -> bool
fn irreversible(&self) -> bool
IRREVERSIBLE_TAG. Must be
a pure function of self.§fn describe(&self, doc: &AutoCommit) -> Option<Described>
fn describe(&self, doc: &AutoCommit) -> Option<Described>
doc as it is before the
value applies, on the origin only; replicas replay it with the
change. None lets the executor describe the value as the verb its
encoded form names (crate::Described::from_encoded).§impl<'de> Deserialize<'de> for TextEdit
impl<'de> Deserialize<'de> for TextEdit
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextEdit, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextEdit, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for TextEdit
impl Serialize for TextEdit
§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,
impl Eq for TextEdit
impl StructuralPartialEq for TextEdit
Auto Trait Implementations§
impl Freeze for TextEdit
impl RefUnwindSafe for TextEdit
impl Send for TextEdit
impl Sync for TextEdit
impl Unpin for TextEdit
impl UnsafeUnpin for TextEdit
impl UnwindSafe for TextEdit
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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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