mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
impl tokio's AsyncRead/Write/Seek for AFC FileDescriptor (#33)
* AsyncWrite/Read/Seek * clean up * use only one field to store the future This struct should not be shared across threads because simultaneous operations like reading, writing, or seeking could lead to data races or inconsistent state, because the cursor moves. Only one operation will ever run at a time, which allows us to safely store different types of pending operations (read, write, or seek) in the same field. * consume self without mut when closing * clippy * Add inner_file safety tests * more tests --------- Co-authored-by: Jackson Coxson <jkcoxson@gmail.com>
This commit is contained in:
committed by
GitHub
parent
105a9b2837
commit
b26dd17b13
@@ -154,7 +154,7 @@ async fn main() {
|
||||
.await
|
||||
.expect("Failed to open");
|
||||
|
||||
let res = file.read().await.expect("Failed to read");
|
||||
let res = file.read_entire().await.expect("Failed to read");
|
||||
tokio::fs::write(save, res)
|
||||
.await
|
||||
.expect("Failed to write to file");
|
||||
@@ -168,7 +168,9 @@ async fn main() {
|
||||
.await
|
||||
.expect("Failed to open");
|
||||
|
||||
file.write(&bytes).await.expect("Failed to upload bytes");
|
||||
file.write_entire(&bytes)
|
||||
.await
|
||||
.expect("Failed to upload bytes");
|
||||
} else if let Some(matches) = matches.subcommand_matches("remove") {
|
||||
let path = matches.get_one::<String>("path").expect("No path passed");
|
||||
afc_client.remove(path).await.expect("Failed to remove");
|
||||
|
||||
Reference in New Issue
Block a user