//! Socket-only session for local development. //! //! [`DevSession`] is a parallel entry point to [`super::session::Session`] that //! starts the same TCP server (same protocol, same `Handler`) but skips //! PlugInKit / `Info.plist` discovery and the `mount(8)` orchestration done by //! [`super::mounter::Mounter`]. This lets a `Filesystem` impl be exercised over //! the wire (e.g. with a separate FSKitBridge / test client) without requiring //! a registered FSKit appex on the host. //! //! Added in subtext's vendored copy; not part of upstream `fskit-rs 0.2.0`. use super::Filesystem; use super::handler::Handler; use super::socket::{self, Socket}; pub type Result = std::result::Result; #[derive(Debug)] pub struct DevSession { socket: Socket, } impl DevSession { pub async fn new(fs: FS, server_port: u16) -> Result where FS: Filesystem + Send + Sync + Clone + 'static, { let handler = Handler::new(fs); let socket = Socket::start(handler, server_port).await?; Ok(Self { socket }) } } impl Drop for DevSession { fn drop(&mut self) { futures::executor::block_on(async { self.socket.stop().await; }); } } #[derive(thiserror::Error, Debug)] pub enum Error { #[error(transparent)] Socket(#[from] socket::Error), }