Expand description
tcplane
tcplane is a lightweight and high-performance Rust TCP server library designed to simplify network service development. It supports TCP communication, data stream management, and connection handling, focusing on providing efficient low-level network connections and data transmission capabilities, making it ideal for building modern network services.
Re-exports§
pub use crate::ServerHookHandler as MiddlewareHandler;pub use crate::ServerHookList as MiddlewareList;pub use tokio;
Structs§
- ArcRw
Lock Stream - A thread-safe wrapper around
TcpStreamusingArc<RwLock<TcpStream>>. - Context
- The main connection context, providing thread-safe access to connection data.
- Default
Hook - A default no-op hook implementation.
- Response
- Represents an HTTP-like response structure.
- Server
- The primary server structure that provides a thread-safe interface to the server’s state.
- Server
Config - Represents the thread-safe, shareable server configuration.
- Server
Control Hook - Represents the hooks for managing the server’s lifecycle, specifically for waiting and shutting down.
Enums§
- Response
Error - Represents errors related to response operations.
- Server
Error - Represents errors that can occur at the server level.
Constants§
- COLON
- Colon symbol used in address formatting.
- COLON_
SPACE - Colon with space for display formatting.
- DEFAULT_
BUFFER_ SIZE - Default buffer size for network operations (4KB).
- DEFAULT_
HOST - Default host address for the server.
- DEFAULT_
PORT - Default listening port for the server.
- DEFAULT_
SOCKET_ ADDR - Default socket address.
- SPLIT_
REQUEST_ BYTES - Request separator bytes for detecting end of request.
Traits§
- Async
Func Without Pin - Trait for async function handlers.
- Server
Hook - Trait for server lifecycle hooks that process connections.
Functions§
- get_
thread_ count - Gets the number of available threads for parallel processing.
- handler_
fn - Creates a handler function from an async function.
- remove_
trailing_ zeros - Removes trailing zero bytes from a byte vector.
- server_
hook_ factory - Implementation of server hook handler factory functions.
Creates a server hook handler factory from a type implementing
ServerHook.
Type Aliases§
- ArcError
Handle - A type alias for arc-wrapped error handling function.
- ArcRw
Lock - A type alias for
Arc<RwLock<T>>. - ArcRw
Lock Read Guard - A type alias for read guard of
ArcRwLock<T>. - ArcRw
Lock Stream Read Guard - A type alias for a read guard of
ArcRwLock<TcpStream>. - ArcRw
Lock Stream Write Guard - A type alias for a write guard of
ArcRwLock<TcpStream>. - ArcRw
Lock Write Guard - A type alias for write guard of
ArcRwLock<T>. - Error
Handle Fn - A type alias for error handling function.
- Handler
Func - A type alias for a handler function.
- Handler
List - A type alias for a list of handler functions.
- Handler
List Arc - A type alias for an arc-wrapped list of handlers.
- Handler
List ArcLock - A type alias for a RwLock-wrapped arc of handler list.
- Hash
MapArc AnySend Sync - A type alias for a hash map with
Arc<dyn Any + Send + Sync>values. - Option
ArcRw Lock Stream - A type alias for an optional
ArcRwLockStream. - Option
Socket Addr - A type alias for an optional socket address.
- Option
Socket Host - A type alias for an optional socket host (IP address).
- Option
Socket Port - A type alias for an optional socket port.
- Request
- A type alias for request data (byte vector).
- Response
Data - A type alias for response data (byte vector).
- Response
Result - A type alias for response result.
- Server
Hook Handler - A type alias for server hook handler function.
- Server
Hook List - A type alias for a list of server hook handlers.