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