luthien-plugin 0.1.0

Library for writing Luthien plugins in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! # Luthien Plugin IO
//!
//! This module provides functions for reading and writing from Luthien's stdio.

use crate::Input;
use ipipe::{OnCleanup, Pipe};

pub use ipipe;

impl Input {
    /// Get an [`ipipe::Pipe`] which can be used to read input and print output to the parent
    /// Luthien process.
    pub fn io(&self) -> Option<ipipe::Result<Pipe>> {
        self.pipe_path
            .as_ref()
            .map(|path| Pipe::open(path, OnCleanup::NoDelete))
    }
}