File tree 2 files changed +43
-4
lines changed
libs/jwst-codec/src/doc/types
2 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ pub struct TypeStore {
64
64
pub start : Option < StructRef > ,
65
65
pub map : HashMap < String , StructRef > ,
66
66
pub item : Option < StructRef > ,
67
+ pub len : usize ,
67
68
kind : TypeStoreKind ,
68
69
}
69
70
@@ -75,6 +76,7 @@ impl TypeStore {
75
76
start : None ,
76
77
map : HashMap :: new ( ) ,
77
78
item : None ,
79
+ len : 0 ,
78
80
kind,
79
81
}
80
82
}
@@ -86,6 +88,12 @@ impl TypeStore {
86
88
}
87
89
}
88
90
91
+ impl From < TypeStore > for TypeStoreRef {
92
+ fn from ( value : TypeStore ) -> Self {
93
+ Arc :: new ( RefCell :: new ( value) )
94
+ }
95
+ }
96
+
89
97
impl From < YType > for TypeStore {
90
98
fn from ( value : YType ) -> Self {
91
99
match value {
Original file line number Diff line number Diff line change 1
- use crate :: { wrap_inner , Item } ;
1
+ use crate :: Item ;
2
2
3
- pub struct YTextInner {
4
- item : Item ,
3
+ use super :: { TypeStore , TypeStoreKind , TypeStoreRef } ;
4
+
5
+ pub struct YText {
6
+ inner : TypeStoreRef ,
7
+ }
8
+
9
+ impl YText {
10
+ pub fn new ( ) -> Self {
11
+ Self {
12
+ inner : TypeStore :: new ( TypeStoreKind :: Text ) . into ( ) ,
13
+ }
14
+ }
5
15
}
6
16
7
- wrap_inner ! ( YText , YTextInner ) ;
17
+ impl From < String > for YText {
18
+ fn from ( value : String ) -> Self {
19
+ let mut text = Self :: new ( ) ;
20
+ text. insert ( 0 , value) ;
21
+
22
+ text
23
+ }
24
+ }
25
+
26
+ impl YText {
27
+ pub fn len ( & self ) -> usize {
28
+ self . inner . borrow ( ) . len
29
+ }
30
+
31
+ pub fn insert ( & mut self , index : usize , text : String ) {
32
+ let pos = self . find_position ( index) ;
33
+ }
34
+
35
+ fn find_position ( & self , index : usize ) -> Option < Item > {
36
+ todo ! ( )
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments