inline
This commit is contained in:
parent
91f420330b
commit
46eec93773
2 changed files with 5 additions and 0 deletions
|
@ -28,6 +28,7 @@ pub struct CachedImage {
|
|||
}
|
||||
|
||||
impl CachedImage {
|
||||
#[inline]
|
||||
fn len(&self) -> usize {
|
||||
self.data.capacity()
|
||||
+ self
|
||||
|
@ -47,6 +48,7 @@ impl CachedImage {
|
|||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn shrink_to_fit(&mut self) {
|
||||
self.data.shrink_to_fit();
|
||||
self.content_length.as_mut().map(Vec::shrink_to_fit);
|
||||
|
|
|
@ -37,6 +37,7 @@ enum ServerResponse {
|
|||
}
|
||||
|
||||
impl Responder for ServerResponse {
|
||||
#[inline]
|
||||
fn respond_to(self, req: &HttpRequest) -> HttpResponse {
|
||||
match self {
|
||||
Self::TokenValidationError(e) => e.respond_to(req),
|
||||
|
@ -111,6 +112,7 @@ enum TokenValidationError {
|
|||
}
|
||||
|
||||
impl Responder for TokenValidationError {
|
||||
#[inline]
|
||||
fn respond_to(self, _: &HttpRequest) -> HttpResponse {
|
||||
push_headers(&mut HttpResponse::Forbidden()).finish()
|
||||
}
|
||||
|
@ -150,6 +152,7 @@ fn validate_token(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn push_headers(builder: &mut HttpResponseBuilder) -> &mut HttpResponseBuilder {
|
||||
builder
|
||||
.insert_header((X_CONTENT_TYPE_OPTIONS, "nosniff"))
|
||||
|
|
Loading…
Reference in a new issue