pub struct AfcClient<S> { /* private fields */ }Expand description
AFC file-system client.
S must be a full-duplex async stream (e.g. the raw usbmux stream from lockdown).
Implementations§
Source§impl<S: AsyncRead + AsyncWrite + Unpin> AfcClient<S>
impl<S: AsyncRead + AsyncWrite + Unpin> AfcClient<S>
pub const FILE_MODE_READ_ONLY: u64 = 0x00000001
pub const FILE_MODE_READ_WRITE: u64 = 0x00000002
pub const FILE_MODE_WRITE_ONLY_CREATE_TRUNC: u64 = 0x00000003
pub const LOCK_EXCLUSIVE: u64
pub const LOCK_UNLOCK: u64
pub fn new(stream: S) -> Self
Sourcepub async fn list_dir(&mut self, path: &str) -> Result<Vec<String>, AfcError>
pub async fn list_dir(&mut self, path: &str) -> Result<Vec<String>, AfcError>
List directory entries (excludes “.” and “..”).
The AFC device returns null-separated filenames in the payload section of the response frame (entire_len > this_len).
Sourcepub async fn stat(
&mut self,
path: &str,
) -> Result<HashMap<String, String>, AfcError>
pub async fn stat( &mut self, path: &str, ) -> Result<HashMap<String, String>, AfcError>
Get key-value file info for a path.
Sourcepub async fn stat_info(&mut self, path: &str) -> Result<AfcFileInfo, AfcError>
pub async fn stat_info(&mut self, path: &str) -> Result<AfcFileInfo, AfcError>
Get parsed file info for a path.
AFC reports st_mode as an octal string. This helper parses it into a
u32, matching go-ios behavior.
Sourcepub async fn remove(&mut self, path: &str) -> Result<(), AfcError>
pub async fn remove(&mut self, path: &str) -> Result<(), AfcError>
Remove a path (file or empty directory).
Sourcepub async fn remove_all(&mut self, path: &str) -> Result<(), AfcError>
pub async fn remove_all(&mut self, path: &str) -> Result<(), AfcError>
Remove a path and all contents recursively.
Sourcepub async fn rename(&mut self, from: &str, to: &str) -> Result<(), AfcError>
pub async fn rename(&mut self, from: &str, to: &str) -> Result<(), AfcError>
Rename / move a path.
Sourcepub async fn read_file(&mut self, path: &str) -> Result<Bytes, AfcError>
pub async fn read_file(&mut self, path: &str) -> Result<Bytes, AfcError>
Read an entire file into memory.
Sourcepub async fn read_file_follow_links(
&mut self,
path: &str,
) -> Result<Bytes, AfcError>
pub async fn read_file_follow_links( &mut self, path: &str, ) -> Result<Bytes, AfcError>
Read an entire file into memory, following a single AFC symlink.
This matches go-ios PullSingleFile behavior: if the source path is a
symlink, AFC reports the target in st_linktarget and the file is read
from that target path instead.
Sourcepub async fn write_file(
&mut self,
path: &str,
data: &[u8],
) -> Result<(), AfcError>
pub async fn write_file( &mut self, path: &str, data: &[u8], ) -> Result<(), AfcError>
Write data to a file (creates or truncates).
Sourcepub async fn write_file_from_reader<R>(
&mut self,
path: &str,
reader: &mut R,
) -> Result<(), AfcError>
pub async fn write_file_from_reader<R>( &mut self, path: &str, reader: &mut R, ) -> Result<(), AfcError>
Write data from an async reader to a file (creates or truncates).