idevice/services/
syslog_relay.rs1use crate::{Idevice, IdeviceError, IdeviceService, obf};
4
5#[derive(Debug)]
7pub struct SyslogRelayClient {
8 pub idevice: Idevice,
10}
11
12impl IdeviceService for SyslogRelayClient {
13 fn service_name() -> std::borrow::Cow<'static, str> {
15 obf!("com.apple.syslog_relay")
16 }
17
18 async fn from_stream(idevice: Idevice) -> Result<Self, crate::IdeviceError> {
19 Ok(Self::new(idevice))
20 }
21}
22
23impl SyslogRelayClient {
24 pub fn new(idevice: Idevice) -> Self {
29 Self { idevice }
30 }
31
32 pub async fn next(&mut self) -> Result<String, IdeviceError> {
40 let res = self.idevice.read_until_delim(b"\n\x00").await?;
41 match res {
42 Some(res) => Ok(String::from_utf8_lossy(&res).to_string()),
43 None => Err(IdeviceError::UnexpectedResponse),
44 }
45 }
46}