Skip to main content

Crate udp

Crate udp 

Source
Expand description

udp

A lightweight and efficient Rust library for building UDP servers with request-response handling.

Re-exports§

pub use tokio;

Structs§

ArcRwLockUdpSocket
Thread-safe wrapper for UDP socket with read-write lock.
Context
The main application context, providing thread-safe access to request and response data.
ContextData
Represents the internal state of the application context.
DefaultServerHook
Default server hook.
PanicData
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.
ServerConfig
Represents the thread-safe, shareable server configuration.
ServerConfigData
Represents the inner, mutable server configuration.
ServerControlHook
Represents the hooks for managing the server’s lifecycle, specifically for waiting and shutting down.

Enums§

RequestError
Represents errors related to request operations.
ResponseError
Represents errors related to response operations.
ServerError
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_NODELAY setting.
DEFAULT_PORT
Default UDP port.
DEFAULT_TTL
Default IP_TTL setting.

Traits§

AnySendSyncClone
Type alias for types that implement Any + Send + Sync + Clone.
FnContextPinBoxSendSync
A trait for functions that return a pinned, boxed, sendable future.
FnContextSendSync
A generic trait for functions that take a Context and return a value.
FnContextSendSyncStatic
A trait for static, sendable, synchronous functions that return a future.
FnPinBoxFutureSend
A trait for thread-safe, reference-counted closures that produce a sendable async task.
FutureSend
A trait for Send-able futures with a generic output.
FutureSendStatic
A trait for futures that are sendable and have a static lifetime.
ServerHook
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 ServerHookHandler from a trait object.

Type Aliases§

ArcRwLock
Thread-safe reference-counted read-write lock wrapper.
AsyncTask
A type alias for an asynchronous task.
HookHandler
A type alias for a shared hook handler.
HookHandlerChain
A type alias for a hook handler chain.
OptionArcRwLockUdpSocket
Optional thread-safe read-write locked UDP socket.
OptionSocketAddr
Optional socket address (IP + port).
OptionSocketHost
Optional socket host IP address.
OptionSocketPort
Optional socket port number.
Request
Type alias for request data (byte vector).
ResponseData
Type alias for response data (byte vector).
ResponseResult
Result type for response operations.
SendableAsyncTask
A type alias for a sendable asynchronous task with a generic output.
ServerHookHandler
Type alias for a shared server hook handler.
ServerHookHandlerFactory
A type alias for a hook handler factory function.
ServerHookList
Type alias for a list of server hooks.
SharedAsyncTaskFactory
A type alias for a shared asynchronous task factory.
ThreadSafeAttributeStore
Type alias for thread-safe attribute storage.