pxp Library Overview
Introduction to pxp, the consumer-agnostic Rust implementation of the Portal Transfer Protocol.
pxp Library
The pxp library is a headless, consumer-agnostic Rust implementation of the Portal Transfer Protocol (PXP). It is decoupled from any specific user interface, making it suitable for command-line tools, desktop applications (such as Tauri or Electron wrappers), mobile applications, and background daemons.
Key Design Principles
- No Side Effects
The library never writes to stdout/stderr or reads from stdin. All logger outputs use the standard
tracingfacade. - Standard Traits for UI Decoupling All user-facing behaviors — such as displaying progress bars, printing transfer status messages, and resolving filename conflicts — are abstracted into traits that the caller implements.
- Pure Async/Await
Built on top of
tokiofor non-blocking network I/O, UDP broadcasting, and filesystem streaming. - Strongly-Typed Errors
Contains a comprehensive, typed error taxonomy (
PxpError) built usingthiserror(noanyhowdependencies).
Crate Structure
The crate is organized into several modules representing protocol stages:
discovery— Broadcasts and listens for UDP beacons.sender— Discovers receivers, establishes TCP handshakes, creates metadata manifests, and streams TAR archives.receiver— Binds listeners, receives handshake proofs, decodes manifests, stages streams to disk, and reconciles conflicts into the target directory.metadata— Shared models representing files, directories, manifests, and transfer items.error— Crate-wide error enum (PxpError) andResulttype alias.