Skip to content

Commit

Permalink
fixing doc.rs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rapidclock committed Jan 6, 2020
1 parent 40f52bc commit 6ed05ec
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "nano-get"
description = """
A very tiny implementation of HTTP(s) GET, using minimal dependencies.
"""
version = "0.2.2"
version = "0.2.3"
authors = ["Rahul Thomas <rapidclock@users.noreply.github.com>"]
edition = "2018"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A tiny implementation of HTTP GET using only the standard library by default.

If you require `https`, please enable the `"https"` feature flag like:
```
nano-get = { version = "0.2.2", features = ["https"] }
nano-get = { version = "0.2.3", features = ["https"] }
```

Enabling the `https` flag, uses the rust [openssl](https://crates.io/crates/openssl) crate.
Expand Down Expand Up @@ -120,7 +120,7 @@ This is also not meant to be demonstrative of idiomatic uses of the async librar
**Cargo.toml snippet**
```toml
[dependencies]
nano-get = {version = "0.2.2", features = ["https"] }
nano-get = {version = "0.2.3", features = ["https"] }
tokio = { version = "0.2.6", features = ["rt-threaded"] }
futures = "0.3.1"
```
Expand Down
13 changes: 2 additions & 11 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,8 @@ impl std::fmt::Display for NanoGetError {
}
}

//impl From for NanoGetError {
// fn from(err: std::io::Error) -> Self {
//
// }
//}

impl NanoGetError {
pub fn new(kind: ErrorKind) -> Self {
NanoGetError {kind}
NanoGetError { kind }
}
}


//pub type Result<T> = std::result::Result<T, NanoGetError>;
}
6 changes: 2 additions & 4 deletions src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ extern crate openssl;

use std::net::TcpStream;

use openssl::ssl::{SslConnector, SslMethod};
use openssl::ssl::{SslConnector, SslMethod, SslStream};

use super::{Request, Response, ToUrl, Url};
use super::http;

use openssl::ssl::SslStream;
use super::errors::NanoGetError;
use super::http;

/// The implementation of HTTPS GET using OpenSSL.
///
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
//! ```
//!
//! For details, check the `Request` and `Response` structure documentation.
pub use http::get_http;
#[cfg(feature = "https")]
pub use https::get_https;
Expand Down
4 changes: 2 additions & 2 deletions src/request.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::collections::HashMap;
use std::error::Error;

use super::{ToUrl, Url};
use super::errors::NanoGetError;
use super::http::request_http_get;
#[cfg(feature = "https")]
use super::https::request_https_get;
use super::Response;

use super::{ToUrl, Url};

/// This is the basic HTTP Request Object.
///
/// This is self-containing and you can execute the request using its execute method.
Expand Down
6 changes: 3 additions & 3 deletions src/response.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::fmt::{Display, Formatter, Error};
use super::url::Tuple;
use std::fmt::{Display, Error, Formatter};

use super::url::Tuple;

/// This is the HTTP Reponse Object.
///
Expand Down Expand Up @@ -81,7 +81,7 @@ fn process_head_lines(lines: Vec<&str>) -> (ResponseStatus, Option<HashMap<Strin
}

fn process_response_headers(lines: &[&str]) -> Option<HashMap<String, String>> {
return if lines.is_empty() {
if lines.is_empty() {
None
} else {
let mut headers = HashMap::new();
Expand Down
4 changes: 2 additions & 2 deletions src/url/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod models;
pub use self::models::{ToUrl, Tuple, Url};

pub use self::models::{Url, ToUrl, Tuple};
pub mod models;

pub fn parse_proto(s: String, default_proto: Option<String>) -> (String, String) {
let parts: Vec<&str> = s.split("://").collect();
Expand Down

0 comments on commit 6ed05ec

Please sign in to comment.