Enum loro::ValueOrContainer
source · pub enum ValueOrContainer {
Value(LoroValue),
Container(Container),
}
Expand description
It’s a type that can be either a value or a container.
Variants§
Implementations§
source§impl ValueOrContainer
impl ValueOrContainer
sourcepub fn is_value(&self) -> bool
pub fn is_value(&self) -> bool
Returns true if this is a ValueOrContainer::Value
, otherwise false
sourcepub fn as_value_mut(&mut self) -> Option<&mut LoroValue>
pub fn as_value_mut(&mut self) -> Option<&mut LoroValue>
Optionally returns mutable references to the inner fields if this is a ValueOrContainer::Value
, otherwise None
sourcepub fn as_value(&self) -> Option<&LoroValue>
pub fn as_value(&self) -> Option<&LoroValue>
Optionally returns references to the inner fields if this is a ValueOrContainer::Value
, otherwise None
sourcepub fn into_value(self) -> Result<LoroValue, Self>
pub fn into_value(self) -> Result<LoroValue, Self>
Returns the inner fields if this is a ValueOrContainer::Value
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_container(&self) -> bool
pub fn is_container(&self) -> bool
Returns true if this is a ValueOrContainer::Container
, otherwise false
sourcepub fn as_container_mut(&mut self) -> Option<&mut Container>
pub fn as_container_mut(&mut self) -> Option<&mut Container>
Optionally returns mutable references to the inner fields if this is a ValueOrContainer::Container
, otherwise None
sourcepub fn as_container(&self) -> Option<&Container>
pub fn as_container(&self) -> Option<&Container>
Optionally returns references to the inner fields if this is a ValueOrContainer::Container
, otherwise None
sourcepub fn into_container(self) -> Result<Container, Self>
pub fn into_container(self) -> Result<Container, Self>
Returns the inner fields if this is a ValueOrContainer::Container
, otherwise returns back the enum in the Err
case of the result
Trait Implementations§
source§impl Clone for ValueOrContainer
impl Clone for ValueOrContainer
source§fn clone(&self) -> ValueOrContainer
fn clone(&self) -> ValueOrContainer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ValueOrContainer
impl Debug for ValueOrContainer
source§impl From<ValueOrHandler> for ValueOrContainer
impl From<ValueOrHandler> for ValueOrContainer
source§fn from(value: ValueOrHandler) -> Self
fn from(value: ValueOrHandler) -> Self
Auto Trait Implementations§
impl Freeze for ValueOrContainer
impl RefUnwindSafe for ValueOrContainer
impl Send for ValueOrContainer
impl Sync for ValueOrContainer
impl Unpin for ValueOrContainer
impl UnwindSafe for ValueOrContainer
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