pub trait TextLaws<This>where
This: NavigationStateAlg + TextEditorStateAlg,{
// Required methods
fn text_editor_laws(&mut self) -> Result<()>;
fn check_law_editor(&self, text: &str, cursor: usize) -> Result<()>;
}Expand description
Authors the text-editing laws.
Required Methods§
Sourcefn text_editor_laws(&mut self) -> Result<()>
fn text_editor_laws(&mut self) -> Result<()>
Checks that editing moves by Unicode scalar and never splits one.
The laws checked are:
- the cursor moves by whole scalars in both directions;
- insertion advances past exactly the inserted bytes;
- deleting before and at the cursor removes one whole scalar;
- every observed cursor rests on a UTF-8 boundary.
§Errors
Returns the first violated law.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<This> TextLaws<This> for Thiswhere
This: NavigationStateAlg + TextEditorStateAlg,
Authors the text-editing laws.