Expand description
udp
A lightweight and efficient Rust library for building UDP servers with request-response handling.
Re-exports§
pub use tokio;
Structs§
- ArcRw
Lock UdpSocket - Thread-safe wrapper for UDP socket with read-write lock.
- Context
- The main application context, providing thread-safe access to request and response data.
- Context
Data - Represents the internal state of the application context.
- Default
Server Hook - Default server hook.
- Panic
Data - Represents data captured from a panic.
- Response
- UDP response wrapper containing response data.
- 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
Config Data - Represents the inner, mutable server configuration.
- Server
Control Hook - Represents the hooks for managing the server’s lifecycle, specifically for waiting and shutting down.
Enums§
- Request
Error - Represents errors related to request operations.
- Response
Error - Represents errors related to response operations.
- Server
Error - Represents errors that can occur at the server level.
Constants§
- DEFAULT_
BUFFER_ SIZE - Default buffer size for UDP packets (512KB).
- DEFAULT_
HOST - Default host address.
- DEFAULT_
NODELAY - Default
TCP_NODELAYsetting. - DEFAULT_
PORT - Default UDP port.
- DEFAULT_
TTL - Default
IP_TTLsetting.
Traits§
- AnySend
Sync Clone - Type alias for types that implement Any + Send + Sync + Clone.
- FnContext
PinBox Send Sync - A trait for functions that return a pinned, boxed, sendable future.
- FnContext
Send Sync - A generic trait for functions that take a
Contextand return a value. - FnContext
Send Sync Static - A trait for static, sendable, synchronous functions that return a future.
- FnPin
BoxFuture Send - A trait for thread-safe, reference-counted closures that produce a sendable async task.
- Future
Send - A trait for
Send-able futures with a generic output. - Future
Send Static - A trait for futures that are sendable and have a static lifetime.
- Server
Hook - Trait for server lifecycle hooks that process requests.
Functions§
- arc_
rwlock - Helper function to wrap data in an
Arc<RwLock<T>>. - remove_
trailing_ zeros - Removes trailing zeros from a byte vector.
- server_
hook_ factory - Creates a new
ServerHookHandlerfrom a trait object.
Type Aliases§
- ArcRw
Lock - Thread-safe reference-counted read-write lock wrapper.
- Async
Task - A type alias for an asynchronous task.
- Hook
Handler - A type alias for a shared hook handler.
- Hook
Handler Chain - A type alias for a hook handler chain.
- Option
ArcRw Lock UdpSocket - Optional thread-safe read-write locked UDP socket.
- Option
Socket Addr - Optional socket address (IP + port).
- Option
Socket Host - Optional socket host IP address.
- Option
Socket Port - Optional socket port number.
- Request
- Type alias for request data (byte vector).
- Response
Data - Type alias for response data (byte vector).
- Response
Result - Result type for response operations.
- Sendable
Async Task - A type alias for a sendable asynchronous task with a generic output.
- Server
Hook Handler - Type alias for a shared server hook handler.
- Server
Hook Handler Factory - A type alias for a hook handler factory function.
- Server
Hook List - Type alias for a list of server hooks.
- Shared
Async Task Factory - A type alias for a shared asynchronous task factory.
- Thread
Safe Attribute Store - Type alias for thread-safe attribute storage.