pub struct IpcClient { /* private fields */ }Expand description
IPC client for communicating with the headless sidecar service.
Connects to the sidecar’s Unix domain socket and translates method calls
into IpcRequest messages. Responses are decoded from IpcResponse
frames.
Events from the sidecar (started/stopped/error) are read as IpcEvent
frames and converted to PluginEvent for emission via the Tauri event
system.
Implementations§
Source§impl IpcClient
impl IpcClient
Sourcepub async fn connect(path: PathBuf) -> Result<Self, ServiceError>
pub async fn connect(path: PathBuf) -> Result<Self, ServiceError>
Connect to the sidecar’s IPC socket at the given path.
Sourcepub async fn start(&mut self, config: StartConfig) -> Result<(), ServiceError>
pub async fn start(&mut self, config: StartConfig) -> Result<(), ServiceError>
Send a Start command to the sidecar.
Sourcepub async fn stop(&mut self) -> Result<(), ServiceError>
pub async fn stop(&mut self) -> Result<(), ServiceError>
Send a Stop command to the sidecar.
Sourcepub async fn is_running(&mut self) -> Result<bool, ServiceError>
pub async fn is_running(&mut self) -> Result<bool, ServiceError>
Send an IsRunning query to the sidecar.
Sourcepub async fn get_state(&mut self) -> Result<ServiceStatus, ServiceError>
pub async fn get_state(&mut self) -> Result<ServiceStatus, ServiceError>
Query the current service lifecycle state.
Sourcepub async fn read_event(&mut self) -> Result<Option<IpcEvent>, ServiceError>
pub async fn read_event(&mut self) -> Result<Option<IpcEvent>, ServiceError>
Read the next IpcEvent from the socket.
Returns None if the connection was closed.
Sourcepub fn listen_events<R: Runtime>(self, app: AppHandle<R>)
pub fn listen_events<R: Runtime>(self, app: AppHandle<R>)
Spawn a background task that reads IpcEvent frames and emits
PluginEvent via the given AppHandle.
The task runs until the socket is closed or an error occurs.
Auto Trait Implementations§
impl !Freeze for IpcClient
impl RefUnwindSafe for IpcClient
impl Send for IpcClient
impl Sync for IpcClient
impl Unpin for IpcClient
impl UnsafeUnpin for IpcClient
impl UnwindSafe for IpcClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more