@@ -43,11 +43,23 @@ impl<S> ImDocument<S> {
43
43
& self . root
44
44
}
45
45
46
+ /// Returns the root item.
47
+ pub fn into_item ( self ) -> Item {
48
+ self . root
49
+ }
50
+
46
51
/// Returns a reference to the root table.
47
52
pub fn as_table ( & self ) -> & Table {
48
53
self . root . as_table ( ) . expect ( "root should always be a table" )
49
54
}
50
55
56
+ /// Returns the root table.
57
+ pub fn into_table ( self ) -> Table {
58
+ self . root
59
+ . into_table ( )
60
+ . expect ( "root should always be a table" )
61
+ }
62
+
51
63
/// Returns an iterator over the root table.
52
64
pub fn iter ( & self ) -> Iter < ' _ > {
53
65
self . as_table ( ) . iter ( )
@@ -129,6 +141,11 @@ impl DocumentMut {
129
141
& mut self . root
130
142
}
131
143
144
+ /// Returns the root item.
145
+ pub fn into_item ( self ) -> Item {
146
+ self . root
147
+ }
148
+
132
149
/// Returns a reference to the root table.
133
150
pub fn as_table ( & self ) -> & Table {
134
151
self . root . as_table ( ) . expect ( "root should always be a table" )
@@ -141,6 +158,13 @@ impl DocumentMut {
141
158
. expect ( "root should always be a table" )
142
159
}
143
160
161
+ /// Returns the root table.
162
+ pub fn into_table ( self ) -> Table {
163
+ self . root
164
+ . into_table ( )
165
+ . expect ( "root should always be a table" )
166
+ }
167
+
144
168
/// Returns an iterator over the root table.
145
169
pub fn iter ( & self ) -> Iter < ' _ > {
146
170
self . as_table ( ) . iter ( )
0 commit comments