Skip to main content

loro_ffi/
container.rs

1mod counter;
2mod list;
3mod map;
4mod movable_list;
5mod text;
6mod tree;
7mod unknown;
8
9pub use counter::LoroCounter;
10pub use list::{Cursor, LoroList};
11pub use map::LoroMap;
12pub use movable_list::LoroMovableList;
13pub use text::LoroText;
14pub use tree::{LoroTree, TreeParentId};
15pub use unknown::LoroUnknown;
16
17use crate::{ContainerID, ContainerType};
18
19#[uniffi::trait_interface]
20pub trait ContainerIdLike: Send + Sync {
21    fn as_container_id(&self, ty: ContainerType) -> ContainerID;
22}
23
24impl ContainerIdLike for ContainerID {
25    fn as_container_id(&self, _ty: ContainerType) -> ContainerID {
26        self.clone()
27    }
28}
29
30impl ContainerIdLike for String {
31    fn as_container_id(&self, ty: ContainerType) -> ContainerID {
32        ContainerID::Root {
33            name: String::from(self),
34            container_type: ty,
35        }
36    }
37}