Skip to content

Commit 3594a2a

Browse files
authored
Merge pull request #287 from http-rs/new-connection
make it so upgrade connections can be built from the outside
2 parents 2a89da2 + 45e54df commit 3594a2a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/upgrade/connection.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ pub struct RawConnection<Inner> {
99
inner: Inner,
1010
}
1111

12+
impl Connection {
13+
pub fn new<T: InnerConnection + 'static>(t: T) -> Self {
14+
RawConnection { inner: Box::new(t) }
15+
}
16+
}
17+
1218
/// A boxed upgraded HTTP connection.
1319
pub type Connection = RawConnection<Box<dyn InnerConnection + 'static>>;
1420

0 commit comments

Comments
 (0)