Enum yrs::block::ItemContent [−][src]
pub enum ItemContent {
Any(Vec<Any>),
Binary(Vec<u8>),
Deleted(u32),
Doc(String, Any),
JSON(Vec<String>),
Embed(String),
Format(String, String),
String(String),
Type(BranchRef),
}
Expand description
An enum describing the type of a user content stored as part of one or more (if items were squashed) insert operations.
Variants
Any JSON-like primitive type range.
A binary data eg. images.
Deleted(u32)
A marker for delete item data, which describes a number of deleted elements. Deleted elements also don’t contribute to an overall length of containing collection type.
Tuple Fields of Deleted
0: u32
Embed(String)
Tuple Fields of Embed
0: String
Formatting attribute entry. Format attributes are not considered countable and don’t contribute to an overall length of a collection they are applied to.
String(String)
A chunk of text, usually applied by collaborative text insertion.
Tuple Fields of String
0: String
Type(BranchRef)
A reference of a branch node. Branch nodes define a complex collection types, such as arrays, maps or XML elements.
Tuple Fields of Type
0: BranchRef
Implementations
Returns a reference number used to determine a content type. It’s used during encoding/decoding of a containing block.
Checks if item content can be considered countable. Countable elements contribute to a length of the block they are contained by. Most of the item content variants are countable with exception for ItemContent::Deleted (which length describes number of removed elements) and ItemContent::Format (which is used for storing text formatting tags).
Returns a number of separate elements contained within current item content struct.
Separate elements can be split in order to put another block in between them. Definition of separation depends on a item content kin, eg. ItemContent::String, ItemContent::Any, ItemContent::JSON and ItemContent::Deleted can have variable length as they may be split by other insert operations. Other variants (eg. ItemContent::Binary) are considered as a single element and therefore their length is always 1 and are not considered as subject of splitting.
In cases of counting number of visible elements, len
method should be used together with
ItemContent::is_countable.
Returns a formatted content of an item. For complex types (represented by BranchRef nodes) it will return a target type of a branch node (eg. Yrs Array, Map or XmlElement). For other types it will returns a vector of elements stored within current block. Since block may describe a chunk of values within it, it always returns a vector of values.
Similar to [get_content], but it only returns the latest result and doesn’t materialize others for performance reasons.
Tries to squash two item content structures together.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl !RefUnwindSafe for ItemContent
impl !Send for ItemContent
impl !Sync for ItemContent
impl Unpin for ItemContent
impl !UnwindSafe for ItemContent
Blanket Implementations
Mutably borrows from an owned value. Read more