Skip to main content

Serving

Trait Serving 

Source
pub trait Serving: Rig {
    // Provided methods
    async fn serve(
        &self,
        at: &Path,
        held: OwnedFd,
    ) -> Result<Served<Kept<Self>>, Failure>
       where Self: Sized { ... }
    async fn serve_coprocess(
        &self,
        at: &Path,
    ) -> Result<Served<Kept<Self>>, Failure>
       where Self: Sized { ... }
}
Expand description

A rig a running bash may attach to.

who chose the workspacethe client: at is required, exists, and is the address
what the client is handednothing — liveness is the workspace’s to show: the join fifo is present exactly while the session serves
what ends itthe handle the initiator holds, watched and never closed here
what comes backServed

at is the workspace the client prescribed and made — left behind: a reading taken later may follow source paths into it. held is a descriptor the initiator holds open for as long as it wants the session: serving ends when the last holder has let go.

A serving application is a complete standalone program: it owes nobody a byte on any channel. A client that wants to know the session is up asks the workspace — the join fifo is present exactly while a session serves — sources the laid definitions and initiates its own channel, feeding every step the same coordinate it gave the server. What the session reaches is the client’s decision: joining instruments that shell, its functions, its subshells and what it sources; a client that wants its child processes reached writes its own startup file and exports BASH_ENV to it.

A Failure while serving still sees the session out: every shell released or finished, the workspace’s fifos gone.

Provided Methods§

Source

async fn serve( &self, at: &Path, held: OwnedFd, ) -> Result<Served<Kept<Self>>, Failure>
where Self: Sized,

Source

async fn serve_coprocess( &self, at: &Path, ) -> Result<Served<Kept<Self>>, Failure>
where Self: Sized,

Serve the client that started this process as a coprocess: it holds this process’s standard input — the write end coproc left it — and lets go by closing it. The book’s docs/joining.md shows the client’s half, whole.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§