Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All IO objects will be closed in a blocking fashion if they have not been closed asynchronously (closes #46). Also, they will panic if the user attempts to perform IO after they have been closed. UnixStream is made a thin wrapper around TcpStream instead of duplicating a lot of code.
- Loading branch information
1 parent
d16e4dd
commit 6660fa1
Showing
6 changed files
with
86 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use futures::{AsyncReadExt, AsyncWriteExt}; | ||
|
||
use ringbahn::File; | ||
|
||
const ASSERT: &[u8] = b"But this formidable power of death -"; | ||
|
||
#[test] | ||
fn read_and_close_file() { | ||
futures::executor::block_on(async move { | ||
let mut file = File::open("props.txt").await.unwrap(); | ||
let mut buf = vec![0; 4096]; | ||
assert!(file.read(&mut buf).await.is_ok()); | ||
assert_eq!(&buf[0..ASSERT.len()], ASSERT); | ||
file.close().await.unwrap(); | ||
}); | ||
} |