pub struct TimeoutPlugin { /* private fields */ }Expand description
Compiled request deadline manager backing TimeoutRequestHook and TimeoutResponseHook.
Implementations§
Source§impl TimeoutPlugin
Compiled budget resolution and response enforcement for TimeoutPlugin.
impl TimeoutPlugin
Compiled budget resolution and response enforcement for TimeoutPlugin.
Sourcepub fn new(config: TimeoutConfig) -> Self
pub fn new(config: TimeoutConfig) -> Self
Compiles a standalone TimeoutPlugin from config.
§Arguments
TimeoutConfig- Timeout configuration.
§Returns
Self- Compiled plugin.
Sourcepub fn init(config: TimeoutConfig) -> &'static Self
pub fn init(config: TimeoutConfig) -> &'static Self
Initializes the global TimeoutPlugin singleton once.
§Arguments
TimeoutConfig- Timeout configuration.
§Returns
&'static Self- Reference to the global plugin.
Sourcepub fn get() -> Option<&'static Self>
pub fn get() -> Option<&'static Self>
Returns the initialized global TimeoutPlugin, if configured.
§Returns
Option<&'static Self>- Reference to the global plugin, orNone.
Sourcepub fn get_config(&self) -> &TimeoutConfig
pub fn get_config(&self) -> &TimeoutConfig
Sourcepub fn resolve_budget_ms(&self, request: &Request) -> u64
pub fn resolve_budget_ms(&self, request: &Request) -> u64
Sourcepub fn apply_timeout_response(&self, response: &mut Response)
pub fn apply_timeout_response(&self, response: &mut Response)
Applies timeout error status and body onto response when a request deadline has expired.
§Arguments
&mut Response- Outgoing HTTP response.
Trait Implementations§
Source§impl Clone for TimeoutPlugin
impl Clone for TimeoutPlugin
Auto Trait Implementations§
impl Forget for TimeoutPlugin
impl Freeze for TimeoutPluginwhere
*const u8 is !null: Freeze,
PhantomData<PrefixTimeout>: Freeze,
PhantomData<u8>: Freeze,
*const [(String, u64)] is !null: Freeze,
PhantomData<[(String, u64)]>: Freeze,
impl Move for TimeoutPlugin
impl RefUnwindSafe for TimeoutPlugin
impl Send for TimeoutPlugin
impl Sync for TimeoutPlugin
impl Unpin for TimeoutPlugin
impl UnsafeUnpin for TimeoutPluginwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<PrefixTimeout>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const [(String, u64)] is !null: UnsafeUnpin,
PhantomData<[(String, u64)]>: UnsafeUnpin,
impl UnwindSafe for TimeoutPlugin
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more