Crate hyperlane_utils

Source

Re-exports§

pub use ahash;
pub use futures;
pub use log;
pub use num_cpus;
pub use once_cell;
pub use serde;
pub use serde_json;
pub use serde_urlencoded;
pub use serde_xml_rs;
pub use simd_json;
pub use twox_hash;
pub use urlencoding;
pub use utoipa;
pub use utoipa_rapidoc;
pub use utoipa_swagger_ui;

Modules§

async
sync

Macros§

arc
Arc macro
b_tree_map
A macro to create a new BTreeMap, providing two usage options:
b_tree_set
Creates a new BTreeSet<T>.
binary_heap
Creates a new BinaryHeap<T>.
boxed
Creates a new Box instance.
cell
Creates a new Cell instance.
cin
Read a line from standard input as a String.
cin_parse
Parse input string into a value or a vector of values of a specified type.
clone
A helper macro to clone variables into closures or async blocks easily.
cout
Print formatted output to standard output using print!.
cout_endl
Print formatted output with a newline and flush the standard output buffer.
endl
Print a newline character and flush the standard output buffer.
execute
Execute a synchronous function with given arguments.
execute_async
Execute an asynchronous function and return a future.
future_fn
Generates an asynchronous closure that clones specified external variables and executes the given closure body asynchronously.
hash_map
Creates a new HashMap instance.
hash_set
Creates a new HashSet instance.
join_paths
Combines multiple paths into a single valid path, handling overlapping slashes.
linked_list
Creates a new LinkedList instance.
mutex
Creates a new Mutex instance.
output_macro
Output macro
print_message_common_handler
println_error
println_success
println_warning
rc
Creates a new Rc (Reference Counted) instance.
refcell
Creates a new RefCell instance.
rw_lock
Creates a new RwLock instance.
string
Creates a new String instance.
vector
Creates a new Vec instance.
vector_deque
Creates a new VecDeque instance.

Structs§

Broadcast
BroadcastMap
Charset
Represents a struct for handling both encode and decode of strings using a custom character set (charset). This struct provides methods to encode and decode strings based on the provided charset.
ChunkStrategy
CompareVersion
Decode
Encode
FileDataString
JoinHandle
An owned permission to join on a thread (block on its termination).
Log
Output
Output struct
OutputBuilder
OutputBuilder struct
OutputList
OutputList struct
OutputListBuilder
OutputListBuilder struct
ServerManager
Title: ServerManager structure for managing the server process
ServerManagerConfig
Title: ServerManagerConfig structure for configuration parameters
ThreadPool
WebSocket
WebSocketConfig
Worker

Enums§

BroadcastType
ChunkStrategyError
Color
Color
ColorType
ColorType
DecodeError
EncodeError
HotRestartError
VersionComparison
Define an enumeration for version comparison
VersionError
Define an enumeration for version errors

Constants§

CHUNKIFY_CHUNK_INDEX_HEADER
CHUNKIFY_FILE_ID_HEADER
CHUNKIFY_FILE_NAME_HEADER
CHUNKIFY_TOTAL_CHUNKS_HEADER
COMMON_YEAR
Common Year
DAYS
Days
DEBUG_DIR
DEFAULT_BROADCAST_SENDER_CAPACITY
DEFAULT_LOG_DIR
DEFAULT_LOG_FILE_SIZE
DEFAULT_LOG_FILE_START_IDX
DISABLE_LOG_FILE_SIZE
ERROR_DIR
INFO_DIR
LEAP_YEAR
Leap Year
LOG_EXTENSION
MONTHS
Months

Traits§

AsyncErrorHandlerFunction
Trait alias for asynchronous error-handling functions used in a recoverable context.
AsyncRecoverableFunction
Trait alias for asynchronous functions that can be executed in a recoverable context.
BroadcastMapTrait
BroadcastTrait
ChunkNaming
ErrorHandlerFunction
Trait alias for error-handling functions used in a recoverable context.
FunctionMutTrait
Trait alias for functions that can be executed in a recoverable context.
FunctionOnceTrait
Trait alias for functions that can be executed in a recoverable context.
FunctionTrait
Trait alias for functions that can be executed in a recoverable context.
HandleStrategy
LogFuncTrait
RecoverableFunction
Trait alias for functions that can be executed in a recoverable context.

Functions§

append_to_file
Append the provided content to a file at the specified file_path. If the file does not exist, it will be created. If the file exists, the content will be appended to it.
async_append_to_file
Append the provided content to a file at the specified file_path asynchronously.
async_copy_dir_files
Asynchronously copies all files from the source directory to the destination directory.
async_copy_file
Asynchronously copies a file from the source path to the destination path.
async_delete_dir
Asynchronously deletes a directory and all its contents.
async_delete_file
Asynchronously deletes a file at the given path.
async_get_file_size
Retrieves the size of a file at the specified file_path in bytes.
async_move_dir
Moves a directory and all its contents to another location asynchronously.
async_move_file
Moves a file from the source path to the destination path asynchronously.
async_read_from_file
Reads the content of a file at the specified file_path and converts it to the type T. The conversion is done by using the From<Vec<u8>> trait, which allows the file content (read as raw bytes) to be converted into a type T.
async_write_to_file
Writes the provided content to a file at the specified file_path asynchronously.
calculate_time
Calculates the current year, month, day, hour, minute, second, millisecond and microsecond.
common_log
compute_date
Computes the year, month, and day from days since Unix epoch (1970-01-01).
copy_dir_files
Copies all files from the source directory to the destination directory.
copy_file
Copies a file from the source path to the destination path.
date
Gets the current day, without the time.
day
Gets the current day.
delete_dir
Deletes a directory and all its contents.
delete_file
Deletes a file at the given path.
get_file_size
Retrieves the size of a file at the specified file_path in bytes.
gmt
Gets the current date and time in GMT format.
hot_restart
hot_restart_wait
hour
Gets the current hour.
is_leap_year
Determines if a year is a leap year.
log_handler
micros
Gets the current timestamp in microseconds.
millis
Gets the current timestamp in milliseconds.
minute
Gets the current minute.
month
Gets the current month.
move_dir
Moves a directory and all its contents to another location.
move_file
Moves a file from the source path to the destination path.
output
Output
read_from_file
Reads the content of a file at the specified file_path and converts it to the type T. The conversion is done by using the From<Vec<u8>> trait, which allows the file content (read as raw bytes) to be converted into a type T.
second
Gets the current second.
time
Gets the current time, including the date and time.
time_micros
Gets the current time with microseconds, including the date and time.
time_millis
Gets the current time with milliseconds, including the date and time.
timestamp
Gets the current timestamp in seconds since Unix epoch.
timestamp_micros
Gets the current timestamp in microseconds since Unix epoch.
timestamp_millis
Gets the current timestamp in milliseconds since Unix epoch.
write_to_file
Writes the provided content to a file at the specified file_path. If the file does not exist, it will be created. If the file exists, the content will be appended to it.
year
Gets the current year.

Type Aliases§

ArcAsyncErrorHandlerFunction
Alias for an Arc-wrapped error handler function.
ArcAsyncRecoverableFunction
Alias for an Arc-wrapped recoverable function.
ArcLog
ArcLogFunc
AsyncSpawnResult
Type alias for the result type returned by spawnable functions.
BroadcastMapReceiver
BroadcastMapSendError
BroadcastMapSendResult
BroadcastMapSender
BroadcastReceiver
BroadcastSendError
BroadcastSendResult
BroadcastSender
Capacity
ChunkStrategyResult
DashMapStringBroadcast
ListLog
LogArcLock
LogFunc
LogListArcLock
NewChunkStrategyResult
OptionBroadcast
OptionBroadcastMapReceiver
OptionBroadcastMapSender
OptionReceiverCount
ReceiverCount
ResultHotRestartError
SendErrorBox
SendResult
ServerManagerError
ServerManagerResult
SpawnError
SpawnError
SyncSpawnResult
Type alias for the result type returned by spawnable functions.
ThreadPoolJob

Attribute Macros§

aborted
Handles aborted request scenarios.
attribute
Extracts a specific attribute value into a variable.
attributes
Extracts all attributes into a HashMap variable.
closed
Handles closed connection scenarios.
connect
Restricts function execution to HTTP CONNECT requests only.
delete
Restricts function execution to HTTP DELETE requests only.
filter_unknown
Handles requests with any unknown characteristics.
filter_unknown_method
Handles requests with unknown or non-standard HTTP methods.
filter_unknown_upgrade
Handles requests with unknown or non-standard upgrade protocols.
filter_unknown_version
Handles requests with unknown or non-standard HTTP versions.
flush
Flushes the response stream after function execution.
get
Restricts function execution to HTTP GET requests only.
h2c
Restricts function execution to HTTP/2 Cleartext (h2c) requests only.
head
Restricts function execution to HTTP HEAD requests only.
host
Restricts function execution to requests with a specific host.
host_filter
Filters requests that have no host header.
http
Restricts function execution to standard HTTP requests only.
http0_9
Restricts function execution to HTTP/0.9 requests only.
http2
Restricts function execution to HTTP/2 requests only.
http3
Restricts function execution to HTTP/3 requests only.
http1_0
Restricts function execution to HTTP/1.0 requests only.
http1_1
Restricts function execution to HTTP/1.1 requests only.
http1_1_or_higher
Restricts function execution to HTTP/1.1 or higher protocol versions.
hyperlane
Creates a new Server instance with the specified variable name.
methods
Allows function to handle multiple HTTP methods.
options
Restricts function execution to HTTP OPTIONS requests only.
patch
Restricts function execution to HTTP PATCH requests only.
post
Restricts function execution to HTTP POST requests only.
post_hook
Executes a specified function after the main handler function.
pre_hook
Executes a specified function before the main handler function.
put
Restricts function execution to HTTP PUT requests only.
referer
Restricts function execution to requests with a specific referer.
referer_filter
Filters requests that have a specific referer header.
request_body
Extracts the raw request body into a specified variable.
request_body_json
Parses the request body as JSON into a specified variable and type.
request_cookie
Extracts a specific cookie value or all cookies into a variable.
request_cookies
Extracts all cookies as a raw string into a variable.
request_header
Extracts a specific HTTP request header into a variable.
request_headers
Extracts all HTTP request headers into a collection variable.
request_path
Extracts the HTTP request path into a variable.
request_query
Extracts a specific request query parameter into a variable.
request_querys
Extracts all request query parameters into a collection variable.
request_version
Extracts the HTTP request version into a variable.
response_body
Sets the HTTP response body.
response_header
Sets or replaces a specific HTTP response header.
response_reason_phrase
Sets the HTTP reason phrase for the response.
response_status_code
Sets the HTTP status code for the response.
response_version
Sets the HTTP response version.
route_param
Extracts a specific route parameter into a variable.
route_params
Extracts all route parameters into a collection variable.
send
Automatically sends the complete response after function execution.
send_body
Automatically sends only the response body after function execution.
send_once
Sends the complete response exactly once after function execution.
send_once_body
Sends only the response body exactly once after function execution.
tls
Restricts function execution to TLS-encrypted requests only.
trace
Restricts function execution to HTTP TRACE requests only.
ws
Restricts function execution to WebSocket upgrade requests only.

Derive Macros§

CustomDebug
A procedural macro that implements the std::fmt::Debug trait for a type, with support for the #[debug(skip)] attribute to skip specific fields.
Data
This is an example of how to use the Lombok procedural macro with get, get_mut, and set attributes.
DisplayDebug
A procedural macro that implements the std::fmt::Display trait for a type, using the standard debug format ({:?}) for formatting.
DisplayDebugFormat
A procedural macro that implements the std::fmt::Display trait for a type, using the detailed debug format ({:#?}) for formatting.
Getter
This is an example of how to use the Lombok procedural macro with get attributes.
GetterMut
This is an example of how to use the Lombok procedural macro with get_mut attributes.
Setter
This is an example of how to use the Lombok procedural macro with set attributes.