pub(crate) where we can

This commit is contained in:
Martin Algesten
2018-12-20 11:08:20 +01:00
parent 1519dcb0b1
commit 07fd4d2cd5
7 changed files with 23 additions and 21 deletions

View File

@@ -89,7 +89,7 @@ impl Write for Stream {
}
}
pub fn connect_http(unit: &Unit) -> Result<Stream, Error> {
pub(crate) fn connect_http(unit: &Unit) -> Result<Stream, Error> {
//
let hostname = unit.url.host_str().unwrap();
let port = unit.url.port().unwrap_or(80);
@@ -98,7 +98,7 @@ pub fn connect_http(unit: &Unit) -> Result<Stream, Error> {
}
#[cfg(feature = "tls")]
pub fn connect_https(unit: &Unit) -> Result<Stream, Error> {
pub(crate) fn connect_https(unit: &Unit) -> Result<Stream, Error> {
use std::sync::Arc;
lazy_static! {
@@ -124,7 +124,7 @@ pub fn connect_https(unit: &Unit) -> Result<Stream, Error> {
Ok(Stream::Https(stream))
}
pub fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result<TcpStream, Error> {
pub(crate) fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result<TcpStream, Error> {
//
let ips: Vec<SocketAddr> = format!("{}:{}", hostname, port)
.to_socket_addrs()
@@ -164,13 +164,13 @@ pub fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result<TcpStream,
}
#[cfg(test)]
pub fn connect_test(unit: &Unit) -> Result<Stream, Error> {
pub(crate) fn connect_test(unit: &Unit) -> Result<Stream, Error> {
use crate::test;
test::resolve_handler(unit)
}
#[cfg(not(test))]
pub fn connect_test(unit: &Unit) -> Result<Stream, Error> {
pub(crate) fn connect_test(unit: &Unit) -> Result<Stream, Error> {
Err(Error::UnknownScheme(unit.url.scheme().to_string()))
}