5 Commits

Author SHA1 Message Date
Corentin LIAUD
373a5265a0 chore: v2.1.17 2025-09-21 11:42:58 +02:00
yohane
060e43590d Fix:Regex expression parsing transport incorrectly 2025-09-21 11:37:37 +02:00
Corentin LIAUD
f51ba984ca impr: further improve LogFilter by removing split_inclusive 2025-09-21 11:29:05 +02:00
0vercl0k
66ebc8a030 Reword logic in LogFilter::write to avoid cloning the internal buffer 2025-09-21 11:29:05 +02:00
LIAUD Corentin
d39e98695d fix: wrong msrv badges url 2025-08-03 17:38:11 +02:00
6 changed files with 21 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ homepage = "https://github.com/cocool97/adb_client"
keywords = ["adb", "android", "tcp", "usb"]
license = "MIT"
repository = "https://github.com/cocool97/adb_client"
version = "2.1.16"
version = "2.1.17"
rust-version = "1.85.1"
# To build locally when working on a new release

View File

@@ -9,7 +9,7 @@
<img alt="crates.io" src="https://img.shields.io/crates/v/adb_client.svg"/>
</a>
<a href="https://crates.io/crates/adb_client">
<img alt="msrv" src="https://img.shields.io/crates/msrv/adb_client/latest"/>
<img alt="msrv" src="https://img.shields.io/crates/msrv/adb_client"/>
</a>
<a href="https://github.com/cocool97/adb_client/actions">
<img alt="ci status" src="https://github.com/cocool97/adb_client/actions/workflows/rust-build.yml/badge.svg"/>

View File

@@ -2,7 +2,7 @@
[![MIT licensed](https://img.shields.io/crates/l/adb_cli.svg)](./LICENSE-MIT)
![Crates.io Total Downloads](https://img.shields.io/crates/d/adb_cli)
![MSRV](https://img.shields.io/crates/msrv/adb_cli/latest)
![MSRV](https://img.shields.io/crates/msrv/adb_cli)
Rust binary providing an improved version of `adb` CLI.

View File

@@ -3,7 +3,7 @@
[![MIT licensed](https://img.shields.io/crates/l/adb_client.svg)](./LICENSE-MIT)
[![Documentation](https://docs.rs/adb_client/badge.svg)](https://docs.rs/adb_client)
[![Crates.io Total Downloads](https://img.shields.io/crates/d/adb_client)](https://crates.io/crates/adb_client)
![MSRV](https://img.shields.io/crates/msrv/adb_client/latest)
![MSRV](https://img.shields.io/crates/msrv/adb_client)
Rust library implementing ADB protocol.

View File

@@ -93,7 +93,7 @@ impl TryFrom<&[u8]> for DeviceLong {
.ok_or(RustADBError::RegexParsingError)?
.as_bytes(),
)?,
16,
10,
)?,
})
}

View File

@@ -23,21 +23,26 @@ impl<W: Write> LogFilter<W> {
impl<W: Write> Write for LogFilter<W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
// Add newly received bytes to the internal buffer
self.buffer.extend_from_slice(buf);
let buf_clone = self.buffer.clone();
let mut lines = buf_clone.split_inclusive(|&byte| byte == b'\n').peekable();
let mut processed = 0;
while let Some(pos) = self.buffer[processed..].iter().position(|&b| b == b'\n') {
// Found a newline, need to process it
let end = processed + pos + 1; // +1 to include the '\n'
let line = &self.buffer[processed..end];
while let Some(line) = lines.next() {
if lines.peek().is_some() {
if self.should_write(line) {
self.writer.write_all(line)?;
}
} else {
// This is the last (unfinished) element, we keep it for next round
self.buffer = line.to_vec();
break;
if self.should_write(line) {
self.writer.write_all(line)?;
}
processed = end;
}
// Keep only remaining bytes after the last complete line
if processed > 0 {
self.buffer.copy_within(processed.., 0);
self.buffer.truncate(self.buffer.len() - processed);
}
Ok(buf.len())