Remove unused generic parameter from Chunk
This commit is contained in:
parent
065e653f86
commit
adea1e4389
2 changed files with 7 additions and 7 deletions
|
@ -20,17 +20,17 @@ const SRC_FILE: &'static [u8] = include_bytes!("../data/test1.webm");
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct WebmServer;
|
struct WebmServer;
|
||||||
|
|
||||||
type BodyStream<B> = Box<Stream<Item = Chunk<B>, Error = hyper::Error>>;
|
type BodyStream = Box<Stream<Item = Chunk, Error = hyper::Error>>;
|
||||||
|
|
||||||
impl Service for WebmServer {
|
impl Service for WebmServer {
|
||||||
type Request = Request;
|
type Request = Request;
|
||||||
type Response = Response<BodyStream<Vec<u8>>>;
|
type Response = Response<BodyStream>;
|
||||||
type Error = hyper::Error;
|
type Error = hyper::Error;
|
||||||
type Future = FutureResult<Self::Response, hyper::Error>;
|
type Future = FutureResult<Self::Response, hyper::Error>;
|
||||||
fn call(&self, req: Request) -> Self::Future {
|
fn call(&self, req: Request) -> Self::Future {
|
||||||
let response = match (req.method(), req.path()) {
|
let response = match (req.method(), req.path()) {
|
||||||
(&Get, "/loop") => {
|
(&Get, "/loop") => {
|
||||||
let stream: BodyStream<Vec<u8>> = Box::new(
|
let stream: BodyStream = Box::new(
|
||||||
repeat::<&[u8], ()>(SRC_FILE).take(5)
|
repeat::<&[u8], ()>(SRC_FILE).take(5)
|
||||||
.parse_ebml().chunk_webm().fix_timecodes().find_starting_point()
|
.parse_ebml().chunk_webm().fix_timecodes().find_starting_point()
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
|
|
|
@ -52,17 +52,17 @@ impl AsRef<[u8]> for ClusterHead {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Chunk<B: AsRef<[u8]> = Vec<u8>> {
|
pub enum Chunk {
|
||||||
Headers {
|
Headers {
|
||||||
bytes: Arc<B>
|
bytes: Arc<Vec<u8>>
|
||||||
},
|
},
|
||||||
ClusterHead(ClusterHead),
|
ClusterHead(ClusterHead),
|
||||||
ClusterBody {
|
ClusterBody {
|
||||||
bytes: Arc<B>
|
bytes: Arc<Vec<u8>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B: AsRef<[u8]>> AsRef<[u8]> for Chunk<B> {
|
impl AsRef<[u8]> for Chunk {
|
||||||
fn as_ref(&self) -> &[u8] {
|
fn as_ref(&self) -> &[u8] {
|
||||||
match self {
|
match self {
|
||||||
&Chunk::Headers {ref bytes, ..} => bytes.as_ref().as_ref(),
|
&Chunk::Headers {ref bytes, ..} => bytes.as_ref().as_ref(),
|
||||||
|
|
Loading…
Reference in a new issue