Crate app_io

source ·
Expand description

A simple library that handles stdio queues for applications invoked by a shell.

The shell is responsible for setting the correct stdio queues prior to spawning the application, and destroying them after the application has completed.

Applications can access their queues using stdin, stdout, and stderr. This crate also has support for line disciplines, which can be accessed using line_discipline.

Macros

  • The main printing macro, which simply writes to the current task’s stdout stream.
  • Calls print!() with an extra newline (‘\n’) appended to the end.

Structs

  • Stores the stdio queues and line discipline. The stored queues are for use by applications e.g. stdin is a reader. The other end of the queue is held by the shell.

Traits

Functions

  • Shells call this function to store queue stdio streams for applications. If there are any existing readers/writers for the task (which should not happen in normal practice), it returns the old one, otherwise returns None.
  • Returns the application’s line discipline.
  • Converts the given core::fmt::Arguments to a String and enqueues the string into the correct terminal print-producer
  • Shells call this function to remove queues and pointer to terminal for applications. It returns the removed streams in the return value if the key matches, otherwise returns None.
  • Applications call this function to acquire a writer to its stderr queue.
  • Applications call this function to acquire a reader to its stdin queue.
  • Applications call this function to acquire a writer to its stdout queue.