MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / truncate

Method truncate

euralios_std/src/fs.rs:139–141  ·  view source on GitHub ↗

Sets the option for truncating a previous file. If a file is successfully opened with this option set it will truncate the file to 0 length if it already exists. The file must be opened with write access for truncate to work. # Examples ```no_run use std::fs::OpenOptions; let file = OpenOptions::new().write(true).truncate(true).open("foo.txt"); ```

(&mut self, truncate: bool)

Source from the content-addressed store, hash-verified

137 /// let file = OpenOptions::new().write(true).truncate(true).open("foo.txt");
138 /// ```
139 pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions {
140 self.truncate = truncate; self
141 }
142
143 /// Sets the option for creating a new file.
144 ///

Callers 2

_pushMethod · 0.80
popMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected