Trait Prelim
pub trait Prelim: Sized {
type Return: TryFrom<ItemPtr>;
// Required methods
fn into_content(
self,
txn: &mut TransactionMut<'_>,
) -> (ItemContent, Option<Self>);
fn integrate(self, txn: &mut TransactionMut<'_>, inner_ref: BranchPtr);
}Expand description
A trait used for preliminary types, that can be inserted into shared Yrs collections.
Required Associated Types§
Required Methods§
fn into_content(
self,
txn: &mut TransactionMut<'_>,
) -> (ItemContent, Option<Self>)
fn into_content( self, txn: &mut TransactionMut<'_>, ) -> (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 TransactionMut<'_>, inner_ref: BranchPtr)
fn integrate(self, txn: &mut TransactionMut<'_>, inner_ref: BranchPtr)
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.