pub struct TextVersion {
pub strs: u64,
pub tags: u64,
pub meta_tags: u64,
}Expand description
A representation of how many changes took place in a Text.
The purpose of this struct is merely to be compared with
previously acquired instances of itself, to just quickly check if
certain properties of the Text have changed.
Note that this is a Text agnostic struct, comparing the
TextVersions from two different Texts is pointless.
Fields§
§strs: u64The current version of the Strs.
Any change to the Strs, even undoing, will incur a version
increment.
the current version of Tags.
Any change to the Tags, be it addition or removal of
Tags, will incur a version increment.
The current version of meta Tags.
Meta tags are those that can change what is even shown on the
screen, all else being equal. Any addition or removal of meta
Tags will incur a version increment.
Implementations§
Source§impl TextVersion
impl TextVersion
Sourcepub fn has_changed_since(&self, other: Self) -> bool
pub fn has_changed_since(&self, other: Self) -> bool
Wether there have been any changes to the Text since
this previous instance.
Sourcepub fn strs_have_changed_since(&self, other: Self) -> bool
pub fn strs_have_changed_since(&self, other: Self) -> bool
Wether the Strs have changed since this previous instance.
Wether the Tags have changed since this previous instance.
Note that this only tracks if Tags have been
added/removed. So if, for example, you replace a range where
no Tags existed, this would return false, even though the
position of Tags have changed internally.
Sourcepub fn has_structurally_changed_since(&self, other: Self) -> bool
pub fn has_structurally_changed_since(&self, other: Self) -> bool
Wether this Text has “structurally changed” since this
previous instance.
A Text has structurally changed when printing it from the
same point could result in a different characters being
printed. This not only happens when the Strs change, but
also with certain Tags, like Ghost and Conceal,
which also add and remove characters to be printed.
These Tags are called “meta tags” internally, since they
change the very structure of what Text has been printed.
Trait Implementations§
Source§impl Clone for TextVersion
impl Clone for TextVersion
Source§fn clone(&self) -> TextVersion
fn clone(&self) -> TextVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more