feat(headers): adds re-parsing ability when getting typed headers

BREAKING CHANGE: added requirement that all HeaderFormat implementations
  must also be fmt::Debug. This likely as easy as slapping
  #[derive(Debug)] on to any custom headers.
This commit is contained in:
Sean McArthur
2015-02-05 17:09:02 -08:00
parent 9e0770896b
commit df756871ed
10 changed files with 258 additions and 240 deletions

View File

@@ -8,7 +8,6 @@ use std::path::Path;
use std::raw::{self, TraitObject};
use std::sync::Arc;
use uany::UnsafeAnyExt;
use openssl::ssl::{Ssl, SslStream, SslContext};
use openssl::ssl::SslVerifyMode::SslVerifyNone;
use openssl::ssl::SslMethod::Sslv23;
@@ -99,7 +98,7 @@ impl Clone for Box<NetworkStream + Send> {
fn clone(&self) -> Box<NetworkStream + Send> { self.clone_box() }
}
impl UnsafeAnyExt for NetworkStream {
impl NetworkStream {
unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T {
mem::transmute(mem::transmute::<&NetworkStream,
raw::TraitObject>(self).data)
@@ -351,8 +350,6 @@ fn lift_ssl_error(ssl: SslError) -> io::Error {
#[cfg(test)]
mod tests {
use uany::UnsafeAnyExt;
use mock::MockStream;
use super::NetworkStream;