pub trait RequestCommon:
Serialize
+ Deserialize
+ Send
+ Sync
+ Unpin
+ Debug
+ 'static {
type Kind: RequestKind;
type Response: Deserialize + Serialize + Send;
const TYPE_ID: u16;
const MAX_REQUESTS: u32;
const TIME_WINDOW: Duration = DEFAULT_MAX_REQUEST_RESPONSE_TIME_WINDOW;
// Provided method
fn type_name<T>() -> &'static str { ... }
}Required Associated Constants§
const TYPE_ID: u16
Sourceconst MAX_REQUESTS: u32
const MAX_REQUESTS: u32
The maximum number of requests of this type a peer can send in a burst. Implementations
treat the budget as a token bucket that refills one request every
TIME_WINDOW / MAX_REQUESTS, so this is also the number of requests a peer can make per
TIME_WINDOW on average. A request that finds the bucket empty is
answered with InboundRequestError::ExceedsRateLimit. Must be at least one.
Provided Associated Constants§
Sourceconst TIME_WINDOW: Duration = DEFAULT_MAX_REQUEST_RESPONSE_TIME_WINDOW
const TIME_WINDOW: Duration = DEFAULT_MAX_REQUEST_RESPONSE_TIME_WINDOW
The time it takes to refill the whole budget of MAX_REQUESTS.
Must be at least a nanosecond per request, so it cannot be zero.
Required Associated Types§
type Kind: RequestKind
type Response: Deserialize + Serialize + Send
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".