MCPcopy Create free account
hub / github.com/bytecodealliance/system-interface / append_all

Method append_all

src/fs/file_io_ext.rs:264–275  ·  view source on GitHub ↗

Attempts to write an entire buffer at the end of a file. This leaves the current position of the file unmodified. This operation is not guaranteed to be atomic with respect to other users of the same open file description. This operation is less efficient on some platforms than opening the file in append mode and doing regular writes.

(&self, mut buf: &[u8])

Source from the content-addressed store, hash-verified

262 /// This operation is less efficient on some platforms than opening the
263 /// file in append mode and doing regular writes.
264 fn append_all(&self, mut buf: &[u8]) -> io::Result<()> {
265 while !buf.is_empty() {
266 match self.append(buf) {
267 Ok(nwritten) => {
268 buf = &buf[nwritten..];
269 }
270 Err(ref e) if e.kind() == io::ErrorKind::Interrupted => (),
271 Err(e) => return Err(e),
272 }
273 }
274 Ok(())
275 }
276
277 /// Is to `append` what `write_vectored` is to `write`.
278 fn append_vectored(&self, bufs: &[IoSlice]) -> io::Result<usize> {

Callers

nothing calls this directly

Implementers 1

file_io_ext.rssrc/fs/file_io_ext.rs

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected