Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
373a5265a0 | ||
|
|
060e43590d | ||
|
|
f51ba984ca | ||
|
|
66ebc8a030 | ||
|
|
d39e98695d |
@@ -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
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](./LICENSE-MIT)
|
||||

|
||||

|
||||

|
||||
|
||||
Rust binary providing an improved version of `adb` CLI.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[](./LICENSE-MIT)
|
||||
[](https://docs.rs/adb_client)
|
||||
[](https://crates.io/crates/adb_client)
|
||||

|
||||

|
||||
|
||||
Rust library implementing ADB protocol.
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ impl TryFrom<&[u8]> for DeviceLong {
|
||||
.ok_or(RustADBError::RegexParsingError)?
|
||||
.as_bytes(),
|
||||
)?,
|
||||
16,
|
||||
10,
|
||||
)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user