y-rb 0.1.4.alpha.1-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,58 @@
1
+ use crate::yarray::YArray;
2
+ use crate::ymap::YMap;
3
+ use crate::ytext::YText;
4
+ use crate::yxml_element::YXmlElement;
5
+ use crate::yxml_text::YXmlText;
6
+ use magnus::Error;
7
+ use std::cell::RefCell;
8
+ use yrs::updates::decoder::Decode;
9
+ use yrs::updates::encoder::Encode;
10
+ use yrs::{Transaction, Update};
11
+
12
+ #[magnus::wrap(class = "Y::Transaction")]
13
+ pub(crate) struct YTransaction(pub(crate) RefCell<Transaction>);
14
+
15
+ impl YTransaction {
16
+ pub(crate) fn ytransaction_apply_update(
17
+ &self,
18
+ update: Vec<u8>
19
+ ) -> Result<(), Error> {
20
+ return Update::decode_v1(update.as_slice())
21
+ .map(|u| self.0.borrow_mut().apply_update(u))
22
+ .map_err(|_e| Error::runtime_error("cannot apply update"));
23
+ }
24
+ pub(crate) fn ytransaction_commit(&self) {
25
+ self.0.borrow_mut().commit();
26
+ }
27
+ pub(crate) fn ytransaction_get_array(&self, name: String) -> YArray {
28
+ let a = self.0.borrow_mut().get_array(&*name);
29
+
30
+ return YArray(RefCell::from(a));
31
+ }
32
+ pub(crate) fn ytransaction_get_map(&self, name: String) -> YMap {
33
+ let m = self.0.borrow_mut().get_map(&*name);
34
+
35
+ return YMap(RefCell::from(m));
36
+ }
37
+ pub(crate) fn ytransaction_get_text(&self, name: String) -> YText {
38
+ let t = self.0.borrow_mut().get_text(&*name);
39
+
40
+ return YText(RefCell::new(t));
41
+ }
42
+ pub(crate) fn ytransaction_get_xml_element(
43
+ &self,
44
+ name: String
45
+ ) -> YXmlElement {
46
+ let el = self.0.borrow_mut().get_xml_element(&*name);
47
+
48
+ return YXmlElement(RefCell::new(el));
49
+ }
50
+ pub(crate) fn ytransaction_get_xml_text(&self, name: String) -> YXmlText {
51
+ let t = self.0.borrow_mut().get_xml_text(&*name);
52
+
53
+ return YXmlText(RefCell::new(t));
54
+ }
55
+ pub(crate) fn ytransaction_state_vector(&self) -> Vec<u8> {
56
+ return self.0.borrow_mut().state_vector().encode_v1();
57
+ }
58
+ }
@@ -0,0 +1,235 @@
1
+ use crate::{YText, YXmlElement, YXmlText};
2
+ use lib0::any::Any;
3
+ use magnus::r_hash::ForEach::Continue;
4
+ use magnus::value::Qnil;
5
+ use magnus::{
6
+ class, Float, Integer, RArray, RHash, RString, Symbol, Value, QNIL
7
+ };
8
+ use std::cell::RefCell;
9
+ use std::collections::HashMap;
10
+ use yrs::types::Value as YrsValue;
11
+ use yrs::{
12
+ Text as YrsText, XmlElement as YrsXmlElement, XmlText as YrsXmlText
13
+ };
14
+
15
+ pub(crate) struct YValue(pub(crate) RefCell<Value>);
16
+
17
+ impl From<Value> for YValue {
18
+ fn from(value: Value) -> Self {
19
+ YValue(RefCell::from(value))
20
+ }
21
+ }
22
+
23
+ impl From<Qnil> for YValue {
24
+ fn from(value: Qnil) -> Self {
25
+ YValue(RefCell::from(Value::from(value)))
26
+ }
27
+ }
28
+
29
+ impl From<bool> for YValue {
30
+ fn from(value: bool) -> Self {
31
+ YValue(RefCell::from(Value::from(value)))
32
+ }
33
+ }
34
+
35
+ impl From<f64> for YValue {
36
+ fn from(value: f64) -> Self {
37
+ YValue(RefCell::from(Value::from(value)))
38
+ }
39
+ }
40
+
41
+ impl From<i64> for YValue {
42
+ fn from(value: i64) -> Self {
43
+ YValue(RefCell::from(Value::from(value)))
44
+ }
45
+ }
46
+
47
+ impl From<u32> for YValue {
48
+ fn from(value: u32) -> Self {
49
+ YValue(RefCell::from(Value::from(value)))
50
+ }
51
+ }
52
+
53
+ impl From<String> for YValue {
54
+ fn from(value: String) -> Self {
55
+ YValue(RefCell::from(Value::from(value)))
56
+ }
57
+ }
58
+
59
+ impl From<RArray> for YValue {
60
+ fn from(value: RArray) -> Self {
61
+ YValue(RefCell::from(Value::from(value)))
62
+ }
63
+ }
64
+
65
+ impl From<RHash> for YValue {
66
+ fn from(value: RHash) -> Self {
67
+ YValue(RefCell::from(Value::from(value)))
68
+ }
69
+ }
70
+
71
+ impl From<YrsText> for YValue {
72
+ fn from(value: YrsText) -> Self {
73
+ YValue(RefCell::from(Value::from(YText(RefCell::from(value)))))
74
+ }
75
+ }
76
+
77
+ impl From<YrsXmlElement> for YValue {
78
+ fn from(value: YrsXmlElement) -> Self {
79
+ YValue(RefCell::from(Value::from(YXmlElement(RefCell::from(
80
+ value
81
+ )))))
82
+ }
83
+ }
84
+
85
+ impl From<YrsXmlText> for YValue {
86
+ fn from(value: YrsXmlText) -> Self {
87
+ YValue(RefCell::from(Value::from(YXmlText(RefCell::from(value)))))
88
+ }
89
+ }
90
+
91
+ impl From<YText> for YValue {
92
+ fn from(value: YText) -> Self {
93
+ YValue(RefCell::from(Value::from(value)))
94
+ }
95
+ }
96
+
97
+ impl From<YXmlElement> for YValue {
98
+ fn from(value: YXmlElement) -> Self {
99
+ YValue(RefCell::from(Value::from(value)))
100
+ }
101
+ }
102
+
103
+ impl From<YXmlText> for YValue {
104
+ fn from(value: YXmlText) -> Self {
105
+ YValue(RefCell::from(Value::from(value)))
106
+ }
107
+ }
108
+
109
+ impl From<Any> for YValue {
110
+ fn from(value: Any) -> Self {
111
+ match value {
112
+ Any::Null => YValue::from(QNIL),
113
+ Any::Undefined => YValue::from(QNIL),
114
+ Any::Bool(v) => YValue::from(v),
115
+ Any::Number(v) => YValue::from(v),
116
+ Any::BigInt(v) => YValue::from(v),
117
+ Any::String(v) => YValue::from(v.into_string()),
118
+ Any::Buffer(v) => YValue::from(Value::from(v.into_vec())),
119
+ Any::Array(v) => {
120
+ let arr = v
121
+ .iter()
122
+ .map(|i| YValue::from(i.clone()))
123
+ .map(|value| *value.0.borrow())
124
+ .collect::<Vec<Value>>();
125
+ YValue::from(RArray::from_vec(arr))
126
+ }
127
+ Any::Map(v) => {
128
+ let map = v
129
+ .iter()
130
+ .map(|(key, val)| {
131
+ let v = val.clone();
132
+ (key.to_string(), YValue::from(v).into())
133
+ })
134
+ .collect::<HashMap<String, Value>>();
135
+ YValue::from(RHash::from_iter(map))
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ impl From<YrsValue> for YValue {
142
+ fn from(value: YrsValue) -> Self {
143
+ match value {
144
+ YrsValue::Any(val) => YValue::from(val),
145
+ YrsValue::YText(text) => YValue::from(text),
146
+ YrsValue::YXmlElement(el) => YValue::from(el),
147
+ YrsValue::YXmlText(text) => YValue::from(text),
148
+ // YrsValue::YArray(val) => YValue::from(RArray::from_vec(val.iter().map(|item| {
149
+ // let yvalue = YValue::from(item);
150
+ // *yvalue.0
151
+ // }))),
152
+ // YrsValue::YMap(val) => YValue::from(RHash::from_iter(val.iter())),
153
+ v => panic!(
154
+ "cannot map complex yrs values to yvalue: {}",
155
+ v.to_string()
156
+ )
157
+ }
158
+ }
159
+ }
160
+
161
+ impl From<YValue> for Any {
162
+ fn from(val: YValue) -> Self {
163
+ let value = val.0.into_inner();
164
+ if value.is_nil() {
165
+ Any::Null
166
+ } else if value.is_kind_of(class::float()) {
167
+ let f = Float::from_value(value).unwrap();
168
+ Any::Number(f.to_f64())
169
+ } else if value.is_kind_of(class::integer()) {
170
+ let i = Integer::from_value(value).unwrap();
171
+ Any::BigInt(i.to_i64().unwrap())
172
+ } else if value.is_kind_of(class::symbol()) {
173
+ let s = Symbol::from_value(value).unwrap();
174
+ Any::String(Box::from(s.name().unwrap()))
175
+ } else if value.is_kind_of(class::true_class()) {
176
+ Any::Bool(true)
177
+ } else if value.is_kind_of(class::false_class()) {
178
+ Any::Bool(false)
179
+ } else if value.is_kind_of(class::string()) {
180
+ let s = RString::from_value(value).unwrap();
181
+ unsafe { Any::String(Box::from(s.as_str().unwrap().to_string())) }
182
+ } else if value.is_kind_of(class::array()) {
183
+ let arr = RArray::from_value(value).unwrap();
184
+ let items = arr
185
+ .each()
186
+ .map(|item| {
187
+ let yvalue = YValue::from(item.unwrap());
188
+ Any::from(yvalue)
189
+ })
190
+ .collect::<Vec<Any>>();
191
+ Any::Array(Box::from(items))
192
+ } else if value.is_kind_of(class::hash()) {
193
+ let map = RHash::from_value(value).unwrap();
194
+ let mut m: HashMap<String, Any> = HashMap::new();
195
+
196
+ // we need to map symbol keys to strings, because we can't store
197
+ // symbols in any of the yrs data structures
198
+ map.foreach(|key: Value, val: Value| {
199
+ let k = if let Some(converted_key) = Symbol::from_value(key) {
200
+ converted_key.to_string()
201
+ } else {
202
+ let converted_key = RString::from_value(key).unwrap();
203
+ let result = converted_key.to_string();
204
+ result.unwrap()
205
+ };
206
+ m.insert(k, Any::from(YValue::from(val)));
207
+ Ok(Continue)
208
+ })
209
+ .expect("cannot map key/value pair");
210
+
211
+ Any::Map(Box::from(m))
212
+ } else {
213
+ Any::Undefined
214
+ }
215
+ }
216
+ }
217
+
218
+ impl Into<Value> for YValue {
219
+ fn into(self) -> Value {
220
+ self.0.into_inner()
221
+ }
222
+ }
223
+
224
+ #[cfg(test)]
225
+ mod tests {
226
+ use crate::yvalue::YValue;
227
+ use lib0::any::Any;
228
+ use magnus::RArray;
229
+
230
+ #[test]
231
+ fn convert_any_to_yvalue() {
232
+ let value = Any::Null;
233
+ let yvalue: YValue = value.into();
234
+ }
235
+ }
@@ -0,0 +1,225 @@
1
+ use crate::yvalue::YValue;
2
+ use crate::yxml_text::YXmlText;
3
+ use crate::YTransaction;
4
+ use magnus::block::Proc;
5
+ use magnus::{Error, RArray, RHash, Symbol, Value};
6
+ use std::cell::RefCell;
7
+ use yrs::types::Change;
8
+ use yrs::{Xml, XmlElement};
9
+
10
+ #[magnus::wrap(class = "Y::XMLElement")]
11
+ pub(crate) struct YXmlElement(pub(crate) RefCell<XmlElement>);
12
+
13
+ impl YXmlElement {
14
+ pub(crate) fn yxml_element_attributes(&self) -> RHash {
15
+ RHash::from_iter(self.0.borrow().attributes().into_iter())
16
+ }
17
+ pub(crate) fn yxml_element_first_child(&self) -> Option<Value> {
18
+ self.yxml_element_get(0)
19
+ }
20
+ pub(crate) fn yxml_element_get(&self, index: u32) -> Option<Value> {
21
+ self.0.borrow().get(index).map(|node| match node {
22
+ Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
23
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
24
+ })
25
+ }
26
+ pub(crate) fn yxml_element_get_attribute(
27
+ &self,
28
+ name: String
29
+ ) -> Option<String> {
30
+ self.0.borrow().get_attribute(&*name)
31
+ }
32
+ pub(crate) fn yxml_element_insert_attribute(
33
+ &self,
34
+ transaction: &YTransaction,
35
+ name: String,
36
+ value: String
37
+ ) {
38
+ self.0.borrow_mut().insert_attribute(
39
+ &mut *transaction.0.borrow_mut(),
40
+ name,
41
+ value
42
+ );
43
+ }
44
+ pub(crate) fn yxml_element_insert_element(
45
+ &self,
46
+ transaction: &YTransaction,
47
+ index: u32,
48
+ name: String
49
+ ) {
50
+ self.0.borrow_mut().insert_elem(
51
+ &mut *transaction.0.borrow_mut(),
52
+ index,
53
+ name
54
+ );
55
+ }
56
+ pub(crate) fn yxml_element_insert_text(
57
+ &self,
58
+ transaction: &YTransaction,
59
+ index: u32
60
+ ) {
61
+ self.0
62
+ .borrow_mut()
63
+ .insert_text(&mut *transaction.0.borrow_mut(), index);
64
+ }
65
+ pub(crate) fn yxml_element_next_sibling(&self) -> Option<Value> {
66
+ self.0.borrow().next_sibling().map(|item| match item {
67
+ Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
68
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
69
+ })
70
+ }
71
+ pub(crate) fn yxml_element_observe(
72
+ &self,
73
+ block: Proc
74
+ ) -> Result<u32, Error> {
75
+ let change_added = Symbol::new("added").to_static();
76
+ let change_retain = Symbol::new("retain").to_static();
77
+ let change_removed = Symbol::new("removed").to_static();
78
+
79
+ let subscription_id = self.0.borrow_mut().observe(
80
+ move |transaction, xml_element_event| {
81
+ let delta = xml_element_event.delta(transaction);
82
+ let changes = RArray::with_capacity(delta.len());
83
+
84
+ for change in delta {
85
+ match change {
86
+ Change::Added(v) => {
87
+ let values = v
88
+ .iter()
89
+ .map(|o| YValue::from(o.clone()))
90
+ .map(|o| *o.0.borrow())
91
+ .collect::<Vec<_>>();
92
+
93
+ let payload = RHash::new();
94
+ payload
95
+ .aset(change_added, RArray::from_vec(values))
96
+ .expect("cannot create change::added payload");
97
+
98
+ changes.push(payload).expect(
99
+ "cannot push payload to list of changes"
100
+ );
101
+ }
102
+ Change::Retain(position) => {
103
+ let payload = RHash::new();
104
+ payload
105
+ .aset(change_retain, *position)
106
+ .expect("cannot create change::retain payload");
107
+
108
+ changes.push(payload).expect(
109
+ "cannot push payload to list of changes"
110
+ );
111
+ }
112
+ Change::Removed(position) => {
113
+ let payload = RHash::new();
114
+ payload.aset(change_removed, *position).expect(
115
+ "cannot create change::removed payload"
116
+ );
117
+
118
+ changes.push(payload).expect(
119
+ "cannot push payload to list of changes"
120
+ );
121
+ }
122
+ }
123
+ }
124
+
125
+ block
126
+ .call::<(RArray,), Value>((changes,))
127
+ .expect("cannot call block");
128
+ }
129
+ );
130
+
131
+ Ok(subscription_id.into())
132
+ }
133
+ pub(crate) fn yxml_element_parent(&self) -> Option<Value> {
134
+ self.0
135
+ .borrow()
136
+ .parent()
137
+ .map(|item| Value::from(YXmlElement(RefCell::from(item))))
138
+ }
139
+ pub(crate) fn yxml_element_prev_sibling(&self) -> Option<Value> {
140
+ self.0.borrow().prev_sibling().map(|item| match item {
141
+ Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
142
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
143
+ })
144
+ }
145
+ pub(crate) fn yxml_element_push_element_back(
146
+ &self,
147
+ transaction: &YTransaction,
148
+ name: String
149
+ ) -> YXmlElement {
150
+ let xml_element = self
151
+ .0
152
+ .borrow_mut()
153
+ .push_elem_back(&mut *transaction.0.borrow_mut(), name);
154
+
155
+ YXmlElement(RefCell::from(xml_element))
156
+ }
157
+ pub(crate) fn yxml_element_push_element_front(
158
+ &self,
159
+ transaction: &YTransaction,
160
+ name: String
161
+ ) -> YXmlElement {
162
+ let xml_element = self
163
+ .0
164
+ .borrow_mut()
165
+ .push_elem_front(&mut *transaction.0.borrow_mut(), name);
166
+
167
+ YXmlElement(RefCell::from(xml_element))
168
+ }
169
+ pub(crate) fn yxml_element_push_text_back(
170
+ &self,
171
+ transaction: &YTransaction
172
+ ) -> YXmlText {
173
+ let xml_text = self
174
+ .0
175
+ .borrow_mut()
176
+ .push_text_back(&mut *transaction.0.borrow_mut());
177
+
178
+ YXmlText(RefCell::from(xml_text))
179
+ }
180
+ pub(crate) fn yxml_element_push_text_front(
181
+ &self,
182
+ transaction: &YTransaction
183
+ ) -> YXmlText {
184
+ let xml_text = self
185
+ .0
186
+ .borrow_mut()
187
+ .push_text_front(&mut *transaction.0.borrow_mut());
188
+
189
+ YXmlText(RefCell::from(xml_text))
190
+ }
191
+ pub(crate) fn yxml_element_remove_attribute(
192
+ &self,
193
+ transaction: &YTransaction,
194
+ name: String
195
+ ) {
196
+ self.0.borrow_mut().remove_attribute::<&str>(
197
+ &mut *transaction.0.borrow_mut(),
198
+ &name.as_str()
199
+ );
200
+ }
201
+ pub(crate) fn yxml_element_remove_range(
202
+ &self,
203
+ transaction: &YTransaction,
204
+ index: u32,
205
+ length: u32
206
+ ) {
207
+ self.0.borrow_mut().remove_range(
208
+ &mut *transaction.0.borrow_mut(),
209
+ index,
210
+ length
211
+ );
212
+ }
213
+ pub(crate) fn yxml_element_size(&self) -> u32 {
214
+ self.0.borrow().len()
215
+ }
216
+ pub(crate) fn yxml_element_tag(&self) -> String {
217
+ self.0.borrow().tag().to_string()
218
+ }
219
+ pub(crate) fn yxml_element_to_s(&self) -> String {
220
+ self.0.borrow().to_string()
221
+ }
222
+ pub(crate) fn yxml_element_unobserve(&self, subscription_id: u32) {
223
+ self.0.borrow_mut().unobserve(subscription_id);
224
+ }
225
+ }
@@ -0,0 +1,154 @@
1
+ use crate::utils::map_rhash_to_attrs;
2
+ use crate::yvalue::YValue;
3
+ use crate::{YTransaction, YXmlElement};
4
+ use lib0::any::Any;
5
+ use magnus::{Error, RHash, Value};
6
+ use std::cell::RefCell;
7
+ use yrs::{Xml, XmlText};
8
+
9
+ #[magnus::wrap(class = "Y::XMLText")]
10
+ pub(crate) struct YXmlText(pub(crate) RefCell<XmlText>);
11
+
12
+ impl YXmlText {
13
+ pub(crate) fn yxml_text_attributes(&self) -> RHash {
14
+ RHash::from_iter(self.0.borrow().attributes().into_iter())
15
+ }
16
+ pub(crate) fn yxml_text_format(
17
+ &self,
18
+ transaction: &YTransaction,
19
+ index: u32,
20
+ length: u32,
21
+ attrs: RHash
22
+ ) -> Result<(), Error> {
23
+ map_rhash_to_attrs(attrs).map(|a| {
24
+ self.0.borrow_mut().format(
25
+ &mut *transaction.0.borrow_mut(),
26
+ index,
27
+ length,
28
+ a
29
+ );
30
+ })
31
+ }
32
+ pub(crate) fn yxml_text_get_attribute(
33
+ &self,
34
+ name: String
35
+ ) -> Option<String> {
36
+ self.0.borrow().get_attribute(&*name)
37
+ }
38
+ pub(crate) fn yxml_text_insert(
39
+ &self,
40
+ transaction: &YTransaction,
41
+ index: u32,
42
+ content: String
43
+ ) {
44
+ self.0.borrow_mut().insert(
45
+ &mut *transaction.0.borrow_mut(),
46
+ index,
47
+ &*content
48
+ )
49
+ }
50
+ pub(crate) fn yxml_text_insert_attribute(
51
+ &self,
52
+ transaction: &YTransaction,
53
+ name: String,
54
+ value: String
55
+ ) {
56
+ self.0.borrow_mut().insert_attribute(
57
+ &mut *transaction.0.borrow_mut(),
58
+ name,
59
+ value
60
+ )
61
+ }
62
+ pub(crate) fn yxml_text_insert_embed_with_attributes(
63
+ &self,
64
+ transaction: &YTransaction,
65
+ index: u32,
66
+ content: Value,
67
+ attrs: RHash
68
+ ) -> Result<(), Error> {
69
+ let yvalue = YValue::from(content);
70
+ let avalue = Any::from(yvalue);
71
+
72
+ map_rhash_to_attrs(attrs).map(|a| {
73
+ self.0.borrow_mut().insert_embed_with_attributes(
74
+ &mut *transaction.0.borrow_mut(),
75
+ index,
76
+ avalue,
77
+ a
78
+ );
79
+ })
80
+ }
81
+ pub(crate) fn yxml_text_insert_embed(
82
+ &self,
83
+ transaction: &YTransaction,
84
+ index: u32,
85
+ embed: Value
86
+ ) {
87
+ self.0.borrow_mut().insert_embed(
88
+ &mut *transaction.0.borrow_mut(),
89
+ index,
90
+ Any::from(YValue::from(embed))
91
+ )
92
+ }
93
+ pub(crate) fn yxml_text_insert_with_attributes(
94
+ &self,
95
+ transaction: &YTransaction,
96
+ index: u32,
97
+ content: String,
98
+ attrs: RHash
99
+ ) -> Result<(), Error> {
100
+ map_rhash_to_attrs(attrs).map(|a| {
101
+ self.0.borrow_mut().insert_with_attributes(
102
+ &mut *transaction.0.borrow_mut(),
103
+ index,
104
+ &*content,
105
+ a
106
+ );
107
+ })
108
+ }
109
+ pub(crate) fn yxml_text_length(&self) -> u32 {
110
+ self.0.borrow().len()
111
+ }
112
+ pub(crate) fn yxml_text_next_sibling(&self) -> Option<Value> {
113
+ self.0.borrow().next_sibling().map(|item| match item {
114
+ Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
115
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
116
+ })
117
+ }
118
+ pub(crate) fn yxml_text_parent(&self) -> Option<Value> {
119
+ self.0
120
+ .borrow()
121
+ .parent()
122
+ .map(|item| Value::from(YXmlElement(RefCell::from(item))))
123
+ }
124
+ pub(crate) fn yxml_text_prev_sibling(&self) -> Option<Value> {
125
+ self.0.borrow().prev_sibling().map(|item| match item {
126
+ Xml::Element(el) => Value::from(YXmlElement(RefCell::from(el))),
127
+ Xml::Text(text) => Value::from(YXmlText(RefCell::from(text)))
128
+ })
129
+ }
130
+ pub(crate) fn yxml_text_push(
131
+ &self,
132
+ transaction: &YTransaction,
133
+ content: String
134
+ ) {
135
+ self.0
136
+ .borrow_mut()
137
+ .push(&mut *transaction.0.borrow_mut(), &*content)
138
+ }
139
+ pub(crate) fn yxml_text_remove_range(
140
+ &self,
141
+ transaction: &YTransaction,
142
+ index: u32,
143
+ length: u32
144
+ ) {
145
+ self.0.borrow_mut().remove_range(
146
+ &mut *transaction.0.borrow_mut(),
147
+ index,
148
+ length
149
+ );
150
+ }
151
+ pub(crate) fn yxml_text_to_s(&self) -> String {
152
+ self.0.borrow().to_string()
153
+ }
154
+ }
Binary file
Binary file
Binary file