commit | 21022c60b8fae5f935b66a6cb2f8a760f6e13cef | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <[email protected]> | Thu Feb 23 16:45:15 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Feb 23 16:45:15 2023 +0000 |
tree | 632a499f62c12dc7f097c0214344371ef9d8384c | |
parent | e0bc8c243d80bf239c44574fb8fa2ed6f3708681 [diff] | |
parent | ac2418efc9b885be1834e46a8afd6b90bcdf0966 [diff] |
Upgrade tempfile to 3.3.0 am: 4578b5b3b3 am: 988df0ca05 am: 6355fc08f5 am: ac2418efc9 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/tempfile/+/2421166 Change-Id: I09f40a6d4812385add54efa7f61679ae58f64c57 Signed-off-by: Automerger Merge Worker <[email protected]>
A secure, cross-platform, temporary file library for Rust. In addition to creating temporary files, this library also allows users to securely open multiple independent references to the same temporary file (useful for consumer/producer patterns and surprisingly difficult to implement securely).
Minimum required Rust version: 1.40.0
Add this to your Cargo.toml
:
[dependencies] tempfile = "3"
use std::fs::File; use std::io::{Write, Read, Seek, SeekFrom}; fn main() { // Write let mut tmpfile: File = tempfile::tempfile().unwrap(); write!(tmpfile, "Hello World!").unwrap(); // Seek to start tmpfile.seek(SeekFrom::Start(0)).unwrap(); // Read let mut buf = String::new(); tmpfile.read_to_string(&mut buf).unwrap(); assert_eq!("Hello World!", buf); }