Crate ipipe[][src]

Cross-platform named-pipe API.

Quick Start

To get started quickly, try using Pipe::with_name to create a pipe with a given name.

use ipipe::Pipe; 
use std::io::BufRead;
fn reader()
{
    let mut pipe = Pipe::with_name("test_pipe").unwrap();
    println!("Pipe path: {}", pipe.path().display());

    // Read lines
    for line in std::io::BufReader::new(pipe).lines()
    {
        println!("{}", line.unwrap());
    }
}

Then in another program or thread:

use ipipe::Pipe; 
use std::io::Write;
fn writer()
{
    let mut pipe = Pipe::with_name("test_pipe").unwrap();
    writeln!(&mut pipe, "This is only a test.").unwrap();
}

You can also use Pipe::create to open a pipe with a randomly-generated name, which can then be accessed by calling Pipe::path.

Lastly, Pipe::open can be used to specify an exact path. This is not platform agnostic, however, as Windows pipe paths require a special format.

Calling clone() on a pipe will create a slave instance. Slave instances will not delete or close the pipe when they go out of scope. This allows readers and writers to the same pipe to be passed to different threads and contexts.

Macros

pprint

Print a string to a static pipe

pprintln

Print a string and a trailing newline to a static pipe

Structs

Pipe

Abstraction over a named pipe

Enums

Error

Standard error type used by this library

OnCleanup

Functions

close

Closes a static pipe

close_all

Closes all static pipes

get

Get a handle to an existing static pipe

init

Initialize a static pipe and return a handle to it.

print

The lowest-level static-pipe print function. Panics if pipe is not initialized.

Type Definitions

Result