Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
src/ | 03-May-2024 | - | 2,449 | 896 | ||
tests/ | 03-May-2024 | - | 920 | 740 | ||
Android.bp | D | 03-May-2024 | 1.9 KiB | 59 | 55 | |
Cargo.toml | D | 03-May-2024 | 1 KiB | 43 | 36 | |
LICENSE | D | 03-May-2024 | 10.6 KiB | 202 | 169 | |
LICENSE-APACHE | D | 03-May-2024 | 10.6 KiB | 202 | 169 | |
LICENSE-MIT | D | 03-May-2024 | 1 KiB | 26 | 22 | |
METADATA | D | 03-May-2024 | 475 | 21 | 20 | |
MODULE_LICENSE_APACHE2 | D | 03-May-2024 | 0 | |||
NEWS | D | 03-May-2024 | 4 KiB | 192 | 124 | |
OWNERS | D | 03-May-2024 | 77 | 4 | 3 | |
README.md | D | 03-May-2024 | 1.2 KiB | 46 | 34 | |
TEST_MAPPING | D | 03-May-2024 | 643 | 38 | 37 | |
cargo2android.json | D | 03-May-2024 | 142 | 9 | 9 |
README.md
1tempfile 2======== 3 4[](https://crates.io/crates/tempfile) 5[](https://github.com/Stebalien/tempfile/actions/workflows/ci.yml?query=branch%3Amaster) 6 7A secure, cross-platform, temporary file library for Rust. In addition to creating 8temporary files, this library also allows users to securely open multiple 9independent references to the same temporary file (useful for consumer/producer 10patterns and surprisingly difficult to implement securely). 11 12[Documentation](https://docs.rs/tempfile/) 13 14Usage 15----- 16 17Minimum required Rust version: 1.40.0 18 19Add this to your `Cargo.toml`: 20```toml 21[dependencies] 22tempfile = "3" 23``` 24 25Example 26------- 27 28```rust 29use std::fs::File; 30use std::io::{Write, Read, Seek, SeekFrom}; 31 32fn main() { 33 // Write 34 let mut tmpfile: File = tempfile::tempfile().unwrap(); 35 write!(tmpfile, "Hello World!").unwrap(); 36 37 // Seek to start 38 tmpfile.seek(SeekFrom::Start(0)).unwrap(); 39 40 // Read 41 let mut buf = String::new(); 42 tmpfile.read_to_string(&mut buf).unwrap(); 43 assert_eq!("Hello World!", buf); 44} 45``` 46