Enum loro::ContainerID
source · pub enum ContainerID {
Root {
name: InternalString,
container_type: ContainerType,
},
Normal {
peer: u64,
counter: i32,
container_type: ContainerType,
},
}
Expand description
ContainerID includes the Op’s ID and the type. So it’s impossible to have the same ContainerID with conflict ContainerType.
This structure is really cheap to clone.
String representation:
- Root Container:
/<name>:<type>
- Normal Container:
<counter>@<client>:<type>
Note: It will be encoded into binary format, so the order of its fields should not be changed.
Variants§
Implementations§
source§impl ContainerID
impl ContainerID
sourcepub fn as_root_mut(
&mut self
) -> Option<(&mut InternalString, &mut ContainerType)>
pub fn as_root_mut( &mut self ) -> Option<(&mut InternalString, &mut ContainerType)>
Optionally returns mutable references to the inner fields if this is a ContainerID::Root
, otherwise None
sourcepub fn as_root(&self) -> Option<(&InternalString, &ContainerType)>
pub fn as_root(&self) -> Option<(&InternalString, &ContainerType)>
Optionally returns references to the inner fields if this is a ContainerID::Root
, otherwise None
sourcepub fn into_root(self) -> Result<(InternalString, ContainerType), ContainerID>
pub fn into_root(self) -> Result<(InternalString, ContainerType), ContainerID>
Returns the inner fields if this is a ContainerID::Root
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_normal_mut(
&mut self
) -> Option<(&mut u64, &mut i32, &mut ContainerType)>
pub fn as_normal_mut( &mut self ) -> Option<(&mut u64, &mut i32, &mut ContainerType)>
Optionally returns mutable references to the inner fields if this is a ContainerID::Normal
, otherwise None
sourcepub fn as_normal(&self) -> Option<(&u64, &i32, &ContainerType)>
pub fn as_normal(&self) -> Option<(&u64, &i32, &ContainerType)>
Optionally returns references to the inner fields if this is a ContainerID::Normal
, otherwise None
sourcepub fn into_normal(self) -> Result<(u64, i32, ContainerType), ContainerID>
pub fn into_normal(self) -> Result<(u64, i32, ContainerType), ContainerID>
Returns the inner fields if this is a ContainerID::Normal
, otherwise returns back the enum in the Err
case of the result
source§impl ContainerID
impl ContainerID
pub fn new_normal(id: ID, container_type: ContainerType) -> ContainerID
pub fn new_root(name: &str, container_type: ContainerType) -> ContainerID
pub fn name(&self) -> &InternalString
pub fn container_type(&self) -> ContainerType
pub fn is_unknown(&self) -> bool
Trait Implementations§
source§impl Clone for ContainerID
impl Clone for ContainerID
source§fn clone(&self) -> ContainerID
fn clone(&self) -> ContainerID
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ContainerID
impl Debug for ContainerID
source§impl<'de> Deserialize<'de> for ContainerID
impl<'de> Deserialize<'de> for ContainerID
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ContainerID, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ContainerID, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Display for ContainerID
impl Display for ContainerID
source§impl From<ContainerID> for LoroValue
impl From<ContainerID> for LoroValue
source§fn from(v: ContainerID) -> LoroValue
fn from(v: ContainerID) -> LoroValue
source§impl Hash for ContainerID
impl Hash for ContainerID
source§impl IntoContainerId for &ContainerID
impl IntoContainerId for &ContainerID
fn into_container_id( self, _arena: &SharedArena, _kind: ContainerType ) -> ContainerID
source§impl IntoContainerId for ContainerID
impl IntoContainerId for ContainerID
fn into_container_id( self, _arena: &SharedArena, _kind: ContainerType ) -> ContainerID
source§impl PartialEq for ContainerID
impl PartialEq for ContainerID
source§fn eq(&self, other: &ContainerID) -> bool
fn eq(&self, other: &ContainerID) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ContainerID
impl Serialize for ContainerID
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl TryFrom<&str> for ContainerID
impl TryFrom<&str> for ContainerID
source§impl TryFrom<LoroValue> for ContainerID
impl TryFrom<LoroValue> for ContainerID
impl Eq for ContainerID
impl StructuralPartialEq for ContainerID
Auto Trait Implementations§
impl Freeze for ContainerID
impl RefUnwindSafe for ContainerID
impl Send for ContainerID
impl Sync for ContainerID
impl Unpin for ContainerID
impl UnwindSafe for ContainerID
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