mirror of
https://github.com/actix/actix-web.git
synced 2025-01-06 07:18:45 +00:00
use small vec on hot path
This commit is contained in:
parent
c33caddf57
commit
e2107ec6f4
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
use smallvec::SmallVec;
|
||||||
use http::{Method, StatusCode};
|
use http::{Method, StatusCode};
|
||||||
|
|
||||||
use pred;
|
use pred;
|
||||||
|
@ -34,7 +35,7 @@ use httpresponse::HttpResponse;
|
||||||
pub struct Resource<S=()> {
|
pub struct Resource<S=()> {
|
||||||
name: String,
|
name: String,
|
||||||
state: PhantomData<S>,
|
state: PhantomData<S>,
|
||||||
routes: Vec<Route<S>>,
|
routes: SmallVec<[Route<S>; 3]>,
|
||||||
middlewares: Rc<Vec<Box<Middleware<S>>>>,
|
middlewares: Rc<Vec<Box<Middleware<S>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ impl<S> Default for Resource<S> {
|
||||||
Resource {
|
Resource {
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
state: PhantomData,
|
state: PhantomData,
|
||||||
routes: Vec::new(),
|
routes: SmallVec::new(),
|
||||||
middlewares: Rc::new(Vec::new()) }
|
middlewares: Rc::new(Vec::new()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +55,7 @@ impl<S> Resource<S> {
|
||||||
Resource {
|
Resource {
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
state: PhantomData,
|
state: PhantomData,
|
||||||
routes: Vec::new(),
|
routes: SmallVec::new(),
|
||||||
middlewares: Rc::new(Vec::new()) }
|
middlewares: Rc::new(Vec::new()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue