summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoug tangren <d.tangren@gmail.com>2018-12-24 13:11:02 +0900
committerGitHub <noreply@github.com>2018-12-24 13:11:02 +0900
commitebe4a2d80dffb89d1fbceb14dbac3dc6da004fb8 (patch)
treeab56800af4f921388035fd6d9f318f9ec0bd97cc
parent3c06c3a11ba1f7d362bde8b14d94b07b529850e8 (diff)
update to 2018 edition (#141)
* update to 2018 edition * remove more externs * bump version
-rw-r--r--Cargo.toml3
-rw-r--r--README.md11
-rw-r--r--examples/containercreate.rs3
-rw-r--r--examples/containerdelete.rs3
-rw-r--r--examples/containerexec.rs3
-rw-r--r--examples/containerinspect.rs3
-rw-r--r--examples/containers.rs4
-rw-r--r--examples/events.rs3
-rw-r--r--examples/export.rs7
-rw-r--r--examples/imagebuild.rs3
-rw-r--r--examples/imagedelete.rs3
-rw-r--r--examples/imageinspect.rs3
-rw-r--r--examples/imagepull.rs3
-rw-r--r--examples/images.rs3
-rw-r--r--examples/info.rs3
-rw-r--r--examples/logs.rs3
-rw-r--r--examples/networkconnect.rs3
-rw-r--r--examples/networkcreate.rs3
-rw-r--r--examples/networkdelete.rs3
-rw-r--r--examples/networkdisconnect.rs3
-rw-r--r--examples/networkinspect.rs3
-rw-r--r--examples/networks.rs4
-rw-r--r--examples/stats.rs3
-rw-r--r--examples/top.rs3
-rw-r--r--examples/volumecreate.rs9
-rw-r--r--examples/volumedelete.rs3
-rw-r--r--examples/volumes.rs3
-rw-r--r--rustfmt.toml6
-rw-r--r--src/builder.rs22
-rw-r--r--src/errors.rs5
-rw-r--r--src/lib.rs72
-rw-r--r--src/read.rs8
-rw-r--r--src/rep.rs1
-rw-r--r--src/tarball.rs11
-rw-r--r--src/transport.rs8
-rw-r--r--src/tty.rs25
36 files changed, 71 insertions, 188 deletions
diff --git a/Cargo.toml b/Cargo.toml
index db098c2..60f2bfe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "shiplift"
-version = "0.3.2"
+version = "0.4.0"
authors = ["softprops <d.tangren@gmail.com>"]
description = "A Rust interface for maneuvering Docker containers"
documentation = "https://docs.rs/shiplift"
@@ -9,6 +9,7 @@ homepage = "https://github.com/softprops/shiplift"
repository = "https://github.com/softprops/shiplift"
keywords = ["docker", "unix", "containers", "hyper", "ship"]
license = "MIT"
+edition = "2018"
[dependencies]
byteorder = "1"
diff --git a/README.md b/README.md
index d0592e3..358e378 100644
--- a/README.md
+++ b/README.md
@@ -20,20 +20,15 @@ Some small example programs can be found in this repository's [examples director
### communicating with hosts
To use shiplift, you must first have a docker daemon readily accessible. Typically this daemon processs
-is resolvable via a url specified by an env var named `DOCKER_HOST`. If you are using osx, [docker-machine](https://docs.docker.com/machine/) typically
-will have already set up every thing you need to get started when you run `docker-machine env {envid}`.
+is resolvable via a url specified by an env var named `DOCKER_HOST`.
```rust
-extern crate shiplift;
let docker = shiplift::Docker::new();
```
If you wish to be more explicit you can provide a host in the form of a `url.Url`.
```rust
-extern crate shiplift;
-extern crate url;
-
use shiplift::Docker;
use url::Url;
@@ -45,8 +40,6 @@ let docker = Docker::host(Url::parse("http://yourhost").unwrap());
If you are interacting with docker containers, chances are you will also need to interact with docker image information. You can interact docker images with `docker.images()`.
```rust
-extern crate shiplift;
-
use shiplift::Docker;
let docker = Docker.new();
@@ -127,8 +120,6 @@ println!("- {:?}", img.delete().unwrap());
Containers are instances of images. To gain access to this interface use `docker.containers()`
```rust
-extern crate shiplift;
-
use shiplift::Docker;
let docker = Docker.new();
diff --git a/examples/containercreate.rs b/examples/containercreate.rs
index f5baf39..d061f70 100644
--- a/examples/containercreate.rs
+++ b/examples/containercreate.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{ContainerOptions, Docker};
use std::env;
use tokio::prelude::Future;
diff --git a/examples/containerdelete.rs b/examples/containerdelete.rs
index cc2e9b7..e3c2036 100644
--- a/examples/containerdelete.rs
+++ b/examples/containerdelete.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/containerexec.rs b/examples/containerexec.rs
index 0bfd640..7f12f88 100644
--- a/examples/containerexec.rs
+++ b/examples/containerexec.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{tty::StreamType, Docker, ExecContainerOptions};
use std::env;
use tokio::prelude::{Future, Stream};
diff --git a/examples/containerinspect.rs b/examples/containerinspect.rs
index ebd37ef..0f853bc 100644
--- a/examples/containerinspect.rs
+++ b/examples/containerinspect.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/containers.rs b/examples/containers.rs
index 71da705..0eb51af 100644
--- a/examples/containers.rs
+++ b/examples/containers.rs
@@ -1,7 +1,3 @@
-extern crate env_logger;
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use tokio::prelude::Future;
diff --git a/examples/events.rs b/examples/events.rs
index ced2f29..0e35860 100644
--- a/examples/events.rs
+++ b/examples/events.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use tokio::prelude::{Future, Stream};
diff --git a/examples/export.rs b/examples/export.rs
index b8d8eaf..55d1b7b 100644
--- a/examples/export.rs
+++ b/examples/export.rs
@@ -1,10 +1,5 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{errors::Error, Docker};
-use std::env;
-use std::fs::OpenOptions;
-use std::io::Write;
+use std::{env, fs::OpenOptions, io::Write};
use tokio::prelude::{Future, Stream};
fn main() {
diff --git a/examples/imagebuild.rs b/examples/imagebuild.rs
index 4b67219..6dbea78 100644
--- a/examples/imagebuild.rs
+++ b/examples/imagebuild.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{BuildOptions, Docker};
use std::env;
use tokio::prelude::{Future, Stream};
diff --git a/examples/imagedelete.rs b/examples/imagedelete.rs
index 5e507a2..efa763c 100644
--- a/examples/imagedelete.rs
+++ b/examples/imagedelete.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/imageinspect.rs b/examples/imageinspect.rs
index 0cd8450..494480a 100644
--- a/examples/imageinspect.rs
+++ b/examples/imageinspect.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/imagepull.rs b/examples/imagepull.rs
index 1039080..a9c5b36 100644
--- a/examples/imagepull.rs
+++ b/examples/imagepull.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{Docker, PullOptions};
use std::env;
use tokio::prelude::{Future, Stream};
diff --git a/examples/images.rs b/examples/images.rs
index b3e80a8..e68c9bb 100644
--- a/examples/images.rs
+++ b/examples/images.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use tokio::prelude::Future;
diff --git a/examples/info.rs b/examples/info.rs
index b608818..05fdede 100644
--- a/examples/info.rs
+++ b/examples/info.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use tokio::prelude::Future;
diff --git a/examples/logs.rs b/examples/logs.rs
index 6fad7d6..57f12be 100644
--- a/examples/logs.rs
+++ b/examples/logs.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{tty::StreamType, Docker, LogsOptions};
use std::env;
use tokio::prelude::{Future, Stream};
diff --git a/examples/networkconnect.rs b/examples/networkconnect.rs
index 3960b8f..0cfc8fc 100644
--- a/examples/networkconnect.rs
+++ b/examples/networkconnect.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{ContainerConnectionOptions, Docker};
use std::env;
use tokio::prelude::Future;
diff --git a/examples/networkcreate.rs b/examples/networkcreate.rs
index a7b7662..30bb41c 100644
--- a/examples/networkcreate.rs
+++ b/examples/networkcreate.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{Docker, NetworkCreateOptions};
use std::env;
use tokio::prelude::Future;
diff --git a/examples/networkdelete.rs b/examples/networkdelete.rs
index 8f1cdca..16fc4ab 100644
--- a/examples/networkdelete.rs
+++ b/examples/networkdelete.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/networkdisconnect.rs b/examples/networkdisconnect.rs
index e388513..9588ecc 100644
--- a/examples/networkdisconnect.rs
+++ b/examples/networkdisconnect.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::{ContainerConnectionOptions, Docker};
use std::env;
use tokio::prelude::Future;
diff --git a/examples/networkinspect.rs b/examples/networkinspect.rs
index 37992a5..86a076b 100644
--- a/examples/networkinspect.rs
+++ b/examples/networkinspect.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/networks.rs b/examples/networks.rs
index 57cd566..9ceea99 100644
--- a/examples/networks.rs
+++ b/examples/networks.rs
@@ -1,7 +1,3 @@
-extern crate env_logger;
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use tokio::prelude::Future;
diff --git a/examples/stats.rs b/examples/stats.rs
index f136326..5e03f20 100644
--- a/examples/stats.rs
+++ b/examples/stats.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::{Future, Stream};
diff --git a/examples/top.rs b/examples/top.rs
index 1bdf6ca..5fc4229 100644
--- a/examples/top.rs
+++ b/examples/top.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/volumecreate.rs b/examples/volumecreate.rs
index d955abe..83f5045 100644
--- a/examples/volumecreate.rs
+++ b/examples/volumecreate.rs
@@ -1,10 +1,5 @@
-extern crate shiplift;
-extern crate tokio;
-
-use shiplift::builder::VolumeCreateOptions;
-use shiplift::Docker;
-use std::collections::HashMap;
-use std::env;
+use shiplift::{builder::VolumeCreateOptions, Docker};
+use std::{collections::HashMap, env};
use tokio::prelude::Future;
fn main() {
diff --git a/examples/volumedelete.rs b/examples/volumedelete.rs
index 8689589..3800d22 100644
--- a/examples/volumedelete.rs
+++ b/examples/volumedelete.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use std::env;
use tokio::prelude::Future;
diff --git a/examples/volumes.rs b/examples/volumes.rs
index 59c7b65..ea577a7 100644
--- a/examples/volumes.rs
+++ b/examples/volumes.rs
@@ -1,6 +1,3 @@
-extern crate shiplift;
-extern crate tokio;
-
use shiplift::Docker;
use tokio::prelude::Future;
diff --git a/rustfmt.toml b/rustfmt.toml
index ecbc0a6..3eb534e 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,2 +1,4 @@
-# style function arg lists consistently
-fn_args_density = "Vertical" \ No newline at end of file
+# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_args_density
+fn_args_density = "Vertical"
+# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports
+merge_imports = true \ No newline at end of file
diff --git a/src/builder.rs b/src/builder.rs
index cd086ca..bf7500f 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -1,21 +1,17 @@
//! Interfaces for building various structures
-// Std lib
-use std::cmp::Eq;
-use std::collections::{BTreeMap, HashMap};
-use std::hash::Hash;
-use std::iter::IntoIterator;
-use std::iter::Peekable;
-
-// Third party
+use crate::{errors::Error, Result};
use serde::Serialize;
-use serde_json::{self, map::Map, Value};
+use serde_derive::Serialize;
+use serde_json::{self, json, map::Map, Value};
+use std::{
+ cmp::Eq,
+ collections::{BTreeMap, HashMap},
+ hash::Hash,
+ iter::{IntoIterator, Peekable},
+};
use url::form_urlencoded;
-// Ours
-use errors::Error;
-use Result;
-
#[derive(Default)]
pub struct PullOptions {
params: HashMap<&'static str, String>,
diff --git a/src/errors.rs b/src/errors.rs
index 8392971..f363ffd 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -3,10 +3,7 @@
use http;
use hyper::{self, StatusCode};
use serde_json::Error as SerdeError;
-use std::error::Error as StdError;
-use std::fmt;
-use std::io::Error as IoError;
-use std::string::FromUtf8Error;
+use std::{error::Error as StdError, fmt, io::Error as IoError, string::FromUtf8Error};
#[derive(Debug)]
pub enum Error {
diff --git a/src/lib.rs b/src/lib.rs
index 11a4653..1b36404 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,9 +3,6 @@
//! # examples
//!
//! ```no_run
-//! extern crate shiplift;
-//! extern crate tokio;
-//!
//! use tokio::prelude::Future;
//!
//! let docker = shiplift::Docker::new();
@@ -19,30 +16,6 @@
//! tokio::run(fut);
//! ```
-#[macro_use]
-extern crate log;
-extern crate byteorder;
-extern crate bytes;
-extern crate flate2;
-extern crate futures;
-extern crate http;
-extern crate hyper;
-extern crate hyper_openssl;
-#[cfg(feature = "unix-socket")]
-extern crate hyperlocal;
-extern crate mime;
-extern crate openssl;
-extern crate tar;
-extern crate url;
-#[macro_use]
-extern crate serde_derive;
-extern crate serde;
-#[macro_use]
-extern crate serde_json;
-extern crate tokio;
-extern crate tokio_codec;
-extern crate tokio_io;
-
pub mod builder;
pub mod errors;
pub mod read;
@@ -52,37 +25,36 @@ pub mod tty;
mod tarball;
-pub use builder::{
- BuildOptions, ContainerConnectionOptions, ContainerFilter, ContainerListOptions,
- ContainerOptions, EventsOptions, ExecContainerOptions, ImageFilter, ImageListOptions,
- LogsOptions, NetworkCreateOptions, NetworkListOptions, PullOptions, RmContainerOptions,
- VolumeCreateOptions,
+pub use crate::{
+ builder::{
+ BuildOptions, ContainerConnectionOptions, ContainerFilter, ContainerListOptions,
+ ContainerOptions, EventsOptions, ExecContainerOptions, ImageFilter, ImageListOptions,
+ LogsOptions, NetworkCreateOptions, NetworkListOptions, PullOptions, RmContainerOptions,
+ VolumeCreateOptions,
+ },
+ errors::Error,
+};
+use crate::{
+ read::StreamReader,
+ rep::{
+ Change, Container as ContainerRep, ContainerCreateInfo, ContainerDetails, Event, Exit,
+ History, Image as ImageRep, ImageDetails, Info, NetworkCreateInfo,
+ NetworkDetails as NetworkInfo, SearchResult, Stats, Status, Top, Version,
+ Volume as VolumeRep, VolumeCreateInfo, Volumes as VolumesRep,
+ },
+ transport::{tar, Transport},
+ tty::TtyDecoder,
};
-pub use errors::Error;
use futures::{future::Either, Future, IntoFuture, Stream};
-use hyper::client::HttpConnector;
-use hyper::Body;
-use hyper::{Client, Method, Uri};
+use hyper::{client::HttpConnector, Body, Client, Method, Uri};
use hyper_openssl::HttpsConnector;
#[cfg(feature = "unix-socket")]
use hyperlocal::UnixConnector;
use mime::Mime;
use openssl::ssl::{SslConnector, SslFiletype, SslMethod};
-use read::StreamReader;
-use rep::{
- Change, Container as ContainerRep, ContainerCreateInfo, ContainerDetails, Event, Exit, History,
- Image as ImageRep, ImageDetails, Info, NetworkCreateInfo, NetworkDetails as NetworkInfo,
- SearchResult, Stats, Status, Top, Version, Volume as VolumeRep, VolumeCreateInfo,
- Volumes as VolumesRep,
-};
use serde_json::Value;
-use std::borrow::Cow;
-use std::env;
-use std::path::Path;
-use std::time::Duration;
+use std::{borrow::Cow, env, path::Path, time::Duration};
use tokio_codec::{FramedRead, LinesCodec};
-use transport::{tar, Transport};
-use tty::TtyDecoder;
use url::form_urlencoded;
/// Represents the result of all docker operations
@@ -769,7 +741,7 @@ impl<'a, 'b> Volume<'a, 'b> {
}
}
-// https://docs.docker.com/reference/api/docker_remote_api_v1.17/
+// https://docs.docker.com/reference/api/
impl Docker {
/// constructs a new Docker instance for a docker host listening at a url specified by an env var `DOCKER_HOST`,
/// falling back on unix:///var/run/docker.sock
diff --git a/src/read.rs b/src/read.rs
index 847ee21..b9dc5ef 100644
--- a/src/read.rs
+++ b/src/read.rs
@@ -1,8 +1,10 @@
-use errors::Error;
+use crate::errors::Error;
use futures::{Async, Stream};
use hyper::Chunk;
-use std::cmp;
-use std::io::{self, Read};
+use std::{
+ cmp,
+ io::{self, Read},
+};
use tokio_io::AsyncRead;
/*
diff --git a/src/rep.rs b/src/rep.rs
index 5317d83..097ae9e 100644
--- a/src/rep.rs
+++ b/src/rep.rs
@@ -1,5 +1,6 @@
//! Rust representations of docker json structures
+use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Clone, Debug, Serialize, Deserialize)]
diff --git a/src/tarball.rs b/src/tarball.rs
index acbe47a..06a0362 100644
--- a/src/tarball.rs
+++ b/src/tarball.rs
@@ -1,8 +1,9 @@
-use flate2::write::GzEncoder;
-use flate2::Compression;
-use std::fs::{self, File};
-use std::io::{self, Write};
-use std::path::{Path, MAIN_SEPARATOR};
+use flate2::{write::GzEncoder, Compression};
+use std::{
+ fs::{self, File},
+ io::{self, Write},
+ path::{Path, MAIN_SEPARATOR},
+};
use tar::Builder;
// todo: this is pretty involved. (re)factor this into its own crate
diff --git a/src/transport.rs b/src/transport.rs
index 41d8694..432c5df 100644
--- a/src/transport.rs
+++ b/src/transport.rs
@@ -1,6 +1,6 @@
//! Transports for communicating with the docker daemon
-use self::super::{Error, Result};
+use crate::{Error, Result};
use futures::{
future::{self, Either},
Future, IntoFuture, Stream,
@@ -14,7 +14,9 @@ use hyper_openssl::HttpsConnector;
use hyperlocal::UnixConnector;
#[cfg(feature = "unix-socket")]
use hyperlocal::Uri as DomainUri;
+use log::debug;
use mime::Mime;
+use serde_derive::{Deserialize, Serialize};
use serde_json;
use std::fmt;
use tokio_io::{AsyncRead, AsyncWrite};
@@ -226,12 +228,12 @@ impl Transport {
method: Method,
endpoint: &str,
body: Option<(B, Mime)>,
- ) -> impl Future<Item = ::tty::Multiplexed, Error = Error>
+ ) -> impl Future<Item = crate::tty::Multiplexed, Error = Error>
where
B: Into<Body> + 'static,
{
self.stream_upgrade(method, endpoint, body)
- .map(|u| ::tty::Multiplexed::new(u))
+ .map(|u| crate::tty::Multiplexed::new(u))
}
/// Extract the error message content from an HTTP response that
diff --git a/src/tty.rs b/src/tty.rs
index c30a038..038fde0 100644
--- a/src/tty.rs
+++ b/src/tty.rs
@@ -1,12 +1,11 @@
+use crate::errors::Error;
use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
use bytes::BytesMut;
-use errors::Error;
-use std::io::Cursor;
-use tokio_codec::Decoder;
-
use futures::{self, Async};
use hyper::rt::{Future, Stream};
-use std::io;
+use log::trace;
+use std::io::{self, Cursor};
+use tokio_codec::Decoder;
use tokio_io::{AsyncRead, AsyncWrite};
#[derive(Debug)]
@@ -25,12 +24,12 @@ pub enum StreamType {
/// A multiplexed stream.
pub struct Multiplexed {
stdin: Box<AsyncWrite>,
- chunks: Box<futures::Stream<Item = Chunk, Error = ::Error>>,
+ chunks: Box<futures::Stream<Item = Chunk, Error = crate::Error>>,
}
pub struct MultiplexedBlocking {
stdin: Box<AsyncWrite>,
- chunks: Box<Iterator<Item = Result<Chunk, ::Error>>>,
+ chunks: Box<Iterator<Item = Result<Chunk, crate::Error>>>,
}
/// Represent the current state of the decoding of a TTY frame
@@ -164,17 +163,17 @@ impl Multiplexed {
impl futures::Stream for Multiplexed {
type Item = Chunk;
- type Error = ::Error;
+ type Error = crate::Error;
- fn poll(&mut self) -> Result<Async<Option<Chunk>>, ::Error> {
+ fn poll(&mut self) -> Result<Async<Option<Chunk>>, crate::Error> {
self.chunks.poll()
}
}
impl Iterator for MultiplexedBlocking {
- type Item = Result<Chunk, ::Error>;
+ type Item = Result<Chunk, crate::Error>;
- fn next(&mut self) -> Option<Result<Chunk, ::Error>> {
+ fn next(&mut self) -> Option<Result<Chunk, crate::Error>> {
self.chunks.next()
}
}
@@ -199,7 +198,7 @@ macro_rules! delegate_io_write {
delegate_io_write!(Multiplexed);
delegate_io_write!(MultiplexedBlocking);
-pub fn chunks<S>(stream: S) -> impl futures::Stream<Item = Chunk, Error = ::Error>
+pub fn chunks<S>(stream: S) -> impl futures::Stream<Item = Chunk, Error = crate::Error>
where
S: AsyncRead,
{
@@ -227,7 +226,7 @@ where
});
util::stop_on_err(stream, |e| e.kind() != io::ErrorKind::UnexpectedEof)
- .map_err(|e| ::Error::from(e))
+ .map_err(|e| crate::Error::from(e))
}
mod util {