Enum loro::Container

source ·
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§

Implementations§

source§

impl Container

source

pub fn is_list(&self) -> bool

Returns true if this is a Container::List, otherwise false

source

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

source

pub fn as_list(&self) -> Option<&LoroList>

Optionally returns references to the inner fields if this is a Container::List, otherwise None

source

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

source

pub fn is_map(&self) -> bool

Returns true if this is a Container::Map, otherwise false

source

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

source

pub fn as_map(&self) -> Option<&LoroMap>

Optionally returns references to the inner fields if this is a Container::Map, otherwise None

source

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

source

pub fn is_text(&self) -> bool

Returns true if this is a Container::Text, otherwise false

source

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

source

pub fn as_text(&self) -> Option<&LoroText>

Optionally returns references to the inner fields if this is a Container::Text, otherwise None

source

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

source

pub fn is_tree(&self) -> bool

Returns true if this is a Container::Tree, otherwise false

source

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

source

pub fn as_tree(&self) -> Option<&LoroTree>

Optionally returns references to the inner fields if this is a Container::Tree, otherwise None

source

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

source

pub fn is_movable_list(&self) -> bool

Returns true if this is a Container::MovableList, otherwise false

source

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

source

pub fn as_movable_list(&self) -> Option<&LoroMovableList>

Optionally returns references to the inner fields if this is a Container::MovableList, otherwise None

source

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

source

pub fn is_unknown(&self) -> bool

Returns true if this is a Container::Unknown, otherwise false

source

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

source

pub fn as_unknown(&self) -> Option<&LoroUnknown>

Optionally returns references to the inner fields if this is a Container::Unknown, otherwise None

source

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

source

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.

source

pub fn get_type(&self) -> ContainerType

Get the type of the container.

source

pub fn id(&self) -> ContainerID

Get the id of the container.

Trait Implementations§

source§

impl Clone for Container

source§

fn clone(&self) -> Container

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ContainerTrait for Container

§

type Handler = Handler

The handler of the container.
source§

fn to_container(&self) -> Container

Convert the container to a Container.
source§

fn to_handler(&self) -> Self::Handler

Convert the container to a handler.
source§

fn from_handler(handler: Self::Handler) -> Self

Convert the handler to a container.
source§

fn is_attached(&self) -> bool

Whether the container is attached to a document.
source§

fn get_attached(&self) -> Option<Self>

If a detached container is attached, this method will return its corresponding attached handler.
source§

fn try_from_container(container: Container) -> Option<Self>
where Self: Sized,

Try to convert the container to the handler.
source§

impl Debug for Container

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Handler> for Container

source§

fn from(value: InnerHandler) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more