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§
sourcetype Handler: HandlerTrait
type Handler: HandlerTrait
The handler of the container.
Required Methods§
sourcefn to_container(&self) -> Container
fn to_container(&self) -> Container
Convert the container to a Container.
sourcefn to_handler(&self) -> Self::Handler
fn to_handler(&self) -> Self::Handler
Convert the container to a handler.
sourcefn from_handler(handler: Self::Handler) -> Self
fn from_handler(handler: Self::Handler) -> Self
Convert the handler to a container.
sourcefn try_from_container(container: Container) -> Option<Self>where
Self: Sized,
fn try_from_container(container: Container) -> Option<Self>where
Self: Sized,
Try to convert the container to the handler.
sourcefn is_attached(&self) -> bool
fn is_attached(&self) -> bool
Whether the container is attached to a document.
sourcefn get_attached(&self) -> Option<Self>where
Self: Sized,
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.