pub struct AdbConnection { /* private fields */ }Expand description
A single TCP connection to the ADB server.
Implementations§
Source§impl AdbConnection
impl AdbConnection
Sourcepub async fn connect(host: &str, port: u16) -> Result<Self>
pub async fn connect(host: &str, port: u16) -> Result<Self>
Connect to the ADB server at the given address.
Sourcepub async fn send_command(&mut self, cmd: &str) -> Result<()>
pub async fn send_command(&mut self, cmd: &str) -> Result<()>
Send a command to the ADB server using the wire protocol.
Format: {length:04X}{command}
Sourcepub async fn read_status(&mut self) -> Result<()>
pub async fn read_status(&mut self) -> Result<()>
Read the OKAY/FAIL status response.
Sourcepub async fn send_and_okay(&mut self, cmd: &str) -> Result<()>
pub async fn send_and_okay(&mut self, cmd: &str) -> Result<()>
Send a command and expect OKAY.
Sourcepub async fn read_length_prefixed_string(&mut self) -> Result<String>
pub async fn read_length_prefixed_string(&mut self) -> Result<String>
Read a length-prefixed string response.
Format: [4-char hex length][data]
Sourcepub async fn read_until_close_string(&mut self) -> Result<String>
pub async fn read_until_close_string(&mut self) -> Result<String>
Read all remaining data as a String until the connection closes.
Sourcepub async fn read_until_close_bytes(&mut self) -> Result<Vec<u8>>
pub async fn read_until_close_bytes(&mut self) -> Result<Vec<u8>>
Read all remaining data as bytes until the connection closes.
Sourcepub fn into_stream(self) -> TcpStream
pub fn into_stream(self) -> TcpStream
Expose the inner stream for advanced operations (e.g., sync protocol).
Sourcepub fn stream_mut(&mut self) -> &mut TcpStream
pub fn stream_mut(&mut self) -> &mut TcpStream
Get a mutable reference to the inner stream.
Auto Trait Implementations§
impl !Freeze for AdbConnection
impl RefUnwindSafe for AdbConnection
impl Send for AdbConnection
impl Sync for AdbConnection
impl Unpin for AdbConnection
impl UnsafeUnpin for AdbConnection
impl UnwindSafe for AdbConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more