Trait yrs::block::Prelim [−][src]
pub trait Prelim: Sized {
fn into_content(
self,
txn: &mut Transaction<'_>,
ptr: TypePtr
) -> (ItemContent, Option<Self>);
fn integrate(self, txn: &mut Transaction<'_>, inner_ref: BranchRef);
}
Expand description
A trait used for preliminary types, that can be inserted into nested YArray/YMap structures.
Required methods
fn into_content(
self,
txn: &mut Transaction<'_>,
ptr: TypePtr
) -> (ItemContent, Option<Self>)
fn into_content(
self,
txn: &mut Transaction<'_>,
ptr: TypePtr
) -> (ItemContent, Option<Self>)
This method is used to create initial content required in order to create a block item.
A supplied ptr
can be used to identify block that is about to be created to store
the returned content.
Since this method may decide to consume self
or not, a second optional return parameter
is used when self
was not consumed - which is the case for complex types creation such as
YMap or YArray. In such case it will be passed later on to Self::integrate method.
fn integrate(self, txn: &mut Transaction<'_>, inner_ref: BranchRef)
fn integrate(self, txn: &mut Transaction<'_>, inner_ref: BranchRef)
Method called once an original item filled with content from Self::into_content has been added to block store. This method is used by complex types such as maps or arrays to append the original contents of prelim struct into YMap, YArray etc.