This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement file append functionality. (#50)
* Implement file append functionality. - In the preview1-to-preview2 polyfill, using `append_via_stream`. - In the host implementation, using a new system-interface `FileIoExt::append` function. * Add a basic testcase.
- Loading branch information
1 parent
b6d24aa
commit d56b897
Showing
6 changed files
with
192 additions
and
86 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::{ | ||
error::Error, | ||
fs::OpenOptions, | ||
io::{Seek, SeekFrom, Write}, | ||
}; | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
let mut file = OpenOptions::new().append(true).open("bar.txt")?; | ||
|
||
file.write_all(b"Did gyre and gimble in the wabe;\n") | ||
.unwrap(); | ||
file.seek(SeekFrom::Start(0)).unwrap(); | ||
file.write_all(b"All mimsy were the borogoves,\n").unwrap(); | ||
file.write_all(b"And the mome raths outgrabe.\n").unwrap(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.