mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
fs: gen_ascii_chars has been deprecated (#735)
Use sample_iter() instead.
This commit is contained in:
committed by
Toby Lawrence
parent
e700607554
commit
d246964bdf
@@ -12,7 +12,7 @@ use tokio_threadpool::*;
|
|||||||
use futures::Future;
|
use futures::Future;
|
||||||
use futures::future::poll_fn;
|
use futures::future::poll_fn;
|
||||||
use futures::sync::oneshot;
|
use futures::sync::oneshot;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng, distributions};
|
||||||
use tempfile::Builder as TmpBuilder;
|
use tempfile::Builder as TmpBuilder;
|
||||||
|
|
||||||
use std::fs::File as StdFile;
|
use std::fs::File as StdFile;
|
||||||
@@ -25,7 +25,8 @@ fn read_write() {
|
|||||||
let dir = TmpBuilder::new().prefix("tokio-fs-tests").tempdir().unwrap();
|
let dir = TmpBuilder::new().prefix("tokio-fs-tests").tempdir().unwrap();
|
||||||
let file_path = dir.path().join("read_write.txt");
|
let file_path = dir.path().join("read_write.txt");
|
||||||
|
|
||||||
let contents: Vec<u8> = thread_rng().gen_ascii_chars()
|
let contents: Vec<u8> = thread_rng()
|
||||||
|
.sample_iter(&distributions::Alphanumeric)
|
||||||
.take(NUM_CHARS)
|
.take(NUM_CHARS)
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
.into();
|
.into();
|
||||||
|
|||||||
Reference in New Issue
Block a user