tag | 273754c7698762889f1028c73a623cf0e20af5a0 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon Apr 01 16:10:07 2024 -0700 |
object | 62a2307cd0ad78a38398f1c2454a4059a2377b9f |
Android 14.0.0 Release 30 (AP1A.240405.002)
commit | 62a2307cd0ad78a38398f1c2454a4059a2377b9f | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Nov 21 00:14:06 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Nov 21 00:14:06 2023 +0000 |
tree | 9eb61c3b3b73d6edbf72dd37f68570b83f4cfecf | |
parent | fda401ea85bbc2a4240e084a001635453c83b4be [diff] | |
parent | bb883d4c3a812e81a2082037be260147f1cf33e6 [diff] |
Snap for 11124398 from bb883d4c3a812e81a2082037be260147f1cf33e6 to 24Q1-release Change-Id: If03334396822d2182b42a73e81cc77ed8dcc4d65
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); }