Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! Application builder configuring routes and middleware.
//!
//! `WireframeApp` stores registered routes, services, and middleware
//! for a [`WireframeServer`]. Methods return [`Result<Self>`] so callers
//! can chain registrations ergonomically.

use std::{boxed::Box, collections::HashMap, future::Future, pin::Pin};

/// Configures routing and middleware for a `WireframeServer`.
Expand Down
6 changes: 6 additions & 0 deletions src/extractor.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! Request context types and extractor traits.
//!
//! The `MessageRequest` struct carries connection metadata and shared
//! application state. Implement [`FromMessageRequest`] to extract data
//! for handlers.

use std::{net::SocketAddr, sync::Arc};

/// Request context passed to extractors.
Expand Down
6 changes: 6 additions & 0 deletions src/frame.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! Frame encoding and decoding traits.
//!
//! A `FrameProcessor` converts raw bytes into logical frames and back.
//! Implementations may use any framing strategy suitable for the
//! underlying transport.

use async_trait::async_trait;
use bytes::BytesMut;

Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![doc(html_root_url = "https://docs.rs/wireframe/latest")]
//! Public API for the `wireframe` library.
Comment thread
leynos marked this conversation as resolved.
//!
//! This crate provides building blocks for asynchronous binary protocol
//! servers, including routing, middleware, and connection utilities.

pub mod app;
pub mod extractor;
pub mod frame;
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! Minimal binary demonstrating `wireframe` usage.
//!
//! Currently prints a greeting and exits.

fn main() {
println!("Hello from Wireframe!");
}
5 changes: 5 additions & 0 deletions src/message.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! Message trait and serialization helpers.
//!
//! Types implementing [`Message`] can be encoded and decoded using
//! `bincode` with standard configuration.

use bincode::{
BorrowDecode,
Encode,
Expand Down
5 changes: 5 additions & 0 deletions src/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! Traits and helpers for request middleware.
//!
//! Middleware components implement [`Transform`] to wrap services and
//! process `ServiceRequest` instances before passing them along the chain.

use async_trait::async_trait;

/// Incoming request wrapper passed through middleware.
Expand Down
5 changes: 5 additions & 0 deletions src/preamble.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! Connection preamble decoding utilities.
//!
//! The optional preamble is read before processing a connection, and this
//! module provides helpers to decode it using `bincode`.

use bincode::{BorrowDecode, borrow_decode_from_slice, config, error::DecodeError};
use tokio::io::{self, AsyncRead, AsyncReadExt};

Expand Down
5 changes: 5 additions & 0 deletions src/rewind_stream.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//! Async stream adapter that replays leftover bytes.
//!
//! `RewindStream` emits any bytes buffered from a preamble read before
//! delegating reads and writes to the underlying stream.

use std::{
io,
pin::Pin,
Expand Down
6 changes: 6 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! Tokio-based server for `WireframeApp` instances.
//!
//! `WireframeServer` spawns worker tasks to accept TCP connections,
//! optionally decoding a connection preamble before handing the
//! stream to the application.

use std::io;

#[cfg(not(debug_assertions))]
Expand Down
2 changes: 2 additions & 0 deletions tests/preamble.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests for connection preamble reading.

use bincode::error::DecodeError;
use tokio::{
io::{AsyncWriteExt, duplex},
Expand Down
2 changes: 2 additions & 0 deletions tests/server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Tests for [`WireframeServer`] configuration.

use wireframe::{app::WireframeApp, server::WireframeServer};

#[test]
Expand Down
Loading