restore HttpResponseBuilder::extensions

This commit is contained in:
Rob Ede 2022-01-16 00:11:50 +00:00
parent 946fae3df1
commit 181d1ccb8f
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 19 additions and 18 deletions

View File

@ -31,7 +31,7 @@ fi
# get current version # get current version
PACKAGE_NAME="$(sed -nE 's/^name ?= ?"([^"]+)"$/\1/ p' "$CARGO_MANIFEST" | head -n 1)" PACKAGE_NAME="$(sed -nE 's/^name ?= ?"([^"]+)"$/\1/ p' "$CARGO_MANIFEST" | head -n 1)"
CURRENT_VERSION="$(sed -nE 's/^version ?= ?"([^"]+)"$/\1/ p' "$CARGO_MANIFEST")" CURRENT_VERSION="$(sed -nE 's/^version ?= ?"([^"]+)"$/\1/ p' "$CARGO_MANIFEST" | head -n 1)"
CHANGE_CHUNK_FILE="$(mktemp)" CHANGE_CHUNK_FILE="$(mktemp)"
echo saving changelog to $CHANGE_CHUNK_FILE echo saving changelog to $CHANGE_CHUNK_FILE

View File

@ -1,4 +1,5 @@
use std::{ use std::{
cell::{Ref, RefMut},
convert::TryInto, convert::TryInto,
future::Future, future::Future,
pin::Pin, pin::Pin,
@ -8,7 +9,7 @@ use std::{
use actix_http::{ use actix_http::{
error::HttpError, error::HttpError,
header::{self, HeaderName, TryIntoHeaderPair, TryIntoHeaderValue}, header::{self, HeaderName, TryIntoHeaderPair, TryIntoHeaderValue},
ConnectionType, Response, ResponseHead, StatusCode, ConnectionType, Extensions, Response, ResponseHead, StatusCode,
}; };
use bytes::Bytes; use bytes::Bytes;
use futures_core::Stream; use futures_core::Stream;
@ -276,22 +277,23 @@ impl HttpResponseBuilder {
self self
} }
// /// Responses extensions /// Returns a reference to the response-local data/extensions container.
// #[inline] #[inline]
// pub fn extensions(&self) -> Ref<'_, Extensions> { pub fn extensions(&self) -> Ref<'_, Extensions> {
// self.res self.res
// .as_ref() .as_ref()
// .expect("cannot reuse response builder") .expect("cannot reuse response builder")
// .extensions() .extensions()
// } }
// /// Mutable reference to a the response's extensions /// Returns a mutable reference to the response-local data/extensions container.
// pub fn extensions_mut(&mut self) -> RefMut<'_, Extensions> { #[inline]
// self.res pub fn extensions_mut(&mut self) -> RefMut<'_, Extensions> {
// .as_mut() self.res
// .expect("cannot reuse response builder") .as_mut()
// .extensions_mut() .expect("cannot reuse response builder")
// } .extensions_mut()
}
/// Set a body and build the `HttpResponse`. /// Set a body and build the `HttpResponse`.
/// ///
@ -388,7 +390,6 @@ impl HttpResponseBuilder {
} }
} }
#[inline]
fn inner(&mut self) -> Option<&mut ResponseHead> { fn inner(&mut self) -> Option<&mut ResponseHead> {
if self.err.is_some() { if self.err.is_some() {
return None; return None;