pub enum Container {
List(LoroList),
Map(LoroMap),
Text(LoroText),
Tree(LoroTree),
MovableList(LoroMovableList),
Unknown(LoroUnknown),
}
Expand description
All the CRDT containers supported by loro.
Variants§
List(LoroList)
Map(LoroMap)
Text(LoroText)
Tree(LoroTree)
[LoroTree container]
MovableList(LoroMovableList)
Unknown(LoroUnknown)
Unknown container
Implementations§
source§impl Container
impl Container
sourcepub fn as_list_mut(&mut self) -> Option<&mut LoroList>
pub fn as_list_mut(&mut self) -> Option<&mut LoroList>
Optionally returns mutable references to the inner fields if this is a Container::List
, otherwise None
sourcepub fn as_list(&self) -> Option<&LoroList>
pub fn as_list(&self) -> Option<&LoroList>
Optionally returns references to the inner fields if this is a Container::List
, otherwise None
sourcepub fn into_list(self) -> Result<LoroList, Self>
pub fn into_list(self) -> Result<LoroList, Self>
Returns the inner fields if this is a Container::List
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_map_mut(&mut self) -> Option<&mut LoroMap>
pub fn as_map_mut(&mut self) -> Option<&mut LoroMap>
Optionally returns mutable references to the inner fields if this is a Container::Map
, otherwise None
sourcepub fn as_map(&self) -> Option<&LoroMap>
pub fn as_map(&self) -> Option<&LoroMap>
Optionally returns references to the inner fields if this is a Container::Map
, otherwise None
sourcepub fn into_map(self) -> Result<LoroMap, Self>
pub fn into_map(self) -> Result<LoroMap, Self>
Returns the inner fields if this is a Container::Map
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_text_mut(&mut self) -> Option<&mut LoroText>
pub fn as_text_mut(&mut self) -> Option<&mut LoroText>
Optionally returns mutable references to the inner fields if this is a Container::Text
, otherwise None
sourcepub fn as_text(&self) -> Option<&LoroText>
pub fn as_text(&self) -> Option<&LoroText>
Optionally returns references to the inner fields if this is a Container::Text
, otherwise None
sourcepub fn into_text(self) -> Result<LoroText, Self>
pub fn into_text(self) -> Result<LoroText, Self>
Returns the inner fields if this is a Container::Text
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_tree_mut(&mut self) -> Option<&mut LoroTree>
pub fn as_tree_mut(&mut self) -> Option<&mut LoroTree>
Optionally returns mutable references to the inner fields if this is a Container::Tree
, otherwise None
sourcepub fn as_tree(&self) -> Option<&LoroTree>
pub fn as_tree(&self) -> Option<&LoroTree>
Optionally returns references to the inner fields if this is a Container::Tree
, otherwise None
sourcepub fn into_tree(self) -> Result<LoroTree, Self>
pub fn into_tree(self) -> Result<LoroTree, Self>
Returns the inner fields if this is a Container::Tree
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_movable_list(&self) -> bool
pub fn is_movable_list(&self) -> bool
Returns true if this is a Container::MovableList
, otherwise false
sourcepub fn as_movable_list_mut(&mut self) -> Option<&mut LoroMovableList>
pub fn as_movable_list_mut(&mut self) -> Option<&mut LoroMovableList>
Optionally returns mutable references to the inner fields if this is a Container::MovableList
, otherwise None
sourcepub fn as_movable_list(&self) -> Option<&LoroMovableList>
pub fn as_movable_list(&self) -> Option<&LoroMovableList>
Optionally returns references to the inner fields if this is a Container::MovableList
, otherwise None
sourcepub fn into_movable_list(self) -> Result<LoroMovableList, Self>
pub fn into_movable_list(self) -> Result<LoroMovableList, Self>
Returns the inner fields if this is a Container::MovableList
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this is a Container::Unknown
, otherwise false
sourcepub fn as_unknown_mut(&mut self) -> Option<&mut LoroUnknown>
pub fn as_unknown_mut(&mut self) -> Option<&mut LoroUnknown>
Optionally returns mutable references to the inner fields if this is a Container::Unknown
, otherwise None
sourcepub fn as_unknown(&self) -> Option<&LoroUnknown>
pub fn as_unknown(&self) -> Option<&LoroUnknown>
Optionally returns references to the inner fields if this is a Container::Unknown
, otherwise None
sourcepub fn into_unknown(self) -> Result<LoroUnknown, Self>
pub fn into_unknown(self) -> Result<LoroUnknown, Self>
Returns the inner fields if this is a Container::Unknown
, otherwise returns back the enum in the Err
case of the result
source§impl Container
impl Container
sourcepub fn new(kind: ContainerType) -> Self
pub fn new(kind: ContainerType) -> Self
Create a detached container of the given type.
A detached container is a container that is not attached to a document. The edits on a detached container will not be persisted. To attach the container to the document, please insert it into an attached container.
sourcepub fn get_type(&self) -> ContainerType
pub fn get_type(&self) -> ContainerType
Get the type of the container.
sourcepub fn id(&self) -> ContainerID
pub fn id(&self) -> ContainerID
Get the id of the container.
Trait Implementations§
source§impl ContainerTrait for Container
impl ContainerTrait for Container
source§fn to_container(&self) -> Container
fn to_container(&self) -> Container
source§fn to_handler(&self) -> Self::Handler
fn to_handler(&self) -> Self::Handler
source§fn from_handler(handler: Self::Handler) -> Self
fn from_handler(handler: Self::Handler) -> Self
source§fn is_attached(&self) -> bool
fn is_attached(&self) -> bool
source§fn get_attached(&self) -> Option<Self>
fn get_attached(&self) -> Option<Self>
Auto Trait Implementations§
impl Freeze for Container
impl RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl UnwindSafe for Container
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more