We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f3cde6 commit 693a288Copy full SHA for 693a288
src/response.rs
@@ -422,9 +422,15 @@ impl Response {
422
self.res.ext().get()
423
}
424
425
- /// Set a response scoped extension value.
426
- pub fn insert_ext<T: Send + Sync + 'static>(&mut self, val: T) {
427
- self.res.ext_mut().insert(val);
+ /// Get a mutable reference to value stored in response extensions.
+ #[must_use]
+ pub fn ext_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T> {
428
+ self.res.ext_mut().get_mut()
429
+ }
430
+
431
+ /// Set a response extension value.
432
+ pub fn set_ext<T: Send + Sync + 'static>(&mut self, val: T) -> Option<T> {
433
+ self.res.ext_mut().insert(val)
434
435
436
/// Create a `tide::Response` from a type that can be converted into an
0 commit comments