luthien_plugin/io.rs
1//! # Luthien Plugin IO
2//!
3//! This module provides functions for reading and writing from Luthien's stdio.
4
5use crate::Input;
6use ipipe::{OnCleanup, Pipe};
7
8pub use ipipe;
9
10impl Input {
11 /// Get an [`ipipe::Pipe`] which can be used to read input and print output to the parent
12 /// Luthien process.
13 pub fn io(&self) -> Option<ipipe::Result<Pipe>> {
14 self.pipe_path
15 .as_ref()
16 .map(|path| Pipe::open(path, OnCleanup::NoDelete))
17 }
18}