File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -133,11 +133,6 @@ impl Vfs {
133
133
self . get ( file_id) . as_deref ( ) . unwrap ( )
134
134
}
135
135
136
- /// File content, but returns None if the file was deleted.
137
- pub fn file_contents_opt ( & self , file_id : FileId ) -> Option < & [ u8 ] > {
138
- self . get ( file_id) . as_deref ( )
139
- }
140
-
141
136
/// Returns the overall memory usage for the stored files.
142
137
pub fn memory_usage ( & self ) -> usize {
143
138
self . data . iter ( ) . flatten ( ) . map ( |d| d. capacity ( ) ) . sum ( )
@@ -167,6 +162,12 @@ impl Vfs {
167
162
self . set_file_id_contents ( file_id, contents)
168
163
}
169
164
165
+ /// Update the given `file_id` with the given `contents`. `None` means the file was deleted.
166
+ ///
167
+ /// Returns `true` if the file was modified, and saves the [change](ChangedFile).
168
+ ///
169
+ /// If the path does not currently exists in the `Vfs`, allocates a new
170
+ /// [`FileId`] for it.
170
171
pub fn set_file_id_contents ( & mut self , file_id : FileId , mut contents : Option < Vec < u8 > > ) -> bool {
171
172
let change_kind = match ( self . get ( file_id) , & contents) {
172
173
( None , None ) => return false ,
You can’t perform that action at this time.
0 commit comments