Trait loro::ContainerTrait

source ·
pub trait ContainerTrait: SealedTrait {
    type Handler: HandlerTrait;

    // Required methods
    fn to_container(&self) -> Container;
    fn to_handler(&self) -> Self::Handler;
    fn from_handler(handler: Self::Handler) -> Self;
    fn try_from_container(container: Container) -> Option<Self>
       where Self: Sized;
    fn is_attached(&self) -> bool;
    fn get_attached(&self) -> Option<Self>
       where Self: Sized;
}
Expand description

The common trait for all the containers. It’s used internally, you can’t implement it directly.

Required Associated Types§

source

type Handler: HandlerTrait

The handler of the container.

Required Methods§

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 try_from_container(container: Container) -> Option<Self>
where Self: Sized,

Try to convert the container to the handler.

source

fn is_attached(&self) -> bool

Whether the container is attached to a document.

source

fn get_attached(&self) -> Option<Self>
where Self: Sized,

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

Object Safety§

This trait is not object safe.

Implementors§