|
1 |
| -#![cfg_attr(feature = "nightly", deny(missing_docs))] |
2 |
| -#![cfg_attr(feature = "nightly", feature(external_doc))] |
3 |
| -#![cfg_attr(feature = "nightly", doc(include = "../README.md"))] |
| 1 | +#![forbid(unsafe_code, bad_style, future_incompatible)] |
| 2 | +#![forbid(rust_2018_idioms, rust_2018_compatibility)] |
| 3 | +#![deny(missing_debug_implementations)] |
| 4 | +#![forbid(missing_docs)] |
4 | 5 | #![cfg_attr(test, deny(warnings))]
|
5 | 6 |
|
| 7 | +//! # Example |
| 8 | +//! __Basic usage__ |
| 9 | +//! ```rust |
| 10 | +//! # extern crate random_access_storage; |
| 11 | +//! # extern crate random_access_disk; |
| 12 | +//! # extern crate tempfile; |
| 13 | +//! # extern crate failure; |
| 14 | +//! use random_access_disk::RandomAccessDisk; |
| 15 | +//! use random_access_storage::RandomAccess; |
| 16 | +//! use tempfile::Builder; |
| 17 | +//! # use failure::Error; |
| 18 | +//! |
| 19 | +//! # fn main () -> Result<(), Error>{ |
| 20 | +//! let dir = Builder::new() |
| 21 | +//! .prefix("random-access-disk") |
| 22 | +//! .tempdir()?; |
| 23 | +//! |
| 24 | +//! let file = dir.path().join("example.db"); |
| 25 | +//! let mut file = RandomAccessDisk::open(file)?; |
| 26 | +//! |
| 27 | +//! file.write(0, b"hello")?; |
| 28 | +//! file.write(5, b" world")?; |
| 29 | +//! |
| 30 | +//! let text = file.read(0, 11)?; |
| 31 | +//! assert_eq!(&text, b"hello world"); |
| 32 | +//! # Ok(())} |
| 33 | +//! ``` |
| 34 | +
|
6 | 35 | #[macro_use]
|
7 | 36 | extern crate failure;
|
8 | 37 | extern crate mkdirp;
|
|
0 commit comments