y-rb 0.3.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,505 @@
1
+ extern crate core;
2
+
3
+ use crate::yarray::YArray;
4
+ use crate::yawareness::{YAwareness, YAwarenessEvent};
5
+ use crate::ydoc::YDoc;
6
+ use crate::ymap::YMap;
7
+ use crate::ytext::YText;
8
+ use crate::ytransaction::YTransaction;
9
+ use crate::yxml_element::YXmlElement;
10
+ use crate::yxml_text::YXmlText;
11
+ use magnus::{define_module, function, method, Error, Module, Object};
12
+
13
+ mod awareness;
14
+ mod utils;
15
+ mod yany;
16
+ mod yarray;
17
+ mod yattrs;
18
+ mod yawareness;
19
+ mod ydoc;
20
+ mod ymap;
21
+ mod ytext;
22
+ mod ytransaction;
23
+ mod yvalue;
24
+ mod yxml_element;
25
+ mod yxml_text;
26
+
27
+ #[magnus::init]
28
+ fn init() -> Result<(), Error> {
29
+ let module = define_module("Y").expect("cannot define ::Y module");
30
+
31
+ let yarray = module
32
+ .define_class("Array", Default::default())
33
+ .expect("cannot find class Y::Array");
34
+
35
+ yarray
36
+ .define_private_method("yarray_each", method!(YArray::yarray_each, 1))
37
+ .expect("cannot define private method: yarray_each");
38
+ yarray
39
+ .define_private_method("yarray_get", method!(YArray::yarray_get, 1))
40
+ .expect("cannot define private method: yarray_get");
41
+ yarray
42
+ .define_private_method("yarray_insert", method!(YArray::yarray_insert, 3))
43
+ .expect("cannot define private method: yarray_insert");
44
+ yarray
45
+ .define_private_method(
46
+ "yarray_insert_range",
47
+ method!(YArray::yarray_insert_range, 3),
48
+ )
49
+ .expect("cannot define private method: yarray_insert_range");
50
+ yarray
51
+ .define_private_method("yarray_length", method!(YArray::yarray_length, 0))
52
+ .expect("cannot define private method: yarray_length");
53
+ yarray
54
+ .define_private_method("yarray_observe", method!(YArray::yarray_observe, 1))
55
+ .expect("cannot define private method: yarray_observe");
56
+ yarray
57
+ .define_private_method("yarray_push_back", method!(YArray::yarray_push_back, 2))
58
+ .expect("cannot define private method: yarray_push_back");
59
+ yarray
60
+ .define_private_method("yarray_push_front", method!(YArray::yarray_push_front, 2))
61
+ .expect("cannot define private method: yarray_push_front");
62
+ yarray
63
+ .define_private_method("yarray_remove", method!(YArray::yarray_remove, 2))
64
+ .expect("cannot define private method: yarray_remove");
65
+ yarray
66
+ .define_private_method(
67
+ "yarray_remove_range",
68
+ method!(YArray::yarray_remove_range, 3),
69
+ )
70
+ .expect("cannot define private method: yarray_remove_range");
71
+ yarray
72
+ .define_private_method("yarray_to_a", method!(YArray::yarray_to_a, 0))
73
+ .expect("cannot define private method: yarray_to_a");
74
+ yarray
75
+ .define_private_method("yarray_unobserve", method!(YArray::yarray_unobserve, 1))
76
+ .expect("cannot define private method: yarray_unobserve");
77
+
78
+ let ydoc = module
79
+ .define_class("Doc", Default::default())
80
+ .expect("cannot define class Y::Doc");
81
+ ydoc.define_singleton_method("new", function!(YDoc::ydoc_new, -1))
82
+ .expect("cannot define singleton method: ydoc_new");
83
+ ydoc.define_private_method("ydoc_transact", method!(YDoc::ydoc_transact, 0))
84
+ .expect("cannot define private method: ydoc_transact");
85
+ ydoc.define_private_method("ydoc_encode_diff_v1", method!(YDoc::ydoc_encode_diff_v1, 1))
86
+ .expect("cannot define private method: ydoc_encode_diff_v1");
87
+
88
+ let ymap = module
89
+ .define_class("Map", Default::default())
90
+ .expect("cannot define class Y::Map");
91
+
92
+ ymap.define_private_method("ymap_clear", method!(YMap::ymap_clear, 1))
93
+ .expect("cannot define private method: ymap_clear");
94
+ ymap.define_private_method("ymap_contains", method!(YMap::ymap_contains, 1))
95
+ .expect("cannot define private method: ymap_contains");
96
+ ymap.define_private_method("ymap_each", method!(YMap::ymap_each, 1))
97
+ .expect("cannot define private method: ymap_each");
98
+ ymap.define_private_method("ymap_get", method!(YMap::ymap_get, 1))
99
+ .expect("cannot define private method: ymap_get");
100
+ ymap.define_private_method("ymap_insert", method!(YMap::ymap_insert, 3))
101
+ .expect("cannot define private method: ymap_insert");
102
+ ymap.define_private_method("ymap_observe", method!(YMap::ymap_observe, 1))
103
+ .expect("cannot define private method: ymap_observe");
104
+ ymap.define_private_method("ymap_remove", method!(YMap::ymap_remove, 2))
105
+ .expect("cannot define private method: ymap_remove");
106
+ ymap.define_private_method("ymap_size", method!(YMap::ymap_size, 0))
107
+ .expect("cannot define private method: ymap_size");
108
+ ymap.define_private_method("ymap_to_h", method!(YMap::ymap_to_h, 0))
109
+ .expect("cannot define private method: ymap_to_h");
110
+ ymap.define_private_method("ymap_unobserve", method!(YMap::ymap_unobserve, 1))
111
+ .expect("cannot define private method: ymap_unobserve");
112
+
113
+ let ytransaction = module
114
+ .define_class("Transaction", Default::default())
115
+ .expect("cannot define class Y::Transaction");
116
+
117
+ ytransaction
118
+ .define_private_method(
119
+ "ytransaction_apply_update",
120
+ method!(YTransaction::ytransaction_apply_update, 1),
121
+ )
122
+ .expect("cannot define private method: ytransaction_apply_update");
123
+ ytransaction
124
+ .define_private_method(
125
+ "ytransaction_commit",
126
+ method!(YTransaction::ytransaction_commit, 0),
127
+ )
128
+ .expect("cannot define private method: ytransaction_commit");
129
+ ytransaction
130
+ .define_private_method(
131
+ "ytransaction_get_array",
132
+ method!(YTransaction::ytransaction_get_array, 1),
133
+ )
134
+ .expect("cannot define private method: ytransaction_get_array");
135
+ ytransaction
136
+ .define_private_method(
137
+ "ytransaction_get_map",
138
+ method!(YTransaction::ytransaction_get_map, 1),
139
+ )
140
+ .expect("cannot define private method: ytransaction_get_mao");
141
+ ytransaction
142
+ .define_private_method(
143
+ "ytransaction_get_text",
144
+ method!(YTransaction::ytransaction_get_text, 1),
145
+ )
146
+ .expect("cannot define private method: ytransaction_get_text");
147
+ ytransaction
148
+ .define_private_method(
149
+ "ytransaction_get_xml_element",
150
+ method!(YTransaction::ytransaction_get_xml_element, 1),
151
+ )
152
+ .expect("cannot define private method: ytransaction_get_xml_element");
153
+ ytransaction
154
+ .define_private_method(
155
+ "ytransaction_get_xml_text",
156
+ method!(YTransaction::ytransaction_get_xml_text, 1),
157
+ )
158
+ .expect("cannot define private method: ytransaction_get_xml_text");
159
+ ytransaction
160
+ .define_private_method(
161
+ "ytransaction_state_vector",
162
+ method!(YTransaction::ytransaction_state_vector, 0),
163
+ )
164
+ .expect("cannot define private method: ytransaction_state_vector");
165
+
166
+ let ytext = module
167
+ .define_class("Text", Default::default())
168
+ .expect("cannot define class Y::Text");
169
+
170
+ ytext
171
+ .define_private_method("ytext_format", method!(YText::ytext_format, 4))
172
+ .expect("cannot define private method: ytext_format");
173
+ ytext
174
+ .define_private_method("ytext_insert", method!(YText::ytext_insert, 3))
175
+ .expect("cannot define private method: ytext_insert");
176
+ ytext
177
+ .define_private_method("ytext_insert_embed", method!(YText::ytext_insert_embed, 3))
178
+ .expect("cannot define private method: ytext_insert_embed");
179
+ ytext
180
+ .define_private_method(
181
+ "ytext_insert_embed_with_attributes",
182
+ method!(YText::ytext_insert_embed_with_attributes, 4),
183
+ )
184
+ .expect("cannot define private method: ytext_insert_embed_with_attributes");
185
+ ytext
186
+ .define_private_method(
187
+ "ytext_insert_with_attributes",
188
+ method!(YText::ytext_insert_with_attributes, 4),
189
+ )
190
+ .expect("cannot define private method: ytext_insert_with_attributes");
191
+ ytext
192
+ .define_private_method("ytext_length", method!(YText::ytext_length, 0))
193
+ .expect("cannot define private method: ytext_length");
194
+ ytext
195
+ .define_private_method("ytext_observe", method!(YText::ytext_observe, 1))
196
+ .expect("cannot define private method: ytext_observe");
197
+ ytext
198
+ .define_private_method("ytext_push", method!(YText::ytext_push, 2))
199
+ .expect("cannot define private method: ytext_push");
200
+ ytext
201
+ .define_private_method("ytext_remove_range", method!(YText::ytext_remove_range, 3))
202
+ .expect("cannot define private method: ytext_remove_range");
203
+ ytext
204
+ .define_private_method("ytext_to_s", method!(YText::ytext_to_s, 0))
205
+ .expect("cannot define private method: ytext_to_s");
206
+ ytext
207
+ .define_private_method("ytext_unobserve", method!(YText::ytext_unobserve, 1))
208
+ .expect("cannot define private method: ytext_unobserve");
209
+
210
+ let yxml_element = module
211
+ .define_class("XMLElement", Default::default())
212
+ .expect("cannot define class Y::XMLElement");
213
+
214
+ yxml_element
215
+ .define_private_method(
216
+ "yxml_element_attributes",
217
+ method!(YXmlElement::yxml_element_attributes, 0),
218
+ )
219
+ .expect("cannot define private method: yxml_element_attributes");
220
+ yxml_element
221
+ .define_private_method(
222
+ "yxml_element_first_child",
223
+ method!(YXmlElement::yxml_element_first_child, 0),
224
+ )
225
+ .expect("cannot define private method: yxml_element_first_child");
226
+ yxml_element
227
+ .define_private_method(
228
+ "yxml_element_get",
229
+ method!(YXmlElement::yxml_element_get, 1),
230
+ )
231
+ .expect("cannot define private method: yxml_element_get");
232
+ yxml_element
233
+ .define_private_method(
234
+ "yxml_element_get_attribute",
235
+ method!(YXmlElement::yxml_element_get_attribute, 1),
236
+ )
237
+ .expect("cannot define private method: yxml_element_get_attribute");
238
+ yxml_element
239
+ .define_private_method(
240
+ "yxml_element_insert_attribute",
241
+ method!(YXmlElement::yxml_element_insert_attribute, 3),
242
+ )
243
+ .expect("cannot define private method: yxml_element_insert_attribute");
244
+ yxml_element
245
+ .define_private_method(
246
+ "yxml_element_insert_element",
247
+ method!(YXmlElement::yxml_element_insert_element, 3),
248
+ )
249
+ .expect("cannot define private method: yxml_element_insert_element");
250
+ yxml_element
251
+ .define_private_method(
252
+ "yxml_element_insert_text",
253
+ method!(YXmlElement::yxml_element_insert_text, 2),
254
+ )
255
+ .expect("cannot define private method: yxml_element_insert_text");
256
+ yxml_element
257
+ .define_private_method(
258
+ "yxml_element_next_sibling",
259
+ method!(YXmlElement::yxml_element_next_sibling, 0),
260
+ )
261
+ .expect("cannot define private method: yxml_element_next_sibling");
262
+ yxml_element
263
+ .define_private_method(
264
+ "yxml_element_observe",
265
+ method!(YXmlElement::yxml_element_observe, 1),
266
+ )
267
+ .expect("cannot define private method: yxml_element_observe");
268
+ yxml_element
269
+ .define_private_method(
270
+ "yxml_element_parent",
271
+ method!(YXmlElement::yxml_element_parent, 0),
272
+ )
273
+ .expect("cannot define private method: yxml_element_parent");
274
+ yxml_element
275
+ .define_private_method(
276
+ "yxml_element_prev_sibling",
277
+ method!(YXmlElement::yxml_element_prev_sibling, 0),
278
+ )
279
+ .expect("cannot define private method: yxml_element_prev_sibling");
280
+ yxml_element
281
+ .define_private_method(
282
+ "yxml_element_push_elem_back",
283
+ method!(YXmlElement::yxml_element_push_element_back, 2),
284
+ )
285
+ .expect("cannot define private method: yxml_element_push_elem_back");
286
+ yxml_element
287
+ .define_private_method(
288
+ "yxml_element_push_elem_front",
289
+ method!(YXmlElement::yxml_element_push_element_front, 2),
290
+ )
291
+ .expect("cannot define private method: yxml_element_push_elem_front");
292
+ yxml_element
293
+ .define_private_method(
294
+ "yxml_element_push_text_back",
295
+ method!(YXmlElement::yxml_element_push_text_back, 1),
296
+ )
297
+ .expect("cannot define private method: yxml_element_push_text_back");
298
+ yxml_element
299
+ .define_private_method(
300
+ "yxml_element_push_text_front",
301
+ method!(YXmlElement::yxml_element_push_text_front, 1),
302
+ )
303
+ .expect("cannot define private method: yxml_element_push_text_front");
304
+ yxml_element
305
+ .define_private_method(
306
+ "yxml_element_remove_attribute",
307
+ method!(YXmlElement::yxml_element_remove_attribute, 2),
308
+ )
309
+ .expect("cannot define private method: yxml_element_remove_range");
310
+ yxml_element
311
+ .define_private_method(
312
+ "yxml_element_remove_range",
313
+ method!(YXmlElement::yxml_element_remove_range, 3),
314
+ )
315
+ .expect("cannot define private method: yxml_element_remove_range");
316
+ yxml_element
317
+ .define_private_method(
318
+ "yxml_element_size",
319
+ method!(YXmlElement::yxml_element_size, 0),
320
+ )
321
+ .expect("cannot define private method: yxml_element_size");
322
+ yxml_element
323
+ .define_private_method(
324
+ "yxml_element_tag",
325
+ method!(YXmlElement::yxml_element_tag, 0),
326
+ )
327
+ .expect("cannot define private method: yxml_element_tag");
328
+ yxml_element
329
+ .define_private_method(
330
+ "yxml_element_to_s",
331
+ method!(YXmlElement::yxml_element_to_s, 0),
332
+ )
333
+ .expect("cannot define private method: yxml_element_to_s");
334
+ yxml_element
335
+ .define_private_method(
336
+ "yxml_element_unobserve",
337
+ method!(YXmlElement::yxml_element_unobserve, 1),
338
+ )
339
+ .expect("cannot define private method: yxml_element_unobserve");
340
+
341
+ let yxml_text = module
342
+ .define_class("XMLText", Default::default())
343
+ .expect("cannot define class Y::XMLText");
344
+
345
+ yxml_text
346
+ .define_private_method(
347
+ "yxml_text_attributes",
348
+ method!(YXmlText::yxml_text_attributes, 0),
349
+ )
350
+ .expect("cannot define private method: yxml_text_attributes");
351
+ yxml_text
352
+ .define_private_method("yxml_text_format", method!(YXmlText::yxml_text_format, 4))
353
+ .expect("cannot define private method: yxml_text_format");
354
+ yxml_text
355
+ .define_private_method(
356
+ "yxml_text_get_attribute",
357
+ method!(YXmlText::yxml_text_get_attribute, 1),
358
+ )
359
+ .expect("cannot define private method: yxml_text_get_attribute");
360
+ yxml_text
361
+ .define_private_method("yxml_text_insert", method!(YXmlText::yxml_text_insert, 3))
362
+ .expect("cannot define private method: yxml_text_insert");
363
+ yxml_text
364
+ .define_private_method(
365
+ "yxml_text_insert_attribute",
366
+ method!(YXmlText::yxml_text_insert_attribute, 3),
367
+ )
368
+ .expect("cannot define private method: yxml_text_insert_attribute");
369
+ yxml_text
370
+ .define_private_method(
371
+ "yxml_text_insert_embed_with_attrs",
372
+ method!(YXmlText::yxml_text_insert_embed_with_attributes, 4),
373
+ )
374
+ .expect("cannot define private method: yxml_text_insert_embed_with_attributes");
375
+ yxml_text
376
+ .define_private_method(
377
+ "yxml_text_insert_with_attrs",
378
+ method!(YXmlText::yxml_text_insert_with_attributes, 4),
379
+ )
380
+ .expect("cannot define private method: yxml_text_insert_with_attributes");
381
+ yxml_text
382
+ .define_private_method(
383
+ "yxml_text_insert_embed",
384
+ method!(YXmlText::yxml_text_insert_embed, 3),
385
+ )
386
+ .expect("cannot define private method: yxml_text_insert_embed");
387
+ yxml_text
388
+ .define_private_method("yxml_text_length", method!(YXmlText::yxml_text_length, 0))
389
+ .expect("cannot define private method: yxml_text_length");
390
+ yxml_text
391
+ .define_private_method(
392
+ "yxml_text_next_sibling",
393
+ method!(YXmlText::yxml_text_next_sibling, 0),
394
+ )
395
+ .expect("cannot define private method: yxml_text_next_sibling");
396
+ yxml_text
397
+ .define_private_method("yxml_text_parent", method!(YXmlText::yxml_text_parent, 0))
398
+ .expect("cannot define private method: yxml_text_parent");
399
+ yxml_text
400
+ .define_private_method(
401
+ "yxml_text_prev_sibling",
402
+ method!(YXmlText::yxml_text_prev_sibling, 0),
403
+ )
404
+ .expect("cannot define private method: yxml_text_prev_sibling");
405
+ yxml_text
406
+ .define_private_method("yxml_text_push", method!(YXmlText::yxml_text_push, 2))
407
+ .expect("cannot define private method: yxml_text_push");
408
+ yxml_text
409
+ .define_private_method(
410
+ "yxml_text_remove_range",
411
+ method!(YXmlText::yxml_text_remove_range, 3),
412
+ )
413
+ .expect("cannot define private method: yxml_text_remove_range");
414
+ yxml_text
415
+ .define_private_method("yxml_text_to_s", method!(YXmlText::yxml_text_to_s, 0))
416
+ .expect("cannot define private method: yxml_text_to_s");
417
+
418
+ let yawareness = module
419
+ .define_class("Awareness", Default::default())
420
+ .expect("cannot define class Y::Awareness");
421
+ yawareness
422
+ .define_singleton_method("new", function!(YAwareness::yawareness_new, 0))
423
+ .expect("cannot define singleton method: yawareness_new");
424
+ yawareness
425
+ .define_private_method(
426
+ "yawareness_apply_update",
427
+ method!(YAwareness::yawareness_apply_update, 1),
428
+ )
429
+ .expect("cannot define private method: yawareness_apply_update");
430
+ yawareness
431
+ .define_private_method(
432
+ "yawareness_clean_local_state",
433
+ method!(YAwareness::yawareness_clean_local_state, 0),
434
+ )
435
+ .expect("cannot define private method: yawareness_clean_local_state");
436
+ yawareness
437
+ .define_private_method(
438
+ "yawareness_clients",
439
+ method!(YAwareness::yawareness_clients, 0),
440
+ )
441
+ .expect("cannot define private method: yawareness_clients");
442
+ yawareness
443
+ .define_private_method(
444
+ "yawareness_client_id",
445
+ method!(YAwareness::yawareness_client_id, 0),
446
+ )
447
+ .expect("cannot define private method: yawareness_client_id");
448
+ yawareness
449
+ .define_private_method(
450
+ "yawareness_local_state",
451
+ method!(YAwareness::yawareness_local_state, 0),
452
+ )
453
+ .expect("cannot define private method: yawareness_local_state");
454
+ yawareness
455
+ .define_private_method(
456
+ "yawareness_on_update",
457
+ method!(YAwareness::yawareness_on_update, 1),
458
+ )
459
+ .expect("cannot define private method: yawareness_on_update");
460
+ yawareness
461
+ .define_private_method(
462
+ "yawareness_remove_on_update",
463
+ method!(YAwareness::yawareness_remove_on_update, 1),
464
+ )
465
+ .expect("cannot define private method: yawareness_remove_on_update");
466
+ yawareness
467
+ .define_private_method(
468
+ "yawareness_remove_state",
469
+ method!(YAwareness::yawareness_remove_state, 1),
470
+ )
471
+ .expect("cannot define private method: yawareness_remove_state");
472
+ yawareness
473
+ .define_private_method(
474
+ "yawareness_set_local_state",
475
+ method!(YAwareness::yawareness_set_local_state, 1),
476
+ )
477
+ .expect("cannot define private method: yawareness_set_local_state");
478
+ yawareness
479
+ .define_private_method(
480
+ "yawareness_update",
481
+ method!(YAwareness::yawareness_update, 0),
482
+ )
483
+ .expect("cannot define private method: yawareness_update");
484
+ yawareness
485
+ .define_private_method(
486
+ "yawareness_update_with_clients",
487
+ method!(YAwareness::yawareness_update_with_clients, 1),
488
+ )
489
+ .expect("cannot define private method: yawareness_update_with_clients");
490
+
491
+ let yawareness_event = module
492
+ .define_class("AwarenessEvent", Default::default())
493
+ .expect("cannot define class Y:AwarenessEvent");
494
+ yawareness_event
495
+ .define_method("added", method!(YAwarenessEvent::added, 0))
496
+ .expect("cannot define private method: added");
497
+ yawareness_event
498
+ .define_method("updated", method!(YAwarenessEvent::updated, 0))
499
+ .expect("cannot define private method: updated");
500
+ yawareness_event
501
+ .define_method("removed", method!(YAwarenessEvent::removed, 0))
502
+ .expect("cannot define private method: removed");
503
+
504
+ Ok(())
505
+ }
@@ -0,0 +1,34 @@
1
+ use crate::yvalue::YValue;
2
+ use lib0::any::Any;
3
+ use magnus::r_hash::ForEach::Continue;
4
+ use magnus::{Error, RHash, RString, Symbol, Value};
5
+ use std::rc::Rc;
6
+ use yrs::types::Attrs;
7
+
8
+ #[derive(Debug, Clone)]
9
+ pub(crate) struct TypeConversionError;
10
+
11
+ pub(crate) fn indifferent_hash_key(key: Value) -> Option<String> {
12
+ RString::from_value(key)
13
+ .map(|v| v.to_string().unwrap())
14
+ .or_else(|| Symbol::from_value(key).map(|v| v.name().unwrap().to_string()))
15
+ }
16
+
17
+ pub(crate) fn map_rhash_to_attrs(hash: RHash) -> Result<Attrs, Error> {
18
+ let mut a: Attrs = Default::default();
19
+
20
+ let result = hash.foreach(|key: Value, value: Value| {
21
+ let k = Rc::from(key.to_string());
22
+ let v = Any::from(YValue::from(value));
23
+
24
+ a.insert(k, v);
25
+
26
+ Ok(Continue)
27
+ });
28
+
29
+ if result.is_err() {
30
+ return Err(Error::runtime_error("could not map hash to attrs"));
31
+ }
32
+
33
+ Ok(a)
34
+ }
@@ -0,0 +1,44 @@
1
+ use lib0::any::Any;
2
+ use magnus::{RArray, RHash, RString, Value, QNIL};
3
+ use std::borrow::Borrow;
4
+ use std::ops::{Deref, DerefMut};
5
+
6
+ pub(crate) struct YAny(pub(crate) Any);
7
+
8
+ impl Deref for YAny {
9
+ type Target = Any;
10
+
11
+ fn deref(&self) -> &Self::Target {
12
+ &self.0
13
+ }
14
+ }
15
+
16
+ impl DerefMut for YAny {
17
+ fn deref_mut(&mut self) -> &mut Self::Target {
18
+ &mut self.0
19
+ }
20
+ }
21
+
22
+ impl TryInto<Value> for YAny {
23
+ type Error = ();
24
+
25
+ fn try_into(self) -> Result<Value, Self::Error> {
26
+ return match self.0 {
27
+ Any::Array(_v) => {
28
+ let arr = RArray::new();
29
+ Ok(Value::from(arr))
30
+ }
31
+ Any::Map(_v) => {
32
+ let hash = RHash::new();
33
+ Ok(Value::from(hash))
34
+ }
35
+ Any::Null => Ok(Value::from(QNIL)),
36
+ Any::Undefined => Ok(Value::from(QNIL)),
37
+ Any::Bool(v) => Ok(Value::from(v)),
38
+ Any::Number(v) => Ok(Value::from(v)),
39
+ Any::BigInt(v) => Ok(Value::from(v)),
40
+ Any::String(v) => Ok(Value::from(RString::from(v.borrow()))),
41
+ Any::Buffer(v) => Ok(Value::from(RString::from_slice(v.borrow()))),
42
+ };
43
+ }
44
+ }