//! Tauri implementation of the shared outbound stream sink contract. //! //! The backend core owns the transport-agnostic [`backend::stream::OutputSink`] //! abstraction. This adapter is the only layer that turns it into a concrete //! [`tauri::ipc::Channel`] send. use backend::stream::{OutputSink, OutputSinkError}; use serde::Serialize; use tauri::ipc::Channel; /// [`OutputSink`] backed by a per-attach Tauri IPC [`Channel`]. pub struct TauriChannelSink { channel: Channel, } impl TauriChannelSink { /// Wraps a Tauri IPC channel as a shared backend stream sink. #[must_use] pub fn new(channel: Channel) -> Self { Self { channel } } } impl OutputSink for TauriChannelSink where T: Serialize + Send + Sync + 'static, { fn send(&self, item: T) -> Result<(), OutputSinkError> { self.channel.send(item).map_err(|_| OutputSinkError::Closed) } }