moirai/component/
options.rs1#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
3pub enum StorageKind {
4 Sparse,
6 Table,
8}
9
10#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
12pub struct ComponentOptions {
13 storage: StorageKind,
14 is_tag: bool,
15}
16
17impl ComponentOptions {
18 pub const fn sparse() -> Self {
20 Self {
21 storage: StorageKind::Sparse,
22 is_tag: false,
23 }
24 }
25
26 pub const fn table() -> Self {
28 Self {
29 storage: StorageKind::Table,
30 is_tag: false,
31 }
32 }
33
34 pub const fn tag() -> Self {
36 Self {
37 storage: StorageKind::Sparse,
38 is_tag: true,
39 }
40 }
41
42 #[cfg(test)]
43 pub(crate) const fn test_tag_table() -> Self {
44 Self {
45 storage: StorageKind::Table,
46 is_tag: true,
47 }
48 }
49
50 pub(crate) fn storage(self) -> StorageKind {
51 self.storage
52 }
53
54 pub(crate) fn is_tag(self) -> bool {
55 self.is_tag
56 }
57}