mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Add missing_const_for_fn clippy lint (#8498)
This commit is contained in:
@ -588,31 +588,31 @@ impl Default for Builder<Identity, Identity> {
|
||||
|
||||
impl<HttpMiddleware, RpcMiddleware> Builder<HttpMiddleware, RpcMiddleware> {
|
||||
/// Set the maximum size of a request body in bytes. Default is 10 MiB.
|
||||
pub fn max_request_body_size(mut self, size: u32) -> Self {
|
||||
pub const fn max_request_body_size(mut self, size: u32) -> Self {
|
||||
self.settings.max_request_body_size = size;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the maximum size of a response body in bytes. Default is 10 MiB.
|
||||
pub fn max_response_body_size(mut self, size: u32) -> Self {
|
||||
pub const fn max_response_body_size(mut self, size: u32) -> Self {
|
||||
self.settings.max_response_body_size = size;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the maximum size of a log
|
||||
pub fn max_log_length(mut self, size: u32) -> Self {
|
||||
pub const fn max_log_length(mut self, size: u32) -> Self {
|
||||
self.settings.max_log_length = size;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the maximum number of connections allowed. Default is 100.
|
||||
pub fn max_connections(mut self, max: u32) -> Self {
|
||||
pub const fn max_connections(mut self, max: u32) -> Self {
|
||||
self.settings.max_connections = max;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the maximum number of connections allowed. Default is 1024.
|
||||
pub fn max_subscriptions_per_connection(mut self, max: u32) -> Self {
|
||||
pub const fn max_subscriptions_per_connection(mut self, max: u32) -> Self {
|
||||
self.settings.max_subscriptions_per_connection = max;
|
||||
self
|
||||
}
|
||||
@ -634,7 +634,7 @@ impl<HttpMiddleware, RpcMiddleware> Builder<HttpMiddleware, RpcMiddleware> {
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the buffer capacity is 0.
|
||||
pub fn set_message_buffer_capacity(mut self, c: u32) -> Self {
|
||||
pub const fn set_message_buffer_capacity(mut self, c: u32) -> Self {
|
||||
self.settings.message_buffer_capacity = c;
|
||||
self
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ pub(crate) enum RpcServiceCfg {
|
||||
|
||||
impl RpcService {
|
||||
/// Create a new service.
|
||||
pub(crate) fn new(
|
||||
pub(crate) const fn new(
|
||||
methods: Methods,
|
||||
max_response_body_size: usize,
|
||||
conn_id: usize,
|
||||
|
||||
@ -61,13 +61,13 @@ impl StreamCodec {
|
||||
}
|
||||
|
||||
/// New custom stream codec
|
||||
pub fn new(incoming_separator: Separator, outgoing_separator: Separator) -> Self {
|
||||
pub const fn new(incoming_separator: Separator, outgoing_separator: Separator) -> Self {
|
||||
Self { incoming_separator, outgoing_separator }
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_whitespace(byte: u8) -> bool {
|
||||
const fn is_whitespace(byte: u8) -> bool {
|
||||
matches!(byte, 0x0D | 0x0A | 0x20 | 0x09)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user