@wasm-oj/server 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/THIRD_PARTY_NOTICES.md +302 -0
- package/crates/runtime-core/Cargo.lock +5099 -0
- package/crates/runtime-core/Cargo.toml +66 -0
- package/crates/runtime-core/README.md +47 -0
- package/crates/runtime-core/src/bin/wasm-oj-compiler.rs +418 -0
- package/crates/runtime-core/src/bin/wasm-oj-runner.rs +294 -0
- package/crates/runtime-core/src/capabilities.rs +118 -0
- package/crates/runtime-core/src/compiler.rs +658 -0
- package/crates/runtime-core/src/contract.rs +5 -0
- package/crates/runtime-core/src/deterministic.rs +1051 -0
- package/crates/runtime-core/src/error.rs +58 -0
- package/crates/runtime-core/src/filesystem.rs +547 -0
- package/crates/runtime-core/src/filesystem_quota.rs +167 -0
- package/crates/runtime-core/src/go_compiler_session.rs +297 -0
- package/crates/runtime-core/src/interactive.rs +1019 -0
- package/crates/runtime-core/src/judge_package.rs +1539 -0
- package/crates/runtime-core/src/lib.rs +98 -0
- package/crates/runtime-core/src/memory.rs +84 -0
- package/crates/runtime-core/src/meter.rs +549 -0
- package/crates/runtime-core/src/module_imports.rs +149 -0
- package/crates/runtime-core/src/module_policy.rs +714 -0
- package/crates/runtime-core/src/output.rs +204 -0
- package/crates/runtime-core/src/run/mod.rs +208 -0
- package/crates/runtime-core/src/run/native.rs +260 -0
- package/crates/runtime-core/src/run/web.rs +229 -0
- package/crates/runtime-core/src/run/web_runtime.rs +109 -0
- package/crates/runtime-core/src/types.rs +268 -0
- package/crates/runtime-core/src/web.rs +83 -0
- package/dist/chunks/go-toolchain-Dbt-lp2L.js +426 -0
- package/dist/chunks/java-toolchain-DajoRCHu.js +44 -0
- package/dist/chunks/python-toolchain-Dx834o2A.js +4 -0
- package/dist/chunks/rust-toolchain-CJ3sMxPE.js +252 -0
- package/dist/chunks/toolchains-C6KuA1yM.js +224 -0
- package/dist/go-stage.mjs +193 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.js +4393 -0
- package/dist/java-stage.mjs +111 -0
- package/dist/python-stage.mjs +90 -0
- package/dist/rustc-stage.mjs +301 -0
- package/dist/server-build-stage.mjs +2564 -0
- package/dist/server-runner-stage.mjs +155 -0
- package/licenses/fflate-MIT.txt +21 -0
- package/licenses/runtime-core-dependencies.html +6253 -0
- package/licenses/runtime-core-dependencies.json +3041 -0
- package/licenses/wasmer-sdk-MIT.txt +21 -0
- package/licenses/wasmer-sdk-dependencies.html +6901 -0
- package/licenses/wasmer-sdk-dependencies.json +3013 -0
- package/package.json +70 -0
- package/rust-toolchain.toml +5 -0
- package/testdata/wojjdg02-v2-text.hex +1 -0
- package/vendor/shared-buffer/Cargo.toml +22 -0
- package/vendor/shared-buffer/LICENSE_APACHE.md +176 -0
- package/vendor/shared-buffer/LICENSE_MIT.md +25 -0
- package/vendor/shared-buffer/README.md +34 -0
- package/vendor/shared-buffer/src/lib.rs +58 -0
- package/vendor/shared-buffer/src/mmap.rs +250 -0
- package/vendor/shared-buffer/src/owned.rs +389 -0
- package/vendor/virtual-fs/Cargo.toml +181 -0
- package/vendor/virtual-fs/LICENSE +25 -0
- package/vendor/virtual-fs/src/arc_box_file.rs +142 -0
- package/vendor/virtual-fs/src/arc_file.rs +182 -0
- package/vendor/virtual-fs/src/arc_fs.rs +68 -0
- package/vendor/virtual-fs/src/buffer_file.rs +103 -0
- package/vendor/virtual-fs/src/builder.rs +232 -0
- package/vendor/virtual-fs/src/combine_file.rs +101 -0
- package/vendor/virtual-fs/src/cow_file.rs +345 -0
- package/vendor/virtual-fs/src/dual_write_file.rs +113 -0
- package/vendor/virtual-fs/src/empty_fs.rs +81 -0
- package/vendor/virtual-fs/src/filesystems.rs +108 -0
- package/vendor/virtual-fs/src/host_fs.rs +1390 -0
- package/vendor/virtual-fs/src/lib.rs +782 -0
- package/vendor/virtual-fs/src/limiter.rs +252 -0
- package/vendor/virtual-fs/src/mem_fs/file.rs +1799 -0
- package/vendor/virtual-fs/src/mem_fs/file_opener.rs +941 -0
- package/vendor/virtual-fs/src/mem_fs/filesystem.rs +2134 -0
- package/vendor/virtual-fs/src/mem_fs/mod.rs +245 -0
- package/vendor/virtual-fs/src/mem_fs/offloaded_file.rs +474 -0
- package/vendor/virtual-fs/src/mem_fs/stdio.rs +318 -0
- package/vendor/virtual-fs/src/mount_fs.rs +2225 -0
- package/vendor/virtual-fs/src/null_file.rs +87 -0
- package/vendor/virtual-fs/src/ops.rs +364 -0
- package/vendor/virtual-fs/src/overlay_fs.rs +2216 -0
- package/vendor/virtual-fs/src/passthru_fs.rs +119 -0
- package/vendor/virtual-fs/src/pipe.rs +603 -0
- package/vendor/virtual-fs/src/random_file.rs +88 -0
- package/vendor/virtual-fs/src/special_file.rs +108 -0
- package/vendor/virtual-fs/src/static_file.rs +133 -0
- package/vendor/virtual-fs/src/static_fs.rs +460 -0
- package/vendor/virtual-fs/src/tmp_fs.rs +95 -0
- package/vendor/virtual-fs/src/trace_fs.rs +258 -0
- package/vendor/virtual-fs/src/webc_volume_fs.rs +829 -0
- package/vendor/virtual-fs/src/zero_file.rs +90 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
use std::{
|
|
2
|
+
borrow::Cow,
|
|
3
|
+
fs::File,
|
|
4
|
+
hash::Hash,
|
|
5
|
+
ops::{Deref, Index, RangeBounds},
|
|
6
|
+
path::{Path, PathBuf},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
use bytes::{Buf, Bytes};
|
|
10
|
+
|
|
11
|
+
use crate::{mmap::MmappedSlice, MmapError};
|
|
12
|
+
|
|
13
|
+
/// A cheaply cloneable owned buffer that may be backed by a memory-mapped file
|
|
14
|
+
/// or [`Bytes`] in memory.
|
|
15
|
+
#[derive(Debug, Clone, Default)]
|
|
16
|
+
pub struct OwnedBuffer {
|
|
17
|
+
repr: Repr,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl OwnedBuffer {
|
|
21
|
+
pub const fn new() -> Self {
|
|
22
|
+
OwnedBuffer {
|
|
23
|
+
repr: Repr::InMemory(Bytes::new()),
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
pub const fn from_static(bytes: &'static [u8]) -> Self {
|
|
28
|
+
OwnedBuffer {
|
|
29
|
+
repr: Repr::InMemory(Bytes::from_static(bytes)),
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub fn from_bytes(bytes: impl Into<Bytes>) -> Self {
|
|
34
|
+
bytes.into().into()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pub fn mmap(path: impl AsRef<Path>) -> Result<Self, MmapError> {
|
|
38
|
+
let mmap = MmappedSlice::from_path(path.as_ref())?;
|
|
39
|
+
Ok(mmap.into())
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn from_file(file: &File) -> Result<Self, MmapError> {
|
|
43
|
+
let mmap = MmappedSlice::from_file(file)?;
|
|
44
|
+
Ok(mmap.into())
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pub fn into_bytes(self) -> Bytes {
|
|
48
|
+
match self.repr {
|
|
49
|
+
Repr::InMemory(b) => b,
|
|
50
|
+
Repr::Mmap(m) => Bytes::from(m.as_slice().to_vec()),
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pub fn as_bytes(&self) -> Option<&Bytes> {
|
|
55
|
+
self.repr.as_bytes()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#[inline]
|
|
59
|
+
pub fn as_slice(&self) -> &[u8] {
|
|
60
|
+
match &self.repr {
|
|
61
|
+
Repr::InMemory(b) => b,
|
|
62
|
+
Repr::Mmap(m) => m.as_slice(),
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#[inline]
|
|
67
|
+
pub fn slice(&self, range: impl RangeBounds<usize>) -> Self {
|
|
68
|
+
self.repr.slice(range).into()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
pub fn is_mmapped(&self) -> bool {
|
|
72
|
+
matches!(self.repr, Repr::Mmap(_))
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
impl Deref for OwnedBuffer {
|
|
77
|
+
type Target = [u8];
|
|
78
|
+
|
|
79
|
+
#[inline]
|
|
80
|
+
fn deref(&self) -> &Self::Target {
|
|
81
|
+
self.as_slice()
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
impl AsRef<[u8]> for OwnedBuffer {
|
|
86
|
+
fn as_ref(&self) -> &[u8] {
|
|
87
|
+
self.as_slice()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
impl PartialEq for OwnedBuffer {
|
|
92
|
+
#[inline]
|
|
93
|
+
fn eq(&self, other: &Self) -> bool {
|
|
94
|
+
self.as_slice() == other.as_slice()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
impl PartialEq<[u8]> for OwnedBuffer {
|
|
99
|
+
fn eq(&self, other: &[u8]) -> bool {
|
|
100
|
+
self.as_slice() == other
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
impl PartialEq<&[u8]> for OwnedBuffer {
|
|
105
|
+
fn eq(&self, other: &&[u8]) -> bool {
|
|
106
|
+
self.as_slice() == *other
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
impl<const N: usize> PartialEq<[u8; N]> for OwnedBuffer {
|
|
111
|
+
fn eq(&self, other: &[u8; N]) -> bool {
|
|
112
|
+
self.as_slice() == other
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
impl<const N: usize> PartialEq<&[u8; N]> for OwnedBuffer {
|
|
117
|
+
fn eq(&self, other: &&[u8; N]) -> bool {
|
|
118
|
+
self.as_slice() == *other
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
impl PartialEq<Vec<u8>> for OwnedBuffer {
|
|
123
|
+
fn eq(&self, other: &Vec<u8>) -> bool {
|
|
124
|
+
self.as_slice() == other
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
impl PartialEq<&Vec<u8>> for OwnedBuffer {
|
|
129
|
+
fn eq(&self, other: &&Vec<u8>) -> bool {
|
|
130
|
+
self.as_slice() == *other
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
impl PartialEq<OwnedBuffer> for [u8] {
|
|
135
|
+
fn eq(&self, other: &OwnedBuffer) -> bool {
|
|
136
|
+
other == self
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
impl PartialEq<OwnedBuffer> for &[u8] {
|
|
141
|
+
fn eq(&self, other: &OwnedBuffer) -> bool {
|
|
142
|
+
other == self
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
impl<const N: usize> PartialEq<OwnedBuffer> for [u8; N] {
|
|
147
|
+
fn eq(&self, other: &OwnedBuffer) -> bool {
|
|
148
|
+
other == self
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
impl<const N: usize> PartialEq<OwnedBuffer> for &[u8; N] {
|
|
153
|
+
fn eq(&self, other: &OwnedBuffer) -> bool {
|
|
154
|
+
other == self
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
impl PartialEq<OwnedBuffer> for Vec<u8> {
|
|
159
|
+
fn eq(&self, other: &OwnedBuffer) -> bool {
|
|
160
|
+
other == self
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
impl PartialEq<OwnedBuffer> for &Vec<u8> {
|
|
165
|
+
fn eq(&self, other: &OwnedBuffer) -> bool {
|
|
166
|
+
other == self
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
impl<'a> IntoIterator for &'a OwnedBuffer {
|
|
171
|
+
type Item = &'a u8;
|
|
172
|
+
type IntoIter = std::slice::Iter<'a, u8>;
|
|
173
|
+
|
|
174
|
+
fn into_iter(self) -> Self::IntoIter {
|
|
175
|
+
self.as_slice().iter()
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
impl IntoIterator for OwnedBuffer {
|
|
180
|
+
type Item = u8;
|
|
181
|
+
type IntoIter = OwnedIntoIter;
|
|
182
|
+
|
|
183
|
+
fn into_iter(self) -> Self::IntoIter {
|
|
184
|
+
OwnedIntoIter {
|
|
185
|
+
buffer: self,
|
|
186
|
+
next_index: 0,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
impl<I> Index<I> for OwnedBuffer
|
|
192
|
+
where
|
|
193
|
+
[u8]: Index<I>,
|
|
194
|
+
{
|
|
195
|
+
type Output = <[u8] as Index<I>>::Output;
|
|
196
|
+
|
|
197
|
+
fn index(&self, index: I) -> &Self::Output {
|
|
198
|
+
&self.as_slice()[index]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
impl Eq for OwnedBuffer {}
|
|
203
|
+
|
|
204
|
+
impl Ord for OwnedBuffer {
|
|
205
|
+
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
|
206
|
+
self.as_slice().cmp(other.as_slice())
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
impl PartialOrd for OwnedBuffer {
|
|
211
|
+
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
|
212
|
+
Some(self.cmp(other))
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
impl Hash for OwnedBuffer {
|
|
217
|
+
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
|
218
|
+
self.as_slice().hash(state);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
impl Buf for OwnedBuffer {
|
|
223
|
+
fn remaining(&self) -> usize {
|
|
224
|
+
self.len()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
fn chunk(&self) -> &[u8] {
|
|
228
|
+
self.as_slice()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
fn advance(&mut self, cnt: usize) {
|
|
232
|
+
match &mut self.repr {
|
|
233
|
+
Repr::InMemory(b) => b.advance(cnt),
|
|
234
|
+
Repr::Mmap(m) => m.advance(cnt),
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
impl From<Bytes> for OwnedBuffer {
|
|
240
|
+
fn from(value: Bytes) -> Self {
|
|
241
|
+
OwnedBuffer {
|
|
242
|
+
repr: Repr::InMemory(value),
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
impl From<&[u8]> for OwnedBuffer {
|
|
248
|
+
fn from(value: &[u8]) -> Self {
|
|
249
|
+
value.to_vec().into()
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
impl From<Cow<'_, [u8]>> for OwnedBuffer {
|
|
254
|
+
fn from(value: Cow<'_, [u8]>) -> Self {
|
|
255
|
+
match value {
|
|
256
|
+
Cow::Borrowed(value) => value.into(),
|
|
257
|
+
Cow::Owned(value) => value.into(),
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
impl From<Vec<u8>> for OwnedBuffer {
|
|
263
|
+
fn from(value: Vec<u8>) -> Self {
|
|
264
|
+
Bytes::from(value).into()
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
impl From<&Vec<u8>> for OwnedBuffer {
|
|
269
|
+
fn from(value: &Vec<u8>) -> Self {
|
|
270
|
+
value.as_slice().into()
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
impl From<OwnedBuffer> for Vec<u8> {
|
|
275
|
+
fn from(value: OwnedBuffer) -> Self {
|
|
276
|
+
value.to_vec()
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
impl From<Repr> for OwnedBuffer {
|
|
281
|
+
fn from(repr: Repr) -> Self {
|
|
282
|
+
OwnedBuffer { repr }
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
impl From<MmappedSlice> for OwnedBuffer {
|
|
287
|
+
fn from(mmap: MmappedSlice) -> Self {
|
|
288
|
+
Repr::Mmap(mmap).into()
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
impl TryFrom<&Path> for OwnedBuffer {
|
|
293
|
+
type Error = MmapError;
|
|
294
|
+
|
|
295
|
+
fn try_from(value: &Path) -> Result<Self, Self::Error> {
|
|
296
|
+
OwnedBuffer::mmap(value)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
impl TryFrom<PathBuf> for OwnedBuffer {
|
|
301
|
+
type Error = MmapError;
|
|
302
|
+
|
|
303
|
+
fn try_from(value: PathBuf) -> Result<Self, Self::Error> {
|
|
304
|
+
OwnedBuffer::mmap(value)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
impl TryFrom<&PathBuf> for OwnedBuffer {
|
|
309
|
+
type Error = MmapError;
|
|
310
|
+
|
|
311
|
+
fn try_from(value: &PathBuf) -> Result<Self, Self::Error> {
|
|
312
|
+
OwnedBuffer::mmap(value)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
impl TryFrom<&std::fs::File> for OwnedBuffer {
|
|
317
|
+
type Error = MmapError;
|
|
318
|
+
|
|
319
|
+
fn try_from(file: &std::fs::File) -> Result<Self, Self::Error> {
|
|
320
|
+
OwnedBuffer::from_file(file)
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
impl TryFrom<std::fs::File> for OwnedBuffer {
|
|
325
|
+
type Error = MmapError;
|
|
326
|
+
|
|
327
|
+
fn try_from(file: std::fs::File) -> Result<Self, Self::Error> {
|
|
328
|
+
OwnedBuffer::from_file(&file)
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
impl TryFrom<OwnedBuffer> for Bytes {
|
|
333
|
+
type Error = OwnedBuffer;
|
|
334
|
+
|
|
335
|
+
fn try_from(value: OwnedBuffer) -> Result<Self, Self::Error> {
|
|
336
|
+
if let Repr::InMemory(bytes) = value.repr {
|
|
337
|
+
Ok(bytes)
|
|
338
|
+
} else {
|
|
339
|
+
Err(value)
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
#[derive(Debug, Clone)]
|
|
345
|
+
enum Repr {
|
|
346
|
+
InMemory(Bytes),
|
|
347
|
+
Mmap(MmappedSlice),
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
impl Repr {
|
|
351
|
+
#[inline]
|
|
352
|
+
fn slice(&self, range: impl RangeBounds<usize>) -> Self {
|
|
353
|
+
match self {
|
|
354
|
+
Repr::InMemory(b) => Repr::InMemory(b.slice(range)),
|
|
355
|
+
Repr::Mmap(m) => Repr::Mmap(m.slice(range)),
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
#[inline]
|
|
360
|
+
fn as_bytes(&self) -> Option<&Bytes> {
|
|
361
|
+
match self {
|
|
362
|
+
Repr::InMemory(b) => Some(b),
|
|
363
|
+
_ => None,
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
impl Default for Repr {
|
|
369
|
+
fn default() -> Self {
|
|
370
|
+
Repr::InMemory(Bytes::new())
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
#[derive(Debug, Clone)]
|
|
375
|
+
pub struct OwnedIntoIter {
|
|
376
|
+
buffer: OwnedBuffer,
|
|
377
|
+
next_index: usize,
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
impl Iterator for OwnedIntoIter {
|
|
381
|
+
type Item = u8;
|
|
382
|
+
|
|
383
|
+
#[inline]
|
|
384
|
+
fn next(&mut self) -> Option<Self::Item> {
|
|
385
|
+
let &byte = self.buffer.as_slice().get(self.next_index)?;
|
|
386
|
+
self.next_index += 1;
|
|
387
|
+
Some(byte)
|
|
388
|
+
}
|
|
389
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
|
2
|
+
#
|
|
3
|
+
# When uploading crates to the registry Cargo will automatically
|
|
4
|
+
# "normalize" Cargo.toml files for maximal compatibility
|
|
5
|
+
# with all versions of Cargo and also rewrite `path` dependencies
|
|
6
|
+
# to registry (e.g., crates.io) dependencies.
|
|
7
|
+
#
|
|
8
|
+
# If you are reading this file be aware that the original Cargo.toml
|
|
9
|
+
# will likely look very different (and much more reasonable).
|
|
10
|
+
# See Cargo.toml.orig for the original contents.
|
|
11
|
+
|
|
12
|
+
[package]
|
|
13
|
+
edition = "2024"
|
|
14
|
+
rust-version = "1.93"
|
|
15
|
+
name = "virtual-fs"
|
|
16
|
+
version = "0.702.1"
|
|
17
|
+
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
|
18
|
+
build = false
|
|
19
|
+
autolib = false
|
|
20
|
+
autobins = false
|
|
21
|
+
autoexamples = false
|
|
22
|
+
autotests = false
|
|
23
|
+
autobenches = false
|
|
24
|
+
description = "Wasmer Virtual FileSystem"
|
|
25
|
+
homepage = "https://wasmer.io/"
|
|
26
|
+
readme = false
|
|
27
|
+
license = "MIT"
|
|
28
|
+
repository = "https://github.com/wasmerio/wasmer"
|
|
29
|
+
resolver = "2"
|
|
30
|
+
|
|
31
|
+
[package.metadata.docs.rs]
|
|
32
|
+
rustc-args = [
|
|
33
|
+
"--cfg",
|
|
34
|
+
"docsrs",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[features]
|
|
38
|
+
default = [
|
|
39
|
+
"host-fs",
|
|
40
|
+
"webc-fs",
|
|
41
|
+
"static-fs",
|
|
42
|
+
]
|
|
43
|
+
enable-serde = []
|
|
44
|
+
futures = []
|
|
45
|
+
host-fs = [
|
|
46
|
+
"libc",
|
|
47
|
+
"fs_extra",
|
|
48
|
+
"filetime",
|
|
49
|
+
"tokio/fs",
|
|
50
|
+
"tokio/io-std",
|
|
51
|
+
"tokio/rt",
|
|
52
|
+
]
|
|
53
|
+
js = [
|
|
54
|
+
"dep:web-time",
|
|
55
|
+
"getrandom/wasm_js",
|
|
56
|
+
]
|
|
57
|
+
static-fs = [
|
|
58
|
+
"webc",
|
|
59
|
+
"anyhow",
|
|
60
|
+
]
|
|
61
|
+
tracking = []
|
|
62
|
+
webc-fs = [
|
|
63
|
+
"webc",
|
|
64
|
+
"anyhow",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[lib]
|
|
68
|
+
name = "virtual_fs"
|
|
69
|
+
path = "src/lib.rs"
|
|
70
|
+
|
|
71
|
+
[dependencies.anyhow]
|
|
72
|
+
version = "1.0"
|
|
73
|
+
optional = true
|
|
74
|
+
|
|
75
|
+
[dependencies.async-trait]
|
|
76
|
+
version = "0.1.68"
|
|
77
|
+
|
|
78
|
+
[dependencies.bytes]
|
|
79
|
+
version = "1.11.1"
|
|
80
|
+
|
|
81
|
+
[dependencies.dashmap]
|
|
82
|
+
version = "6.1.0"
|
|
83
|
+
|
|
84
|
+
[dependencies.derive_more]
|
|
85
|
+
version = "2.0.1"
|
|
86
|
+
features = [
|
|
87
|
+
"debug",
|
|
88
|
+
"display",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[dependencies.dunce]
|
|
92
|
+
version = "1.0.4"
|
|
93
|
+
|
|
94
|
+
[dependencies.filetime]
|
|
95
|
+
version = "0.2.18"
|
|
96
|
+
optional = true
|
|
97
|
+
|
|
98
|
+
[dependencies.fs_extra]
|
|
99
|
+
version = "1.3.0"
|
|
100
|
+
optional = true
|
|
101
|
+
|
|
102
|
+
[dependencies.futures]
|
|
103
|
+
version = "0.3.30"
|
|
104
|
+
|
|
105
|
+
[dependencies.getrandom]
|
|
106
|
+
version = "0.4.1"
|
|
107
|
+
|
|
108
|
+
[dependencies.indexmap]
|
|
109
|
+
version = "2"
|
|
110
|
+
|
|
111
|
+
[dependencies.libc]
|
|
112
|
+
version = "0.2.178"
|
|
113
|
+
optional = true
|
|
114
|
+
default-features = false
|
|
115
|
+
|
|
116
|
+
[dependencies.pin-project-lite]
|
|
117
|
+
version = "0.2.10"
|
|
118
|
+
|
|
119
|
+
[dependencies.replace_with]
|
|
120
|
+
version = "0.1.7"
|
|
121
|
+
|
|
122
|
+
[dependencies.serde]
|
|
123
|
+
version = "1"
|
|
124
|
+
features = ["derive"]
|
|
125
|
+
optional = true
|
|
126
|
+
default-features = false
|
|
127
|
+
|
|
128
|
+
[dependencies.shared-buffer]
|
|
129
|
+
version = "0.1.4"
|
|
130
|
+
|
|
131
|
+
[dependencies.slab]
|
|
132
|
+
version = "0.4"
|
|
133
|
+
|
|
134
|
+
[dependencies.thiserror]
|
|
135
|
+
version = "2.0.17"
|
|
136
|
+
|
|
137
|
+
[dependencies.tokio]
|
|
138
|
+
version = "1.39.0"
|
|
139
|
+
features = [
|
|
140
|
+
"io-util",
|
|
141
|
+
"sync",
|
|
142
|
+
"macros",
|
|
143
|
+
]
|
|
144
|
+
default-features = false
|
|
145
|
+
|
|
146
|
+
[dependencies.tracing]
|
|
147
|
+
version = "0.1"
|
|
148
|
+
default-features = true
|
|
149
|
+
|
|
150
|
+
[dependencies.virtual-mio]
|
|
151
|
+
version = "0.702.1"
|
|
152
|
+
default-features = false
|
|
153
|
+
|
|
154
|
+
[dependencies.wasmer-package]
|
|
155
|
+
version = "0.702.1"
|
|
156
|
+
|
|
157
|
+
[dependencies.web-time]
|
|
158
|
+
version = "1.1"
|
|
159
|
+
optional = true
|
|
160
|
+
|
|
161
|
+
[dependencies.webc]
|
|
162
|
+
version = "=12.0.0"
|
|
163
|
+
features = ["v1"]
|
|
164
|
+
optional = true
|
|
165
|
+
|
|
166
|
+
[dev-dependencies.pretty_assertions]
|
|
167
|
+
version = "1.4.0"
|
|
168
|
+
|
|
169
|
+
[dev-dependencies.tempfile]
|
|
170
|
+
version = "3.6.0"
|
|
171
|
+
|
|
172
|
+
[dev-dependencies.tokio]
|
|
173
|
+
version = "1.39.0"
|
|
174
|
+
features = [
|
|
175
|
+
"io-util",
|
|
176
|
+
"rt",
|
|
177
|
+
]
|
|
178
|
+
default-features = false
|
|
179
|
+
|
|
180
|
+
[dev-dependencies.tracing-test]
|
|
181
|
+
version = "0.2"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) 2022 The Wasmer Engineering Team <engineering@wasmer.io>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any
|
|
4
|
+
person obtaining a copy of this software and associated
|
|
5
|
+
documentation files (the "Software"), to deal in the
|
|
6
|
+
Software without restriction, including without
|
|
7
|
+
limitation the rights to use, copy, modify, merge,
|
|
8
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software
|
|
10
|
+
is furnished to do so, subject to the following
|
|
11
|
+
conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice
|
|
14
|
+
shall be included in all copies or substantial portions
|
|
15
|
+
of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
18
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
20
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
21
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
24
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
25
|
+
DEALINGS IN THE SOFTWARE.
|