Skip to content

Commit

Permalink
bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeshadow committed Feb 17, 2024
1 parent 1a165ad commit 217e8be
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
4 changes: 3 additions & 1 deletion http/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# unreleased
# unreleased 0.4.0
## Change
- `body::Either` doesn't expose it's enum variants in public API anymore.

# 0.3.0
## Add
Expand Down
2 changes: 1 addition & 1 deletion http/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-http"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "http library for xitca"
Expand Down
35 changes: 23 additions & 12 deletions http/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,25 @@ where
Poll::Ready(mem::replace(self.get_mut(), Self(None)).0.map(Ok))
}

// use the length of buffer as both lower bound and upperbound.
// use the length of buffer as both lower bound and upper bound.
fn size_hint(&self) -> (usize, Option<usize>) {
match self.0 {
Some(ref b) => exact_body_hint(b.remaining()),
None => unreachable!("Once must check size_hint before it got polled"),
}
self.0
.as_ref()
.map(|b| exact_body_hint(b.remaining()))
.expect("Once must check size_hint before it got polled")
}
}

pin_project! {
pub struct Either<L, R> {
#[pin]
inner: EitherInner<L, R>
}
}

pin_project! {
#[project = EitherProj]
pub enum Either<L, R> {
enum EitherInner<L, R> {
L {
#[pin]
inner: L
Expand All @@ -192,12 +199,16 @@ pin_project! {
impl<L, R> Either<L, R> {
#[inline]
pub const fn left(inner: L) -> Self {
Self::L { inner }
Self {
inner: EitherInner::L { inner },
}
}

#[inline]
pub const fn right(inner: R) -> Self {
Self::R { inner }
Self {
inner: EitherInner::R { inner },
}
}
}

Expand All @@ -211,17 +222,17 @@ where

#[inline]
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
match self.project() {
match self.project().inner.project() {
EitherProj::L { inner } => inner.poll_next(cx).map(|res| res.map(|res| res.map_err(Into::into))),
EitherProj::R { inner } => inner.poll_next(cx),
}
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
match *self {
Self::L { ref inner } => inner.size_hint(),
Self::R { ref inner } => inner.size_hint(),
match self.inner {
EitherInner::L { ref inner } => inner.size_hint(),
EitherInner::R { ref inner } => inner.size_hint(),
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion web/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# unreleased
# unreleased 0.4.0
## Change
- update `xitca-http` to `0.4.0`

# 0.3.0
## Add
Expand Down
4 changes: 2 additions & 2 deletions web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xitca-web"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "Apache-2.0"
description = "an async web framework"
Expand Down Expand Up @@ -76,7 +76,7 @@ serde = ["dep:serde"]
__server = ["xitca-http/runtime", "xitca-server"]

[dependencies]
xitca-http = { version = "0.3.0", features = ["router"], default-features = false }
xitca-http = { version = "0.4.0", features = ["router"], default-features = false }
xitca-service = { version = "0.1", features = ["alloc", "std"] }
xitca-unsafe-collection = "0.1"

Expand Down

0 comments on commit 217e8be

Please sign in to comment.