1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign};
use std::u32;
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct StdLib(u32);
impl StdLib {
#[cfg(any(
feature = "lua54",
feature = "lua53",
feature = "lua52",
feature = "luau"
))]
pub const COROUTINE: StdLib = StdLib(1);
pub const TABLE: StdLib = StdLib(1 << 1);
#[cfg(not(feature = "luau"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "luau"))))]
pub const IO: StdLib = StdLib(1 << 2);
pub const OS: StdLib = StdLib(1 << 3);
pub const STRING: StdLib = StdLib(1 << 4);
#[cfg(any(feature = "lua54", feature = "lua53", feature = "luau"))]
pub const UTF8: StdLib = StdLib(1 << 5);
#[cfg(any(feature = "lua52", feature = "luajit", feature = "luau", doc))]
pub const BIT: StdLib = StdLib(1 << 6);
pub const MATH: StdLib = StdLib(1 << 7);
#[cfg(not(feature = "luau"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "luau"))))]
pub const PACKAGE: StdLib = StdLib(1 << 8);
#[cfg(any(feature = "luajit", doc))]
#[cfg_attr(docsrs, doc(cfg(feature = "luajit")))]
pub const JIT: StdLib = StdLib(1 << 9);
#[cfg(any(feature = "luajit", doc))]
#[cfg_attr(docsrs, doc(cfg(feature = "luajit")))]
pub const FFI: StdLib = StdLib(1 << 30);
pub const DEBUG: StdLib = StdLib(1 << 31);
pub const NONE: StdLib = StdLib(0);
pub const ALL: StdLib = StdLib(u32::MAX);
#[cfg(not(feature = "luau"))]
pub const ALL_SAFE: StdLib = StdLib((1 << 30) - 1);
#[cfg(feature = "luau")]
pub const ALL_SAFE: StdLib = StdLib(u32::MAX);
pub fn contains(self, lib: Self) -> bool {
(self & lib).0 != 0
}
}
impl BitAnd for StdLib {
type Output = Self;
fn bitand(self, rhs: Self) -> Self::Output {
StdLib(self.0 & rhs.0)
}
}
impl BitAndAssign for StdLib {
fn bitand_assign(&mut self, rhs: Self) {
*self = StdLib(self.0 & rhs.0)
}
}
impl BitOr for StdLib {
type Output = Self;
fn bitor(self, rhs: Self) -> Self::Output {
StdLib(self.0 | rhs.0)
}
}
impl BitOrAssign for StdLib {
fn bitor_assign(&mut self, rhs: Self) {
*self = StdLib(self.0 | rhs.0)
}
}
impl BitXor for StdLib {
type Output = Self;
fn bitxor(self, rhs: Self) -> Self::Output {
StdLib(self.0 ^ rhs.0)
}
}
impl BitXorAssign for StdLib {
fn bitxor_assign(&mut self, rhs: Self) {
*self = StdLib(self.0 ^ rhs.0)
}
}