commit | b4efe675559a2a73cf98e4ecd4d033991ffede8b | [log] [tgz] |
---|---|---|
author | Bob Badour <[email protected]> | Fri Nov 12 07:43:09 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Nov 12 07:43:09 2021 +0000 |
tree | fcb396b07e23f89a3426f986166cc84224552920 | |
parent | 53e0c19b712ff8b3d85b46b2b1ca3f0cf52af287 [diff] | |
parent | db2f09c48599a785ef41bc4fedd9f5641f6dd434 [diff] |
[LSC] Add LOCAL_LICENSE_KINDS to external/rust/crates/tempfile am: 79baa53add am: 819379d50e am: db2f09c485 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/tempfile/+/1889361 Change-Id: I635cfa0ebcc0c3f40d008c9a9f2fb3793791f1c1
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); }