Enum loro_internal::container::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
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 ContainerIdRaw
impl From<&ContainerID> for ContainerIdRaw
source§fn from(id: &ContainerID) -> Self
fn from(id: &ContainerID) -> Self
source§impl From<ContainerID> for ContainerIdRaw
impl From<ContainerID> for ContainerIdRaw
source§fn from(id: ContainerID) -> Self
fn from(id: ContainerID) -> Self
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 ==
.