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