tag | d84f727e0db6cb3527ead2bf5ab89025bcdd352a | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon Apr 01 08:36:17 2024 -0700 |
object | c4c12c3e3cf08c553426026f2118c8adb8641e04 |
Android Security 14.0.0 Release 7 (11422633)
commit | c4c12c3e3cf08c553426026f2118c8adb8641e04 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Mar 10 02:22:35 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Mar 10 02:22:35 2023 +0000 |
tree | 95cb488307c04b8942d85975d0676fb4c1e1ce04 | |
parent | 3639849efc49986480dfc470e3819a9ce3bd150b [diff] | |
parent | a8e9ddec5055215979b8999ade9eb5a2b4cde18e [diff] |
Snap for 9719949 from a8e9ddec5055215979b8999ade9eb5a2b4cde18e to udc-release Change-Id: Ib435ebb63131ec5f1e6e78429286636be71a6ea7
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); }