Compare commits

...

16 Commits

Author SHA1 Message Date
jethrogb 0320cb152d
Update README.md 2023-03-20 21:36:35 +01:00
jethrogb 8b554e1c80
Merge pull request #34 from jethrogb/20210325
Update to 2021-03-25
2021-03-30 17:57:13 +02:00
Jethro Beekman 0f4e3dff08 Update to 2021-03-25 2021-03-30 17:56:22 +02:00
bors[bot] 2c0030ac9a Merge #28
28: Update to 2019-07-01 r=jethrogb a=jethrogb

bors r+

Co-authored-by: Jethro Beekman <jethro@fortanix.com>
2019-07-01 16:08:33 +00:00
Jethro Beekman 8ac2f7afd1 Update to 2019-07-01 2019-07-01 09:07:40 -07:00
bors[bot] 3c16015737 Merge #26
26: Fix vectored I/O r=jethrogb a=parasyte

This is a large PR because I recreated all patches from #18. Contains the following fixes:

- `ioVec` does not depend on `feature="collections"`
- Fix `impl Read for Take`; only `read_to_end` requires `feature="collections"`
- Fix some whitespace consistency issues

Closes #19

Co-authored-by: Jay Oster <jay@pubnub.com>
2019-06-13 06:32:50 +00:00
Jay Oster ede518c151 Recreate patches for `ioVec`
- `ioVec` does not depend on `feature="collections"`
- Fix `impl Read for Take`; only `read_to_end` requires `feature="collections"`
- Fix some whitespace consistency issues

Closes #19
2019-06-07 00:17:36 -07:00
bors[bot] dc39fb482c Merge #25
25: Fix features since nightly-2018-08-14 disallowed old features r=jethrogb a=parasyte

Fixes #20 

Co-authored-by: Jay Oster <jay@pubnub.com>
Co-authored-by: Jay Oster <jay@kodewerx.org>
2019-06-07 05:40:32 +00:00
Jay Oster f390668381 Address review comments 2019-06-06 19:46:25 -07:00
Jay Oster 84b617b1ea Fix features since nightly-2018-08-14 disallowed old features 2019-05-14 18:15:20 -07:00
jethrogb 8e09f8c5da
Merge pull request #17 from parasyte/fix/macos
Fix shell script compatibility with macOS
2019-04-30 18:57:15 -07:00
Jay Oster de8b72efde Address review comments 2019-04-30 18:55:16 -07:00
jethrogb 4bab33bd4c
Merge pull request #24 from jethrogb/dry-conditional-cfg
Be more DRY with conditional cfgs in build.rs
2019-04-30 18:53:41 -07:00
Jethro Beekman 29b012608c Be more DRY with conditional cfgs in build.rs 2019-04-30 18:43:40 -07:00
jethrogb 83eeab3405
Merge pull request #23 from jethrogb/fix-old-versions
Parse mapping.rs manually, fix CI versions.
2019-04-30 18:39:00 -07:00
Jay Oster ca725a1cb5 Additional macOS fixes 2019-04-27 12:56:47 -07:00
144 changed files with 186340 additions and 3722 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "core_io" name = "core_io"
version = "0.1.20190427" version = "0.1.20210325"
authors = ["The Rust Project Developers", "Jethro Beekman"] authors = ["The Rust Project Developers", "Jethro Beekman"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
description = """ description = """

View File

@ -1,3 +1,7 @@
# INTENT TO ARCHIVE
This repository will be archived in the near future. Discussion at https://github.com/jethrogb/rust-core_io/issues/38
# core_io # core_io
[![Build Status](https://travis-ci.com/jethrogb/rust-core_io.svg?branch=master)](https://travis-ci.com/jethrogb/rust-core_io) [![Build Status](https://travis-ci.com/jethrogb/rust-core_io.svg?branch=master)](https://travis-ci.com/jethrogb/rust-core_io)

View File

@ -4,7 +4,7 @@
# commit-db.rb list-valid nightly|GIT_DIR=/your/rust/dir/.git ./build-src.sh # commit-db.rb list-valid nightly|GIT_DIR=/your/rust/dir/.git ./build-src.sh
if [ $(uname) == 'Darwin' ]; then if [ $(uname) == 'Darwin' ]; then
alias tac='tail -f' alias tac='tail -r'
fi fi
prompt_changes() { prompt_changes() {
@ -68,12 +68,4 @@ for IO_COMMIT in $OLD_COMMITS $(git_commits_ordered %H $NEW_COMMITS|tac); do
fi fi
done done
if [ $(uname) == 'Darwin' ]; then cargo ${1:-package} --allow-dirty
OLD_GIT_PERM=$(stat -f %Op .git)
else
OLD_GIT_PERM=$(stat --printf=%a .git)
fi
trap "chmod $OLD_GIT_PERM .git; exit 1" SIGINT
chmod 000 .git
cargo ${1:-package}
chmod $OLD_GIT_PERM .git

View File

@ -12,7 +12,7 @@ fn parse_mappings(mut mappings: &'static str) -> Vec<Mapping> {
// is why it's kind of weird. It should be changed to a saner format. // is why it's kind of weird. It should be changed to a saner format.
const P1: &'static str = r#"-Mapping(""#; const P1: &'static str = r#"-Mapping(""#;
const P2: &'static str = r#"",""#; ; const P2: &'static str = r#"",""#;
const P3: &'static str = "\")\n"; const P3: &'static str = "\")\n";
trait TakePrefix: Sized { trait TakePrefix: Sized {
@ -45,6 +45,21 @@ fn parse_mappings(mut mappings: &'static str) -> Vec<Mapping> {
result result
} }
type Cfg = Option<&'static str>;
type Date = &'static str;
/// A `ConditionalCfg` is basically a list of optional feature names
/// (`Cfg`s) separated by `Date`s. The dates specify ranges of compiler
/// versions for which to enable particular features.
type ConditionalCfg = (Cfg, &'static [(Date, Cfg)]);
const CONDITIONAL_CFGS: &'static [ConditionalCfg] = &[
(None, &[("2019-02-24", Some("pattern_guards"))]),
(None, &[("2018-08-14", Some("non_exhaustive"))]),
(Some("unicode"), &[("2018-08-13", None)]),
(None, &[("2018-01-01", Some("core_memchr"))]),
(None, &[("2017-06-15", Some("no_collections"))]),
(Some("rustc_unicode"), &[("2016-12-15", Some("std_unicode")), ("2017-03-03", None)]),
];
fn main() { fn main() {
let ver=rustc_version::version_meta(); let ver=rustc_version::version_meta();
@ -59,18 +74,17 @@ fn main() {
} }
}; };
if ver.commit_date.as_ref().map_or(false,|d| &**d>="2018-01-01") { for &(mut curcfg, rest) in CONDITIONAL_CFGS {
println!("cargo:rustc-cfg=core_memchr"); for &(date, nextcfg) in rest {
} // if no commit_date is provided, assume compiler is current
if ver.commit_date.as_ref().map_or(false,|d| &**d<date) {
if ver.commit_date.as_ref().map_or(false,|d| &**d>="2017-06-15") { break;
println!("cargo:rustc-cfg=no_collections"); }
} curcfg = nextcfg;
}
if ver.commit_date.as_ref().map_or(false,|d| &**d<"2016-12-15") { if let Some(cfg) = curcfg {
println!("cargo:rustc-cfg=rustc_unicode"); println!("cargo:rustc-cfg={}", cfg);
} else if ver.commit_date.as_ref().map_or(false,|d| &**d<"2017-03-03") { }
println!("cargo:rustc-cfg=std_unicode");
} }
let mut dest_path=PathBuf::from(env::var_os("OUT_DIR").unwrap()); let mut dest_path=PathBuf::from(env::var_os("OUT_DIR").unwrap());

4
ct.sh
View File

@ -18,7 +18,9 @@ RUST_VERSIONS=$(awk '{print $1}' <<EOF
nightly-2018-03-07 # core_io release nightly-2018-03-07 # core_io release
nightly-2018-08-06 # edge case: old features allowed nightly-2018-08-06 # edge case: old features allowed
nightly-2018-08-14 # edge case: old features disallowed nightly-2018-08-14 # edge case: old features disallowed
nightly-2019-04-27 # core_io release nightly-2018-08-15 # edge case: non_exhaustive feature
nightly-2019-02-25 # edge case: bind_by_move_pattern_guards feature
nightly-2019-07-01 # core_io release
EOF EOF
) )

View File

@ -5,7 +5,7 @@
prompt_changes() { prompt_changes() {
bold_arrow; echo "Editing $IO_COMMIT" bold_arrow; echo "Editing $IO_COMMIT"
bold_arrow; echo -e "Remember to test your changes with: \e[1;36mcargo build\e[0m" bold_arrow; echo -e "Remember to test your changes with: \033[1;36mcargo build\033[0m"
local MAIN_GIT_DIR="$GIT_DIR" local MAIN_GIT_DIR="$GIT_DIR"
local GIT_DIR=./.git CORE_IO_COMMIT=$IO_COMMIT local GIT_DIR=./.git CORE_IO_COMMIT=$IO_COMMIT
@ -18,13 +18,14 @@ prompt_changes() {
patch -s -p1 < $PATCH_DIR/$IO_COMMIT.patch patch -s -p1 < $PATCH_DIR/$IO_COMMIT.patch
git commit -a -m "existing patch for $IO_COMMIT" > /dev/null git commit -a -m "existing patch for $IO_COMMIT" > /dev/null
bold_arrow; echo -e "Applying patch from \e[1;36m$TMP_PATCH\e[0m" bold_arrow; echo -e "Applying patch from \033[1;36m$TMP_PATCH\033[0m"
patch -p1 < $TMP_PATCH || true patch -p1 < $TMP_PATCH || true
bold_arrow; echo -e "Make your changes now (\e[1;36mctrl-D\e[0m when finished)" bold_arrow; echo -e "Make your changes now (\033[1;36mctrl-D\033[0m when finished)"
bash_diff_loop "No changes were made" bash_diff_loop "No changes were made"
bold_arrow; echo "Replacing $IO_COMMIT.patch with updated version" bold_arrow; echo "Replacing $IO_COMMIT.patch with updated version"
git diff > $TMP_PATCH git diff > $TMP_PATCH
git clean -f -x git clean -f -x
git reset -q HEAD~
git diff > $PATCH_DIR/$IO_COMMIT.patch git diff > $PATCH_DIR/$IO_COMMIT.patch
rm -rf .git rm -rf .git
} }

View File

@ -26,7 +26,7 @@ echo_lines() {
get_io_commits() { get_io_commits() {
for COMPILER_COMMIT in $COMPILER_COMMITS; do for COMPILER_COMMIT in $COMPILER_COMMITS; do
IO_COMMIT=$(git log -n1 --pretty=format:%H $COMPILER_COMMIT -- src/libstd/io) IO_COMMIT=$(git log -n1 --pretty=format:%H $COMPILER_COMMIT -- src/libstd/io library/std/src/io)
if ! grep -q $COMPILER_COMMIT mapping.rs; then if ! grep -q $COMPILER_COMMIT mapping.rs; then
echo "-Mapping(\"$COMPILER_COMMIT\",\"$IO_COMMIT\")" >> mapping.rs echo "-Mapping(\"$COMPILER_COMMIT\",\"$IO_COMMIT\")" >> mapping.rs
fi fi
@ -35,13 +35,19 @@ get_io_commits() {
} }
get_patch_commits() { get_patch_commits() {
find $PATCH_DIR -type f|xargs -n 1 basename|cut -d. -f1 find $PATCH_DIR -type f -print0|xargs -0 -n 1 basename|cut -d. -f1
} }
prepare_version() { prepare_version() {
mkdir src/$IO_COMMIT mkdir src/$IO_COMMIT
git_extract src/libstd/io/ if git_file_exists library/std/src/io/mod.rs; then
if git_file_exists src/libcore/slice/memchr.rs; then git_extract library/std/src/io/
else
git_extract src/libstd/io/
fi
if git_file_exists library/core/src/slice/memchr.rs; then
true
elif git_file_exists src/libcore/slice/memchr.rs; then
true true
elif git_file_exists src/libstd/sys_common/memchr.rs; then elif git_file_exists src/libstd/sys_common/memchr.rs; then
git_extract src/libstd/sys_common/memchr.rs git_extract src/libstd/sys_common/memchr.rs
@ -84,6 +90,6 @@ bash_diff_loop() {
;; ;;
esac esac
done done
bash <> /dev/stderr bash --rcfile <(custom_bashrc) <> /dev/stderr
done done
} }

View File

@ -935,3 +935,696 @@
-Mapping("1fa944914c092d728c8307e976a4b447df25bf16","ea505fd60b09bbfb127c874a27abac52d44bfe00") -Mapping("1fa944914c092d728c8307e976a4b447df25bf16","ea505fd60b09bbfb127c874a27abac52d44bfe00")
-Mapping("7e001e5c6c7c090b41416a57d4be412ed3ccd937","115c8a1f095f99dab82da7ab1276c64747ed8fcc") -Mapping("7e001e5c6c7c090b41416a57d4be412ed3ccd937","115c8a1f095f99dab82da7ab1276c64747ed8fcc")
-Mapping("7219130677c4fe4310c9729cbc0b4c6e9c9b42fc","71120ef1e5cb885ee45e6148970db6ce93ce1aca") -Mapping("7219130677c4fe4310c9729cbc0b4c6e9c9b42fc","71120ef1e5cb885ee45e6148970db6ce93ce1aca")
-Mapping("5d8f59f4b1473217c2de7e02330b5aaae70a1668","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("37d001e4deb206ed954fde5d91690221e8306fc3","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("02564de47b40e953b5144dfd37450c16a84672f1","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("627486af15d222bcba336b12ea92a05237cc9ab1","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("a19cf18c7dbbcc46dddea81df3a4cee1735c2349","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("d3e2cec29225a46298ec4ebf082f34ebd7cfeecf","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("433a46781544da61801400316e7e546f01b81952","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("9a90d03ad171856dc016c2dcc19292ec49a8a26f","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("400b409efc4975a082185c5a74412572e49dfd98","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("08bfe16129b0621bc90184f8704523d4929695ef","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("dec4c5201f88efbc3020b04ba96a5ee2c3b6cfcd","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("272000c94edda10d3ccd7042d2b9914c2c974f29","be12ab070d733303355d433d68efb870e3da753b")
-Mapping("938d4ffe16c4430e1dcede570b06227114cb73d5","be12ab070d733303355d433d68efb870e3da753b")
-Mapping("cfdc84a009020c59e53e4039beae22eb59e41685","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("50a0defd5a93523067ef239936cc2e0755220904","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("8dd4aae9a83964cc08505da92d07ec68a3a2341d","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("8869ee03d7f258e1b76a11c6fbb01b5708a9f504","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("2fe7b3383c1e0a8b68f8a809be3ac21006998929","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("8aa42ed7c2adb9f37faa6eb905f890f6199e1db9","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("3f5152e200c0c02dfe0f79367948c98053d35855","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("f492693982d1e252f5411ae3e4d560ab0dfea48a","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("d35181ad8785fa958e43580a29a982afe02c728f","01cf36ebde50521993a61013487059be5f568c19")
-Mapping("a784a80228c9eac3aa0fd86fc90887d5fa20c82e","b9c430129d5971df4410b6c829b100ce8191328e")
-Mapping("721268583759224d0f6476e0b8b196cc8afbdea0","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("372be4f360ce42b1a10126a711189796f8440ab4","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("4443957f272e304e083a8d98583e608d65a712aa","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("04a3dd8a872633ca1e4c217d11f741cc35cb19a5","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("de02101e6d949c4a9040211e9ce8c488a997497e","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("0dc9e9c10ca6dc78cba8b9f9b15038c977b10a77","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("929b48ec98aaff2239257574b5897f419cec2647","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("1d9981f04e8957345205c07adc2742886420ac37","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("5f3656ce9a2212fad872605b7a4ee103a155e9f3","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("d132f544f9d74e3cc047ef211e57eae60b78e5c5","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("af98304b9a006e2f9a367b1f79dd7655f243c150","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("963184bbb670c1ffa97fc28a98cd5e8473118859","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("8ebd67e4ee394cad9441a801f2022724ae7e07db","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("6afcb5628523b0baae5704ad34ac1aba8ba10de6","01cf36ebde50521993a61013487059be5f568c19")
-Mapping("de7c4e42314c56528640e3b663aa10e0caa6bd9b","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("a3404557c54ea48fb8efc805d93c450beb3364d4","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("4edff843dd219cf19a5fede6c78c7ce95402e1f5","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("6ffb8f53ee1cb0903f9df7d2fdb37ad06d748566","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("b25ee644971a168287ee166edbd11642dbcfeab8","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("5f9c0448dde167128d668da4555879f64e56af1d","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("5eeb567a27eba18420a620ca7d0c007e29d8bc0c","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("9b67bd42b7cbf97f72d039afcba02f5177d0d68c","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("991c719a1d0f95c37ed7ea56bdb38bcc2a6246b9","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("73a3a90d25ddb3be3d0ad2238dbb55ae79e459dc","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("3ade426ede7bca4a74bc641a12f2e7fe2cc20c47","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("0e4a56b4b04ea98bb16caada30cb2418dd06e250","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("37ff5d388f8c004ca248adb635f1cc84d347eda0","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("7d5aa43325ad7629766b1183011f5bf5b2a1ea26","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("9606f6fa64926a84d82e3c62dbdc57f5c10f756d","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("7158ed9cbea805adf8161d3deaadba2f85b7692e","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("2887008e0ce0824be4e0e9562c22ea397b165c97","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("03ee55bb1c8c2379fdabf68e306186b390444f61","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("7c71bc3208031b1307573de45a3b3e18fa45787a","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("7840a0b753a065a41999f1fb6028f67d33e3fdd5","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("e70d5386d7abcf39adf54feb43a655c4f8a1bcb6","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("7cdaffd7962c4aae0cadd82baa241901b03f9458","405edc71fd5a5e4a8f936fe08b1465a2b4ad1af4")
-Mapping("5187be620c76a313a19b9b596e1bce3a80a345dd","a34dae35874a5b33fb2895dcf15463f7f4bd9af3")
-Mapping("0af8e872ea5ac77effa59f8d3f8794f12cb8865c","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("a9ec99f4201ec33026a468ef1289f98a95b4d71a","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("00859e3e653973120006aaf3227823062dde1ba7","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("d628c2e642c6f8f85f24dd5d7f49de89b95bf682","ead8d81301c1854e7ec251a57239813f6dfa8001")
-Mapping("d595b113584f8f446957469951fd5d31adc2a44e","bd17b5c9a2215cf8be8b2a361976730320a5f00f")
-Mapping("b9de4ef89e0e53099a084001b26ec3207c5f8391","1b946106b7955d3dcde26719b9b62a5a2c4b78fe")
-Mapping("a1dfd2490a6cb456b92e469fa550dc217e20ad6d","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("7afe6d9d1f48b998cc88fe6f01ba0082788ba4b9","4436c9d35498e7ae3da261f6141d6d73b915e1e8")
-Mapping("56daaf669ebc3d5083db5cded719f780dc31104e","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("e6ec0d125eba4074122b187032474b4174fb9d31","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("3ff10e74a74ed093fcabac1de27fe1cd65bbbb4a","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("c553e8e8812c19809e70523064989e66c5cfd3f1","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("4ad62488258972bdb0e2df225d100f99ef58dbad","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("0a58f5864659ddfe1d95c122abaa75c88220aed0","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("f2bbdd0a3257cc980c934a92c5bf9808cf31728c","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("04caa632dd10c2bf64b69524c7f9c4c30a436877","8a18fb0f7396ceb1ca18cd82ca3deb795f5e60b2")
-Mapping("87cbf0a547aaf9e8a7fc708851ecf4bc2adab5fd","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("fa51f810e5b9254904b92660e7280b7d6a46f112","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("2225ee1b62ff089917434aefd9b2bf509cfa087f","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("2e7244807a7878f6eca3eb7d97ae9b413aa49014","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("3525087ada7018ef227b10846648660b7f07b6d1","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("45b3c28518e4c45dfd12bc2c4400c0d0e9639927","bc5669eef8c1d747e82694547fd57a1400a5afec")
-Mapping("a9c1c04e986dbf610be8cbe6a8107f90b4db61ce","75b27ef59cd0eb95b50d0cde14b05e0079b3ebe9")
-Mapping("0de96d37fbcc54978458c18f5067cd9817669bc8","2fee28e7138d8753487ed8895ce0f5f2e643ffad")
-Mapping("01a46509a4c2dc430ebebf940a26232fdaeeba81","2fee28e7138d8753487ed8895ce0f5f2e643ffad")
-Mapping("eb48d6bdee6c655d71f26594d47d232adf3e4e93","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("6bb3dbfc6c6d8992d08431f320ba296a0c2f7498","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("f455e46eae1a227d735091091144601b467e1565","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("31dd4f4acbcbdb02b0745d2136399ed664a28050","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("50fc24d8a172a853b5dfe40702d6550e3b8562ba","6276c135d185e8492e8a2b9db5ca04e51c3293fa")
-Mapping("a1912f2e89b77cfe2a0e64b96f444848fe4e2d49","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("db0492ace429cfeb3567e2c04e300be7df9972ff","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("17e73e801a75559eac5c932ff07bd9c8499a1364","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("75e1463c52aaea25bd32ed53c73797357e561cce","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("2d8a3b9181f41d3af9b9f016c5d73b2553e344bf","6f4681bacc78a00a63766f12a17560701ab5c1e8")
-Mapping("ed8b708c1a6bf6d94f860eeb6a6b0b442c380d7f","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("5fa22fe6f821ac3801d05f624b123dda25fde32c","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("a9cd294cf2775441e713c7ee2918b728733b99f5","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("0ca7f74dbd23a3e8ec491cd3438f490a3ac22741","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("e599b53e67ddd197a09a3d8720eed872df481aa0","65bdf79da3f72269e6fe7aac1355df1420613889")
-Mapping("a2f8f6281817d430e20726128b739d3c6708561c","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("7750c3d46bc19784adb1ee6e37a5ec7e4cd7e772","6276c135d185e8492e8a2b9db5ca04e51c3293fa")
-Mapping("c43d03a19f326f4a323569328cc501e86eb6d22e","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("95b1fe560d2bd8472f250fb8cfd2168520a58405","04f0d309dcbaa8425c702d1439592b87fff0a69e")
-Mapping("8aa18cbdc5d4bc33bd61e2d9a4b643d87f5d21de","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("9b4154193e8471f36b1a9e781f1ef7d492fc6a6c","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("9778068cbc1e06cc3685422323ff38a2f397de26","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("bad3bf622bded50a97c0a54e29350eada2a3a169","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("26438b473883ea607b30288e461187f0fb2fe589","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("52fa23add6fb0776b32cc591ac928618391bdf41","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("890881f8f4c77e8670d4b32104c0325fcfefc90f","b94e59cc41f8eeb36ee269cae3275d7620189c14")
-Mapping("2f517ce6f28b5d638cce4c1eccdbe63255b11420","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("c23a7aa778b0dfeffbf83b099bdf971242c1e1ac","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("d8bdb3fdcbd88eb16e1a6669236122c41ed2aed3","4436c9d35498e7ae3da261f6141d6d73b915e1e8")
-Mapping("285fc7d704fcdd7b2a37d475d04d5d955490e000","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("fe10f1a49f5ca46e57261b95f46f519523f418fe","d8cc2c1e4f8fa6bd49fe9c395353f9e24c7b51fc")
-Mapping("9ed29b6ff6aa2e048b09c27af8f62ee3040bdb37","9bb2a50e04460fff646830502d575b82dbf17055")
-Mapping("ae1b871cca56613b1af1a5121dd24ac810ff4b89","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("7ebd87a7a1e0e21767422e115c9455ef6e6d4bee","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("593fe977a77ad5a7aec23c6cb0f86a3470221670","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("a85e94927622665a9e9022de0d33a890a2e32d43","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("e620d0f337d0643c757bab791fc7d88d63217704","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("2111aed0a38c819acb140c7153e9366964a37f2f","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("4295eea903a9e1014ee30f82930f5ec08d888077","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("20fc02f836f3035b86b56a7cedb97c5cd4ed9612","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("caa231d998a5e853c7ba1455d7a05b500df9d63c","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("6fd8798f4de63328d743eb2a9a9c12e202a4a182","b3e0d272af149c4126f90a0262d796d7401ba7a1")
-Mapping("0148b971c921a0831fbf3357e5936eec724e3566","250eeb4c3c00b7831226cf5266aacb5fca1e13f3")
-Mapping("45ebd5808afd3df7ba842797c0fcd4447ddf30fb","5d90154886039ddbd7c1b8bf4cc273b774b14ec7")
-Mapping("05762e3d6f5facafdd47efdf4203021fadf61bb1","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("99111606fcda4fdb0646e4f7ee0f6cbcb76fb84a","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("349b3b324dade7ca638091db93ba08bbc443c63d","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("74e80468347471779be6060d8d7d6d04e98e467f","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("c798dffac9dc8c82374db48f5b474690cc6e9686","b94e59cc41f8eeb36ee269cae3275d7620189c14")
-Mapping("61f5a0092364061ec5649ca98d5e3e9b927880fe","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("f3c9cece7b6829e6fd7854a1aee6a1619a81a38c","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("a37c32e2d5fb186627ffe99a391c7fd6fd159334","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("85976442558bf2d09cec3aa49c9c9ba86fb15c1f","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("d79f1bd31a1401b5d08096fcdf9a9eb23ddf95df","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("81e754c359c471f91263813c46c67955071716a7","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("cdc8f0606d0f3c4f3866643382c8a5776d1bdaed","0af3bd01dfae488392dc6f08daa2d0d8d370fb00")
-Mapping("14061868b3960d8a68a079bd276dde85936970ac","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("dbf8b6bf116c7bece2987ff4bd2792f008a6ee77","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("14b15521c52549ebbb113173b4abecd124b5a823","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("2987785df3d46d5ff144a5c67fbb8f5cca798d78","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("58b834344fc7b9185e7a50db1ff24e5eb07dae5e","c9290dceee2cb6b882b26ec6e294560e51ef0853")
-Mapping("b122908617436af187252572ed5db96850551380","8a18fb0f7396ceb1ca18cd82ca3deb795f5e60b2")
-Mapping("13db6501c7273cd1997ce20e15106f362e5613c4","9bb2a50e04460fff646830502d575b82dbf17055")
-Mapping("35dbef235048f9a2939dc20effe083ca483c37ff","bc5669eef8c1d747e82694547fd57a1400a5afec")
-Mapping("346aec9b02f3c74f3fce97fd6bda24709d220e49","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("bbb664a99c0188fa756cbbb3a6c4e5d8825c372b","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("1721c9685b1ee69f1e17b3a8b09145b10fdfbe4a","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("98d66340d6e63eda115afc8b0da1d87965881936","30e49a9ead550551e879af64ba91a0316da1c422")
-Mapping("15812785344d913d779d9738fe3cca8de56f71d5","61150353bf9cc415f4554a9b4851c14e4255329f")
-Mapping("74c4e6a981d3150db8444c8d250e50bbe6b93b6b","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("6af1bdda54abc9e919fc1137411dfc4311e05649","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("46e85b4328fe18492894093c1092dfe509df4370","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("576d27c5a6c80cd39ef57d7398831d8e177573cc","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("fe1bf8e05c39bdcc73fc09e246b7209444e389bc","c26a8bbd6d0e7bbfa2891934a1af2934cab3b6bb")
-Mapping("5c5c8eb864e56ce905742b8e97df5506bba6aeef","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("043f6d747c15068f0053a0542e9b0f17ae7f4de4","65bdf79da3f72269e6fe7aac1355df1420613889")
-Mapping("bc1571cc3cfef07251f7df52b95525aa16797ca2","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("618768492f0c731fcb770dc2d178abe840846419","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("fba38ac27e2ade309f4c2504a6d6cd3556972a28","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("6470169237833d02c399568a375d9b47cbfaeccc","5d8fe1c4e6b214916de690ee25c17f862e166a28")
-Mapping("699f83f525c985000c1f70bf85117ba383adde87","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("16957bd4d3a5377263f76ed74c572aad8e4b7e59","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("fc5deca2143a448d10a1241a777275e59448c94d","2fee28e7138d8753487ed8895ce0f5f2e643ffad")
-Mapping("bb178237c5539c75e1b85ab78a8ab902b1f333d5","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("31530e5d132ebcc3654baf2e5460599681520af0","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("d1e81ef234ff5c2e0e3a69cb4e8e5f5b0fe1fd83","39c52225dd06ab06ef75ef97841c66c7d9b6e56c")
-Mapping("0b644e419681835bd0f5871c3bfbd648aa04f157","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("4f7612ac1499258025077f1fd05d2f429f9accfb","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("6e310f2abae97323ca1d5469657b83aa1a9407e0","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("1d0d76f8dd4f5f6ecbeab575b87edaf1c9f56bb8","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("673d0db5e393e9c64897005b470bfeb6d5aec61b","db4a97c4cbcb160b3754c803284dd0110d1de1e4")
-Mapping("488381ce9ef0ceabe83b73127c659e5d38137df0","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("130359cb05246fcacdde61baa2613419ef6570c7","d9cd4a33f53689bc0847775669a14f666a138fd7")
-Mapping("18c275b423f9f13c0e404ae3804967d2ab66337c","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("a08c47310c7d49cbdc5d7afb38408ba519967ecd","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("30f0a07684f6c1f5df62d69e9519d82e13d6bf2d","a7749fe451c37ec192b282ec7303b9809b49df93")
-Mapping("7870050796e5904a0fc85ecbe6fa6dde1cfe0c91","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("215f2d3294b08dbdcf8f7d40de21ef1e7eae0a2d","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("72da5a9d85a522b11e80d0fdd1fd95247d442604","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("acca818928654807ed3bc1ce0e97df118f8716c8","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("c2d141df59703393c0c683abc259f9a8c3be041a","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("0aa6751c19d3ba80df5b0b02c00bf44e13c97e80","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("25f6938da459a57b43bdf16ed6bdad3225b2a3ce","77f333b304424ae63dc70e10c6676dd645230f94")
-Mapping("397b390cc76ba1d98f80b2a24a371f708dcc9169","6f4681bacc78a00a63766f12a17560701ab5c1e8")
-Mapping("d6e4028a0db6b13d9a603baad109d6c902802c03","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("2890b37b861247de3b8c6ba2ecbcd00048c728a1","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("2753fab7ce3647033146b07c8b6c9f4856a910b0","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("7cdbc87a49b0b705a41a004a6d486b0952521ae7","5d90154886039ddbd7c1b8bf4cc273b774b14ec7")
-Mapping("4fb54ed484e2239a3e9eff3be17df00d2a162be3","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("9912925c254589f58338cb2993163e618475ff75","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("6e0d27d9368e2982bef8e1c4ac14d622c5ad018e","9ff52752d855722c55dbc71d9b22bd42eabfc468")
-Mapping("3291ae33907f2a866ea6cea89113200555038d06","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("5180f3da5fd72627a8d38558ad1297df38793acd","78e094632ec6160c3d2cfaad777c16a27ce08609")
-Mapping("43a5ff4222e1f217ac14331afd59f82ec4204d12","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("bdfd698f37184da42254a03ed466ab1f90e6fb6c","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("6d69caba110c0c2fb90180df1cbc8be5033b91d4","b3e0d272af149c4126f90a0262d796d7401ba7a1")
-Mapping("4a20eb6a9da36c88ee929826c4f1eb8d7ea393b2","7d6af6751c5726d884440d4e8d462a9ee6c5efc1")
-Mapping("8417d68de5e063426ab6bb7f383df6117d1beeed","9bb2a50e04460fff646830502d575b82dbf17055")
-Mapping("0c03aee8b81185d65b5821518661c30ecdb42de5","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("8431f261dd160021b6af85916f161a13dd101ca0","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("084beb83e0e87d673d5fabc844d28e8e8ae2ab4c","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("1f5bc176b0e54a8e464704adcd7e571700207fe9","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("760226733e940cb375f791e894fbb554555eeb01","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("76b11980ad416c3ad6143504c2277757ecacf9b5","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("a6946a817a1345ce739acd8b12255c0a595e9b39","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("d3f8a0b5dfddfe443d9db1f1da18348dbceb0e47","9ff52752d855722c55dbc71d9b22bd42eabfc468")
-Mapping("ca3766e2e58f462a20922e42c821a37eaf0e13db","a8c5f90b06c9bf2bfa2c2f4aedd7c395cb92195d")
-Mapping("ffa2e7ae8fbf9badc035740db949b9dae271c29f","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("fa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("f844ea1e561475e6023282ef167e76bc973773ef","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("76a252ea9e7be93a61ffdf33b3533e24a9cf459d","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("f74583445702e2e27ec4415376f2c540a83d7ded","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("4d0dd02ee07bddad9136f95c9f7846ebf3eb3fc5","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("1572c433eed495d0ade41511ae106b180e02851d","5d90154886039ddbd7c1b8bf4cc273b774b14ec7")
-Mapping("dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("32c654a9795b0d88541e56ba9da4150e34f1d5f9","dad8e11e9fcbd76c0a2dc47211dcd654effed010")
-Mapping("a8cf3991177f30694200002cd9479ffbbe6d9a1a","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("f781babf87dea29c44f93842b7ac9eb809549d29","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("0262de554b4c4c5af346137bbb1664a3f6cf4df2","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("3ed3b8bb7b100afecf7d5f52eafbb70fec27f537","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("ddf43867a9cbb3766b48552632a602498fae2699","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("234781afe33d3f339b002f85f948046d8476cfc9","68f2934a154abac9a2af72c55e4c08277172e087")
-Mapping("0e8a4b441c5da21a2cb19448728ade5baa299c66","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("c609b2eaf323186a1167ec1a9ffa69a7d4a5b1b9","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("564758c4c329e89722454dd2fbb35f1ac0b8b47c","83980aca2086e5c4dca5aae9a92a065a9ff4ac56")
-Mapping("3a3f4a7cbaff09722b8c7cc8f09ce86ff5f953a3","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("91fd6283e658e2c7aab2d3f5206fc1891f486af2","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("5e65467eff3d1da4712586d8402d1d2e1d6654bc","a42e62fa0a59d0ba620889f97513929a113a6fbd")
-Mapping("b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("f0b58fcf03391a91f74224fe38a696d5a5b789d9","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("3dbade652ed8ebac70f903e01f51cd92c4e4302c","83980aca2086e5c4dca5aae9a92a065a9ff4ac56")
-Mapping("d8cbd9caca648ecdb66ff4c945c060762aa6297f","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("7dbfb0a8ca4ab74ee3111e57a024f9e6257ce37c","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("e2267046859c9ceb932abc983561d53a117089f6","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("27d6f55f47e8875e71083a28ed84ea5a88e1b596","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("5be3f9f10e9fd59ea03816840a6051413fbdefae","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("3e0a1c09108b52e41113520c7fa516480a8b67f9","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("158f8d034b15e65ba8dc0d066358dd0632bfcd6e","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("c71248b70870960af9993de4f31d3cba9bbce7e8","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("6ef275e6c3cb1384ec78128eceeb4963ff788dca","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("7bade6ef730cff83f3591479a98916920f66decd","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("73dc675b9437c2a51a975a9f58cc66f05463c351","0af3bd01dfae488392dc6f08daa2d0d8d370fb00")
-Mapping("d98d2f57d9b98325ff075c343d2c7695b66dfa7d","4e27ed3af19e604d7b65e130145fcecdc69fba7a")
-Mapping("0e63af5da3400ace48a0345117980473fd21ad73","1bf130519ca1c020623a550dc6b250eacea68e72")
-Mapping("4560cb830fce63fcffdc4558f4281aaac6a3a1ba","b405aa2d0301c5fc448299501278ae2db4e15e50")
-Mapping("11c94a197726b6a981828cb1837d7c3eed1b841d","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("7a9b552cb1621c9c57898d147228aab32b65a7c3","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("c27f7568bc74c418996892028a629eed5a7f5f00","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("d2230290f7220e740ec08f4d844bf5951e1b74b8","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("f9d422ea78a4652c5d9ecd6b6d7577bdfbfd98a8","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("618b01f9fa0a6b4e7e2ce5b3409abe104b80c4a8","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("8ad7bc3f428300aee6764f6e23527e19eb235e81","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("60960a260f7b5c695fd0717311d72ce62dd4eb43","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("433aae93e4ef866a1fdfefad136b32ed89acd3e7","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("a44774c3a9739b2eea8923e09d67b14312c78ef3","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("f5d8117c338a788bd24abec733fd143dfceb25a0","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("d3c79346a3e7ddbb5fb417810f226ac5a9209007","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("3761dcd3467441f78939ccb3b341b03b6a7558d7","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("c5840f9d252c2f5cc16698dbf385a29c5de3ca07","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("8e21bd0633b8d970646ee6eb706c9e8acfad19af","a7749fe451c37ec192b282ec7303b9809b49df93")
-Mapping("53df91a9b24ad999e7ca896447af6f5f74fe43bc","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("dddb7fca09dc817ba275602b950bb81a9032fb6d","b405aa2d0301c5fc448299501278ae2db4e15e50")
-Mapping("fb1dc34a831688f8eca89ea22ea2eb39e881d729","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("4f03f4a989d1c8346c19dfb417a77c09b34408b8","5b5196ad65db877c2f140dfc7a25f3fc6f2e40c6")
-Mapping("38d911dfc55a7a1eea1c80139113ed2ff0151087","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("3eeb8d4f2fbae0bb1c587d00b5abeaf938da47f4","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("212b2c7da87f3086af535b33a9ca6b5242f2d5a7","9bb2a50e04460fff646830502d575b82dbf17055")
-Mapping("663d2f5cd3163f17eddb74ee1e028d542255f21a","78e094632ec6160c3d2cfaad777c16a27ce08609")
-Mapping("436494b8f8008b600d64b3951f63c2bb0ea81673","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("65b448273dd280401cd440a6740a7cd891525ba3","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("521d78407471cb78e9bbf47160f6aa23047ac499","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("043eca7f0b34d12e61c44206beca740628647080","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("485c5fb6e1bf12cd11a8fac5ee94962e17cff74b","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("d32c320d7eee56706486fef6be778495303afe9e","2c56ea38b045624dc8b42ec948fc169eaff1206a")
-Mapping("e5e33ebd2ba12a78dbf6e2d5f154d5f71f28576c","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("e37f25aa3f356546ab851e394d5598fc575eabda","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("71f9384e3bec467158a628e2d11e77ffada16a90","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("cf9cf7c923eb01146971429044f216a3ca905e06","77f333b304424ae63dc70e10c6676dd645230f94")
-Mapping("ff5b446d2fdbd898bc97a751f2f72858de185cf1","6276c135d185e8492e8a2b9db5ca04e51c3293fa")
-Mapping("98edd1fbf8a68977a2a7c1312eb1ebff80515a92","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("a605441e049f0b6d5f7715b94b8ac4662fd7fcf6","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("a5b09d35473615e7142f5570f5c5fad0caf68bd2","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("fae75cd216c481de048e4951697c8f8525669c65","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("246be7e1a557b8ac8287c6842379a0db67770be6","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("2935d294ff862fdf96578d0cbbdc289e8e7ba81c","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("f315c35a77e40bd11ce81fedc0556be0f410bbf4","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("61edfd591cedff66fca639c02f66984f6271e5a6","db4a97c4cbcb160b3754c803284dd0110d1de1e4")
-Mapping("c6e9c76c59e3c10acd63ca9ec157a8894ea1a068","1b946106b7955d3dcde26719b9b62a5a2c4b78fe")
-Mapping("f43c34a134358471726f25fe5973b8c7e177c825","9bb2a50e04460fff646830502d575b82dbf17055")
-Mapping("98f8cce6db6c6c6660eeffee2b3903104e547ecf","c26a8bbd6d0e7bbfa2891934a1af2934cab3b6bb")
-Mapping("0c987c5c02498b4e77f5dfae1f6914ffb9268575","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("e44fdf97929d1315add3b76208adf99e8299252d","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("2d1a551e144335e0d60a637d12f410cf65849876","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("fd4b177aabb9749dfb562c48e47379cea81dc277","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("0e2c1281e909ca38479b97962fc9248f75d66412","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("d1e594f4029c6ac8feb7c2acf9f9e04c1b9c493c","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("338f939a8d77061896cd0a1ca87a2c6d1f4ec359","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("91a79fb29ac78d057d04dbe86be13d5dcc64309a","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("42abbd8878d3b67238f3611b0587c704ba94f39c","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("0beb2ba16a08dfa01569b5f4644da315dc4c806c","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("0fc6756b42e0556cc2e18079f5fc6b4d58f4e81a","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("5404efc28a0cddee103ef6396c48ea71ff9631c8","77f333b304424ae63dc70e10c6676dd645230f94")
-Mapping("3e525e3f6d9e85d54fa4c49b52df85aa0c990100","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("394e1b40d264aa6928811919c1124fa248e7d802","6276c135d185e8492e8a2b9db5ca04e51c3293fa")
-Mapping("e413dc36a83a5aad3ab6270373000693a917e92b","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("ded5ee0013f6126f885baf5e072c20ba8b86ee6a","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("99cb9ccb9ca2067ad6e60508e3d52da77396b2f1","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("f9a3086363f214f2b56bef30f0ac572e1a9127f1","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("02046a5d402c789c006d0da7662f800fe3c45faf","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("2454a68cfbb63aa7b8e09fe05114d5f98b2f9740","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("feb3536eba10c2e4585d066629598f03d5ddc7c6","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("00ee1b47f42129a0a6e33510578fbcf07c1e5382","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("237d54ff6c4fb3577e02d4c5af02813c11b63d01","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("435236b8877cdb98c82eaebfb7887782277265c5","9ff52752d855722c55dbc71d9b22bd42eabfc468")
-Mapping("8e54a21139ae96a2aca3129100b057662e2799b9","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("154f1f544dd68f7b53ff8d9952811e855f4c2d7c","c9e5e6a53aef5cd1b939ecfa18f56bdf5bf0451c")
-Mapping("50f8aadd746ebc929a752e5ffb133936ee75c52f","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("ad7c55e1fc55d9af4787b285cec1c64e3480ae84","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("9b0edb7fddacd6a60a380c1ce59159de597ab270","7d6af6751c5726d884440d4e8d462a9ee6c5efc1")
-Mapping("e2be5f568d1f60365b825530f5b5cb722460591b","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("e87a205c2e117d9fb57f6cdeac0a7f6e95c88316","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("032a53a06ce293571e51bbe621a5c480e8a28e95","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("c0e02ad724f05f73b957b3d6f6314a9a2e5c284e","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("5fa0af2327944bd806b2fa382d4e983149ae7e4a","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("0da58007451a154da2480160429e1604a1f5f0ec","65bdf79da3f72269e6fe7aac1355df1420613889")
-Mapping("7f7a1cbfd3b55daee191247770627afab09eece2","c9e5e6a53aef5cd1b939ecfa18f56bdf5bf0451c")
-Mapping("34e82a7b793a6cdd27df762bf46bab8cdc92b14a","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("d006f5734f49625c34d6fc33bf6b9967243abca8","6f4681bacc78a00a63766f12a17560701ab5c1e8")
-Mapping("7efc097c4fe6e97f54a44cee91c56189e9ddb41c","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("2fbb07525e2f07a815e780a4268b11916248b5a9","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("94736c434ee154b30e2ec22ec112b79e3f6c5884","eefec8abda7cb8e8693aa876fbd1e21f2a6a5c2d")
-Mapping("fd542592f08ca0d1f7255600115c2eafdf6b5da7","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("7f3df5772439eee1c512ed2eb540beef1124d236","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("1edd389cc4c7b5be7a3dd4fe4b986f6017018e54","39c52225dd06ab06ef75ef97841c66c7d9b6e56c")
-Mapping("ad4bc3323b9299d867697e9653dcea1b5e1ad283","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("a143517d44cac50b20cbd3a0b579addab40dd399","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("a29424a2265411dda7d7446516ac5fd7499e2b55","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("7f65393b9abf5e70d0b9a8080558f17c5625bd40","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("d1206f950ffb76c76e1b74a19ae33c2b7d949454","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("04b88a9eba8abbac87eddcb2998beea09589c2c9","b405aa2d0301c5fc448299501278ae2db4e15e50")
-Mapping("ff15e9670843f8bd6b54ab1b042d2095b4c0aa6d","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("4bb6b4a5ed1cd377c5cfd97721ad12f52e63dd41","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("9b91b9c10e3c87ed333a1e34c4f46ed68f1eee06","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("4f20caa6258d4c74ce6b316fd347e3efe81cf557","ea43e5e21d8aa61e00124f634a71325e6d3bfaa8")
-Mapping("5d04ce67fd14538d03fa47a2598f80d49fd564c6","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("e55d3f9c5213fe1a25366450127bdff67ad1eca2","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("54b7d21f59a363e53eb1c31d76b40af2ff99321c","61150353bf9cc415f4554a9b4851c14e4255329f")
-Mapping("f5230fbf76bafd86ee4376a0e26e551df8d17fec","30e49a9ead550551e879af64ba91a0316da1c422")
-Mapping("5db778affee7c6600c8e7a177c48282dab3f6292","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("107896c32d5dda4db508968ff34997a39d286966","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("caca2121ffe4cb47d8ea2d9469c493995f57e0b5","68f2934a154abac9a2af72c55e4c08277172e087")
-Mapping("9b9d2aff8de4d499b4ba7ca406e000f8d3754ea7","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("9d78d1d02761b906038ba4d54c5f3427f920f5fb","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("257becbfe4987d1f7b12af5a8dd5ed96697cd2e8","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("4007d4ef26eab44bdabc2b7574d032152264d3ad","4436c9d35498e7ae3da261f6141d6d73b915e1e8")
-Mapping("45d050cde277b22a755847338f2acc2c7b834141","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("bc2e84ca0939b73fcf1768209044432f6a15c2e5","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("41f41b2354778375dc72f7ed1d9323626580dc4d","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("823ff8cf1397a5772b1f6954b60576202bf91836","83980aca2086e5c4dca5aae9a92a065a9ff4ac56")
-Mapping("f76ecd0668fcdb289456cdc72a39ad15467cc454","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("0862458dad90a0d80827e22e3f86e33add6d847c","ecef6c7c809eba2a4eed5e281f19ab7331998c6f")
-Mapping("f509b26a7730d721ef87423a72b3fdf8724b4afa","5d90154886039ddbd7c1b8bf4cc273b774b14ec7")
-Mapping("fde692739576089729885b7f79aa2232cb9778c5","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("72b2bd55edbb1e63a930c5ddd08b25e4f9044786","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("834bc5650acf7019a53b409db68986857822812c","b3e0d272af149c4126f90a0262d796d7401ba7a1")
-Mapping("c5a96fb7973649807a7943e7395456db158dcab6","cf04ae54e680c0b28e8311459cb8fd11315485a0")
-Mapping("770bd3d1d03f0de2e27b1ae6a0604597d0e26f84","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("5e8897b7b51636f157630e6639b711d698e1d101","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("c8ea4ace9213ae045123fdfeb59d1ac887656d31","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("48840618382eccb8a799320c8e5d08e3b52f4c42","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("c919f490bbcd2b29b74016101f7ec71aaa24bdbb","11ce918c75b05d065ce3bf98b20d62465b5afc55")
-Mapping("0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("e37a13cc3594004663738bd18d8100e6db9666cf","ea43e5e21d8aa61e00124f634a71325e6d3bfaa8")
-Mapping("3712e11a828af2eea273a3e7300115e65833fbc5","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("abc3073c92df034636a823c5382ece2186d22b9e","b3e0d272af149c4126f90a0262d796d7401ba7a1")
-Mapping("a73c2e555c26ef0c8b98c91c97a7d24b7017267f","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("53712f8637dbe326df569a90814aae1cc5429710","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("664fcd3f046e2a6824602da0fad81e3e2bb0d409","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("45127211566c53bac386b66909a830649182ab7a","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("23744c84d9c0f8e4e870edb983f1ad6d33449c34","353df59893f4dc249f06047dca659b5b2172063f")
-Mapping("1dd1884891636d0eb51157d137230076bcf20627","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("4bd32c98047a809ba5fd1fac2aa044638e5f2105","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("e3cebcb3bd4ffaf86bb0cdfd2af5b7e698717b01","04f0d309dcbaa8425c702d1439592b87fff0a69e")
-Mapping("d6953df14657f5932270ad2b33bccafe6f39fad4","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("1eaadebb3dee31669c7649b32747381d11614fae","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("cfc572cae2d1fc381cce476b5c787fd7221af98c","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("4a8c5b20c7772bc5342b83d4b0696ea216ef75a7","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("97e58c0d32bcb8730f8246d25f3d2fa8092b450a","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("6d0e58bff88f620c1a4f641a627f046bf4cde4ad","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("0cd7ff7ddfb75a38dca81ad3e76b1e984129e939","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("a74d1862d4d87a56244958416fd05976c58ca1a8","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("d9a105fdd46c926ae606777a46dd90e5b838f92f","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("beac68a88711a90346ec8b68e3baefbec62b3b0d","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("421bd77f42c2fe8a2596dbcc1580ec97fb89009f","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("f68e08933d8f519a9655934fedebbc509661b219","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("95f437b3cfb2fec966d7eaf69d7c2e36f9c274d1","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("da305a2b00530aa34dea4e48389204c26fa35dbb","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("760ce94c69ca510d44087291c311296f6d9ccdf5","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("792c645ca7d11a8d254df307d019c5bf01445c37","a7749fe451c37ec192b282ec7303b9809b49df93")
-Mapping("6d3f4e0aab3e36ceb8b83d1e9467514685f6b751","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("803c60218ffac3384b0063c1b87ae7944163bba7","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("0d0f6b113047b2cf9afbde990cee30fd5b866469","0af3bd01dfae488392dc6f08daa2d0d8d370fb00")
-Mapping("67100f61e62a86f2bf9e38552ee138e231eddc74","6276c135d185e8492e8a2b9db5ca04e51c3293fa")
-Mapping("2477e2493e67527fc282c7239e019f7ebd513a1a","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("b2e36e6c2d229126b59e892c9147fbb68115d292","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("2748a9fd93dd1a00a4521f4f16de5befbf77f6cd","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("b1af43bc63bc7417938df056f7f25d456cc11b0e","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("06e47688bf15d0215edbe05b21603062f6d2eb5d","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("f98721f886ab52d32d622ad0a46216ad03f3e525","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("4f4656d46d84a488ae3df34b08f362d7071036a0","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("5c9e5df3a097e094641f16dab501ab1c4da10e9f","3cecd6003b3eb15168421084a27223596517899c")
-Mapping("a4cbb44ae2c80545db957763b502dc7f6ea22085","cf04ae54e680c0b28e8311459cb8fd11315485a0")
-Mapping("ef663a8a48ea6b98b43cbfaefd99316b36b16825","c9e5e6a53aef5cd1b939ecfa18f56bdf5bf0451c")
-Mapping("a9dd56ff9a08d74c53d5cc22d18f126a12749608","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("518deda77feb4957bfd311b6cb50baa7ef9ca6a2","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("25d8a9494ca6d77361e47c1505ecf640b168819e","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("e3051d8c24467b54c81da9d9ad70a3e82e106ec1","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("5d04957a4b4714f71d38326fc96a0b0ef6dc5800","db4a97c4cbcb160b3754c803284dd0110d1de1e4")
-Mapping("83e4eed16ef7adb54a802e3b684427e0e912c2b7","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("edc02580e4e80476ac1ded2cc1008eaf8b8400e6","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("9c09c1f7cfcf9de0522bcd1cfda32b552195c464","eefec8abda7cb8e8693aa876fbd1e21f2a6a5c2d")
-Mapping("8a87b945b27b5670ac5ed665bbb0fccc1b88a0a0","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("534b42394d743511db1335d5ed08d507ab7c6e73","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("ef92009c1dbe2750f1d24a6619b827721fb49749","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("c4715198b50d1cdaad44b6e250844362b77dcdd7","9ff52752d855722c55dbc71d9b22bd42eabfc468")
-Mapping("3fc30d884ae0c988d98452a06737705cfe34806a","5b5196ad65db877c2f140dfc7a25f3fc6f2e40c6")
-Mapping("698fcd38fa9548e64a2092ff48c9d15ceb57d40c","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("ffe52882ed79be67344dd6085559e308241e7f60","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("853c4774e26ea97b45fe74de9a6f68e526784323","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("603ab5bd6e0ffefafa7411cd8bd23a6ca82bcff0","30e49a9ead550551e879af64ba91a0316da1c422")
-Mapping("fa416394275d2468d104b8f72ac31b1ddf7ee52e","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("826cb062a659f7b719a8a0ab1497a78229318aab","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("f44c6e4e288e4f49c5c257b2e2cb2ad5918f26a3","6f4681bacc78a00a63766f12a17560701ab5c1e8")
-Mapping("c2de47a9aa4c9812884f341f1852e9c9610f5f7a","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("f05a5240440b3eaef1684a7965860fab40301947","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("d4e3570db4c007089035b833cc20c7fc2f8cb32f","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("b5a3341f1b8b475990e9d1b071b88d3c280936b4","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("769d12eec1d0bc3708841dfc149d3ec98b04bec6","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("442ae7f04026c215a03b155eaaf9cde8bb5cf02a","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("8dae8cdcc8fa879cea6a4bbbfa5b32e97be4c306","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("a0d664bae6ca79c54cc054aa2403198e105190a2","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("f3c923a13a458c35ee26b3513533fce8a15c9c05","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("8ac1525e091d3db28e67adcbbd6db1e1deaa37fb","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("bc0e288ad02ef362b5a6c42aaf61f2901c9b46db","5b5196ad65db877c2f140dfc7a25f3fc6f2e40c6")
-Mapping("4760b8fb886a3702ae11bfa7868d495b2675b5ed","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("0820e54a8ad7795d7b555b37994f43cfe62356d4","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("5fd2f06e99a985dd896684cb2c9f8c7090eca1ab","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("e15510ca33ea15c893b78710101c962b11459963","dad8e11e9fcbd76c0a2dc47211dcd654effed010")
-Mapping("3360cc3a0ea33c84d0b0b1163107b1c1acbf2a69","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("37538aa1365d1f8a10770a7d15c95b3167c8db57","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("8a58268b5ad9c4a240be349a633069d48991eb0c","b405aa2d0301c5fc448299501278ae2db4e15e50")
-Mapping("6645da366eed0c61258a04265bea513e94df7ea6","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("8aa9d2014f4e5258f83b907e8431c59a33acdae7","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("f7af19c279b8b7ea3d2c21fcbd67164af8d5d968","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("77621317d643cc5d13da60b26ab68b057668e688","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("aa4e57ca8f18b836bf77923cd0d9ad1390f0110b","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("097bc6a84f2280a889b9ab4b544f27851a978927","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("22ee68dc586440f96b76b32fbd6087507c6afdb9","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("6e19f3f383b99414490243665c96b9f4e0f313f9","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("adef9da30f1ecbfeb81312d01ed94ac53f7161ba","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("7e6d6e5f535321c2223f044caba16f97b825009c","a7749fe451c37ec192b282ec7303b9809b49df93")
-Mapping("6dee5f1126dfd5c9314ee5ae9d9eb010e35ef257","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("5239f5c57bb6eb9e894081727f5aba0a67e89763","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("fe982319aa0aa5bbfc2795791a753832292bd2ba","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("5c5b8afd80e6fa1d24632153cb2257c686041d41","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("59947fcae6a40df12e33af8c8c7291014b7603e0","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("a1947b3f9e2831e2060bc42f0c78e4a2bb67930a","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("a7f28678bbf4e16893bb6a718e427504167a9494","b94e59cc41f8eeb36ee269cae3275d7620189c14")
-Mapping("c43753f910aae000f8bcb0a502407ea332afc74b","b94e59cc41f8eeb36ee269cae3275d7620189c14")
-Mapping("1423bec54cf2db283b614e527cfd602b481485d1","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("ed084b0b8341c974769a0328f61851b0e1fc17fa","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("ed33453a37d602f34cc40c205f9b9b8a8aff88b5","75b27ef59cd0eb95b50d0cde14b05e0079b3ebe9")
-Mapping("2daa404e9a151a2e8262cbd6d8c209fd067aca16","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("b1496c6e606dd908dd651ac2cce89815e10d7fc5","5acb7f198fa56943a2837583d555896badb5733d")
-Mapping("8970e8bcf6153d1ead2283f1a0ed7b192230eca6","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("dbb73f8f79ab176a897d5a95e696adb71b957cbe","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("39d5a61f2e4e237123837f5162cc275c2fd7e625","3cecd6003b3eb15168421084a27223596517899c")
-Mapping("118b50524b79e565f017e08bce9b90a16c63634f","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("aa69777ea2902208b24b3fd77767d577ceaf6386","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("07e0e2ec268c140e607e1ac7f49f145612d0f597","a42e62fa0a59d0ba620889f97513929a113a6fbd")
-Mapping("2d8bd9b74dc0cf06d881bac645698ccbcf9d9c5e","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("61d9231ff2604a0467987042d9ebf9ff9ea739b5","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("80fc9b0ecb29050d45b17c64af004200afd3cfc2","d9cd4a33f53689bc0847775669a14f666a138fd7")
-Mapping("4253153db205251f72ea4493687a31e04a2a8ca0","4e27ed3af19e604d7b65e130145fcecdc69fba7a")
-Mapping("537ccdf3ac44c8c7a8d36cbdbe6fb224afabb7ae","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("3503f565e1fb7296983757d2716346f48a4a262b","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("7402a394471a6738a40fea7d4f1891666e5a80c5","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("9b88e0a8667040452a94fda8548f0f5f0f801f90","a7749fe451c37ec192b282ec7303b9809b49df93")
-Mapping("17eec1433c69972844dd228b5fe801f218e118c3","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("9e346646e93cc243567e27bb0f4e8716d56ad1f1","5b5196ad65db877c2f140dfc7a25f3fc6f2e40c6")
-Mapping("75208942f6144daac669e8e382029fc33bdce841","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("6a91782b72fca586b15ba68364bc7baab837af86","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("eeba189cfb2cfc5c5898513352d4ca8f1df06e05","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("2d03399f53d28a8be645625376c0c9fbe601a01d","ecef6c7c809eba2a4eed5e281f19ab7331998c6f")
-Mapping("6c8927b0cf80ceee19386026cf9d7fd4fd9d486f","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("b32e6e6ac8921035177256ab6806e6ab0d4b9b94","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("e9920ef7749d11fc71cc32ca4ba055bcfeaab945","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("8f349be27815d43d462a32faeb270a22a68486b6","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("368275062fb655c1f36e0398f88b15379a1f3c93","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("7979016aff545f7b41cc517031026020b340989d","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("20cc75272619cc452e3ae6c131e61974f6aa9929","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("8a79d08fa57e1c257d647c9848e35defcb379c07","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("088b987307b91612ab164026e1dcdd0129fdb62b","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("6e87bacd37539b7e7cd75152dffd225047fa983a","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("dd67187965e136bff1ed05e035293441c60f0790","5d90154886039ddbd7c1b8bf4cc273b774b14ec7")
-Mapping("f82664191d0e8764b7435b9d72eb0e366b8b1464","db4a97c4cbcb160b3754c803284dd0110d1de1e4")
-Mapping("cd2cd4c9627e52c33e68e8c93a8916dc11094cbb","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("0176a9eef845e7421b7e2f7ef015333a41a7c027","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("eceec57f72150dd548e05025a05a93381da41385","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("d7f94516345a36ddfcd68cbdf1df835d356795c3","8d470b57968fd875c2d9ce50446868b906f54752")
-Mapping("94d346360da50f159e0dc777dc9bc3c5b6b51a00","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("8b4085359ae798dedb05c95ad42520557bd25320","65bdf79da3f72269e6fe7aac1355df1420613889")
-Mapping("7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("a7eff79135de09a49b50acb029925275a7b42ccb","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("dfd43f0fdd4e6969c7d82c0670d70bf305fbccf8","1b946106b7955d3dcde26719b9b62a5a2c4b78fe")
-Mapping("47c3158c3d797f75f0f7b2b2a977179668919dab","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("ce93331e2cf21ac4b72a53854b105955919114e7","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("b543afca9b90ad6e4689b6d613ab51f9d3ba15e7","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("07194ffcd25b0871ce560b9f702e52db27ac9f77","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("7e11379f3b4c376fbb9a6c4d44f3286ccc28d149","353df59893f4dc249f06047dca659b5b2172063f")
-Mapping("66bf391c3aabfc77f5f7139fc9e6944f995d574e","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("b48cafd9eb658b5d74015ddbe5335c3842a03a63","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("22bc9e1d9ca49ee4f5cd953088ab09c238a6dd26","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("10a52c25cad963986cace7a22c167363afca0d74","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("ceedf1d5febd65b012b8bcd513d70a0a6a091210","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("2113659479a82ea69633b23ef710b58ab127755e","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("e708cbd91c9cae4426d69270248362b423324556","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("4a8b6f708c38342a6c74aa00cf4323774c7381a6","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("710a362dc7634fce42885327b6b7b1b3a9b0c41a","4436c9d35498e7ae3da261f6141d6d73b915e1e8")
-Mapping("51748a8fc77283914d4135f31b5966a407208187","68f2934a154abac9a2af72c55e4c08277172e087")
-Mapping("e649e903440bfd919bfc9db848c28df6d795a116","b94e59cc41f8eeb36ee269cae3275d7620189c14")
-Mapping("22ddcd1a13082b7be0fc99b720677efd2b733816","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("eb4fc71dc9024f15a0c9cc44bcc10c861e9d585e","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("a5fb9ae5b2ed3cb011ada9dc1e8633aa0927f279","03c64bf532ceec915f74460daf5344bb8ccf23d3")
-Mapping("202720bf483088dbdb343f78c0aa77067fdd8156","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("c59199efca5856cdf810919fbf9b5bce32dc4523","0af3bd01dfae488392dc6f08daa2d0d8d370fb00")
-Mapping("3a5d45f68cadc8fff4fbb557780f92b403b19c19","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("96bb8b31c81dc2394317f2f083c3acf8087efea1","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("1fd5b9d516c035a898dcb437b2f982bea5d4bc88","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("31ee872db5aae4750e3da1ca4ed1523c4356947f","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("702b45e409495a41afcccbe87a251a692b0cefab","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("0edce6f4bbb4514482537f569f0b8ef48e71e0a0","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("e160e5cb80652bc2afe74cb3affbe35b74243ea9","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("1fa54ad9680cc82e7301f8ed4e9b7402dfd6ce0e","3cecd6003b3eb15168421084a27223596517899c")
-Mapping("f1b882b55805c342e46ee4ca3beeef1d1fa2044b","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("6a889570e46c03d7b156ec08f3f4cb4d145924a3","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("dd927a5b0f29342f7ad919fb52ca29510d2e7362","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("fdc0011561c6365c596dfd8fa1ef388162bc89c7","4436c9d35498e7ae3da261f6141d6d73b915e1e8")
-Mapping("b520af6fd515b186caed436d75162a42aa183d95","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("83b30a639d5abd1270ade35d9bd92271f5a5ba18","250eeb4c3c00b7831226cf5266aacb5fca1e13f3")
-Mapping("273f42b5964c29dda2c5a349dd4655529767b07f","04f0d309dcbaa8425c702d1439592b87fff0a69e")
-Mapping("623fb90b5a1f324e0ec44085116bf858cef19a00","65bdf79da3f72269e6fe7aac1355df1420613889")
-Mapping("da384694807172f0ca40eca2e49a11688aba6e93","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("7ced01a730e8fc1bae2f8d4369c26812c0484da4","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("9b98af84c4aa66392236fff59c86da2130d46d46","f7256d28d1c2f8340ab5b99df4bdb15aa232f3f3")
-Mapping("a15f484b918a4533ad633ea903ccce82910af342","c26a8bbd6d0e7bbfa2891934a1af2934cab3b6bb")
-Mapping("0f0c640e0ee5a9ad365e78e3c62239b3d65b7045","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("75cf41afb468152611212271bae026948cd3ba46","7c84ba112429eb9bc0b99a6fe32a453c920a764c")
-Mapping("0f6f2d681b39c5f95459cd09cb936b6ceb27cd82","b777552167d2651ceb13437f9fde4dca95045912")
-Mapping("76e83339bb619aba206e5590b1e4b813a154b199","7a5d3abfb1aa3a38e0b3b3508c760fc8e712226c")
-Mapping("3ebcfa1451cfedc13a07e6353d8ade9742dfdc2a","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("d6eaea1c8860adb5302d2fbaad409e36585ab217","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("b2025326088b54fb3f083bebeba14e0a15bf00d3","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("5e7af4669f80e5f682141f050193ab679afdb4b1","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("1389494ac145a84dba025ff65969f7ab150c3f02","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("0b680cfce544ff9a59d720020e397c4bf3346650","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("e82734e56b2a50d38e0937d08f559d15dbe8e46b","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("bc39d4d9c514e5fdb40a5782e6ca08924f979c35","ce48709405270cae2dfdf99d9a8d57a4f672ad34")
-Mapping("18f3be7704a4ec7976fcd1272c728974243d29bd","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("fc23a81831d5b41510d3261c20c34dd8d32f0f31","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("5ef299eb9805b4c86b227b718b39084e8bf24454","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("d8878868c8d7ef3779e7243953fc050cbb0e0565","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("e38fb306b7f5e65cca34df2dab1f0db15e1defb4","ce48709405270cae2dfdf99d9a8d57a4f672ad34")
-Mapping("9d09331e00b02f81c714b0c41ce3a38380dd36a2","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("69656fa4cbafc378fd63f9186d93b0df3cdd9320","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("d1aed50ab81df3140977c610c5a7d00f36dc519f","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("9722952f0bed5815cb22cb4878be09fb39f92804","77f333b304424ae63dc70e10c6676dd645230f94")
-Mapping("38114ff16e7856f98b2b4be7ab4cd29b38bed59a","276b54e9c930c4ff015e1958ad1c640deffd29b2")
-Mapping("6bdae9edd0cc099daa6038bca469dc09b6fc078a","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("7f9c43cf98cfe1c369045399929cb098155b8374","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("5099914a16a215794ad243df0cc7a05d91d168e0","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("71c7e149e42cb0fc78a80db70d2525973311d488","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("6767d9b90b6b630ad8e2a9e5e02fd74c00c98759","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("71f8d0c8f1060bbe74100f29cc6f2da63d697c28","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("1bd30ce2aac40c7698aa4a1b9520aa649ff2d1c5","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("3a7dfda40a3e798bf086bd58cc7e5e09deb808b5","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("1057dc97afce39ff6a224966ece3ed438af4c1f5","73c3a496cc8ce261e87abbd998b36ab16dab4f4b")
-Mapping("bf4342114e357f2934d59e12e31e94532ddb2adf","6f4681bacc78a00a63766f12a17560701ab5c1e8")
-Mapping("de521cbb303c08febd9fa3755caccd4f3e491ea3","dad8e11e9fcbd76c0a2dc47211dcd654effed010")
-Mapping("beb5ae474d2835962ebdf7416bd1c9ad864fe101","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("99b89533d4cdf7682ea4054ad0ee36c351d05df1","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("1773f60ea5d42e86b8fdf78d2fc5221ead222bc1","77f333b304424ae63dc70e10c6676dd645230f94")
-Mapping("898f36c83cc28d7921a1d7b3605323dc5cfcf533","62e86b42b5ed342d30c539e22810c26d312995e2")
-Mapping("1700ca07c6dd7becff85678409a5df6ad4cf4f47","b777552167d2651ceb13437f9fde4dca95045912")
-Mapping("74bd074eefcf4915c73d1ab91bc90859664729e6","08f2904dfaf5e75fbcc1305c8b0aad5fae71a4ff")
-Mapping("8a6518427e11e6dd13d6f39663b82eb4f810ca05","ce48709405270cae2dfdf99d9a8d57a4f672ad34")
-Mapping("36f1f04f18b89ba4a999bcfd6584663fd6fc1c5d","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("2c462a2f776b899d46743b1b44eda976e846e61d","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("4b65a86ebace8600c8e269e8bfe3365cdc460e68","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("481068a707679257e2a738b40987246e0420e787","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("b497e18995d6b6992f97512c6b86b5cb3f2f34f5","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("bbebe7351fcd29af1eb9a35e315369b15887ea09","471dd52d7710dcad5fec0cd731b836b02ba4a8f4")
-Mapping("4cf7673076e6975532213e494dd3f7f9d8c2328e","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("3e826bb11228508fbe749e594038d6727208aa94","c26a8bbd6d0e7bbfa2891934a1af2934cab3b6bb")
-Mapping("c97f11af7bc4a6d3578f6a953be04ab2449a5728","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("f93bb2a50b37bc8bafe4d960e2afd839eaa854ed","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("8e18e26f12b1e8b3e913b15278bf6185f0f61add","5768385615c61f6c9d63dccfb3548812f1ba1320")
-Mapping("cd1ef390e731ed77b90b11b1f77e2c5ca641b261","9bb2a50e04460fff646830502d575b82dbf17055")
-Mapping("b0e40bfba44836ad30051ffb077c1cfc5bf4a59f","9ff52752d855722c55dbc71d9b22bd42eabfc468")
-Mapping("daecab3a784f28082df90cebb204998051f3557d","5304511fbc1f9a0c7340f7f0d037aa4dd13a588f")
-Mapping("c8915eebeaaef9f7cc1cff6ffd97f578b03c2ac9","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("81dc88f88f92ba8ad7465f9cba10c12d3a7b70f1","a7749fe451c37ec192b282ec7303b9809b49df93")
-Mapping("1c389ffeff814726dec325f0f2b0c99107df2673","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("da3629b05f8f1b425a738bfe9fe9aedd47c5417a","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("119307a83e12291a3fc126735d6bd0292c443464","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("476acbf1e9965b5e95c90f0d7d658709812b7003","bc5669eef8c1d747e82694547fd57a1400a5afec")
-Mapping("bb1fbbf84455fbad9afd26c17e0f725019322655","8cef65fde3f92a84218fc338de6ab967fafd1820")
-Mapping("f0f68778f798d6d34649745b41770829b17ba5b8","2c56ea38b045624dc8b42ec948fc169eaff1206a")
-Mapping("9310e3bd4f425f84fc27878ebf2bda1f30935a63","05fc7faacb7c33eaad6614f62a7d560b0d2660a5")
-Mapping("9af17757be1cc3f672928ecf06c40a662c5ec26d","1b946106b7955d3dcde26719b9b62a5a2c4b78fe")
-Mapping("9ae6cedb8d1e37469be1434642a3e403fce50a03","260514da942f281bc2dc3b14b629d3e660b3484f")
-Mapping("311376d30dc1cfa622142a9f50317b1e0cb4608a","04f0d309dcbaa8425c702d1439592b87fff0a69e")
-Mapping("80184183ba0a53aa4f491753de9502acd3d6920c","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("a647c0cd68bdd0f15081019f0b21bc31ae23f072","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("f4fbb93113aa4f0a0cd08e74afb35381bbfbc7f0","fff822fead6249671cbcb090b24bce58fab38de0")
-Mapping("23adf9fd843da7a3394c824b056f93151aaa40ad","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("412f43ac5b4ae8c3599e71c6972112e9be4758fa","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("8876ffc9235dade728e1fbc4be4c85415fdd0bcd","c9e5e6a53aef5cd1b939ecfa18f56bdf5bf0451c")
-Mapping("74f7e32f43b5fb0f83896d124566d8242eb786b1","77f333b304424ae63dc70e10c6676dd645230f94")
-Mapping("c5eae562935922f712edec56a45591bc2f8ded1c","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("f4eb5d9f719cd3c849befc8914ad8ce0ddcf34ed","9abd746a327320048ae2b212f34edcadbcafcadf")
-Mapping("9703ef666123c465f784e294b5b24d6d35a37745","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("b2d115f6db5172c961dfeb50de15f35784dbc7c9","8d48e3bbb2da2f5eb5f4a95efd6846e9ea93a160")
-Mapping("07e968b640e8ff76fa8be4b48b70ab80ea577800","56d288fa46e04cd5faf53d369a1a640a97e2bb08")
-Mapping("449e8eaa286e407c9cd8cac655b77998fd53db6b","ec2826cc2e0b3a800836bcf8733dee0924f6b7ab")
-Mapping("f4c675c476c18b1a11041193f2f59d695b126bc8","73c3a496cc8ce261e87abbd998b36ab16dab4f4b")
-Mapping("96d07e0ac9f0c56b95a2561c6cedac0b23a5d2a3","a8c5f90b06c9bf2bfa2c2f4aedd7c395cb92195d")
-Mapping("fc2daaae610b5515438b551a2f3706196a997f35","c9e5e6a53aef5cd1b939ecfa18f56bdf5bf0451c")
-Mapping("f5f33ec0e0455eefa72fc5567eb1280a4d5ee206","db4a97c4cbcb160b3754c803284dd0110d1de1e4")
-Mapping("dfd52ba6ac2262c6b61c59ec86bfd23e4e53d3de","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07","a42e62fa0a59d0ba620889f97513929a113a6fbd")
-Mapping("38048763e885a3ee139abf39d59a530b16484150","e697ffbbcb41559c8de3ca3b94f3b9467e662a19")
-Mapping("78ca1bda3522b14bc0336bc01dd1d49fdba2cda7","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("07e0c3651ce2a7b326f7678e135d8d5bbbbe5d18","c5d18600ef3c5e795c4133cfd91a1df088f2252e")
-Mapping("17e62f77f954bed97aae839624bfd6dd68342daf","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("e792288df31636ca28108516c63a00ce4267063a","b777552167d2651ceb13437f9fde4dca95045912")
-Mapping("6184f23950fb4aa14884ce310d948dc6fca269a3","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("152f6609246558be5e2582e67376194815e6ba0d","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("b3e19a221e63dcffdef87e12eadf1f36a8b90295","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("8256379832b5ecb7f71e8c5e2018446482223c12","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("797fd92628842c1f5face9fb93b0fe4f1f9d297f","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("ac162c6abe34cdf965afc0389f6cefa79653c63b","5b5196ad65db877c2f140dfc7a25f3fc6f2e40c6")
-Mapping("7efe1c6e678a263b9464f2e7f06f552b4d4db5a5","a8c5f90b06c9bf2bfa2c2f4aedd7c395cb92195d")
-Mapping("381b445ff5751f9f39ec672b623372dff09c276e","c9e5e6a53aef5cd1b939ecfa18f56bdf5bf0451c")
-Mapping("19bd93467617a447c22ec32cc1cf14d40cb84ccf","92bc35f7b6cb4232be5ac4cc031202c7ad82260b")
-Mapping("a8486b64b0c87dabd045453b6c81500015d122d6","c26a8bbd6d0e7bbfa2891934a1af2934cab3b6bb")
-Mapping("1836e3b42a5b2f37fd79104eedbe8f48a5afdee6","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("24a9bcbb7cb0d8bdc11b8252a9c13f7562c7e4ca","390f717a0af5851271792da9ff235c95f3db2556")
-Mapping("09f4c9f5082f78b0adcee83d3ab4337e000cd28e","2c31b45ae878b821975c4ebd94cc1e49f6073fd0")
-Mapping("9eae1fc0ea9b00341b8fe191582c4decb5cb86a3","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("a62a76047ea24aad7639f14eb3ce0e620b77bdb7","0506789014f9aef9ffac7d7d1e22fa72c7b85ab7")
-Mapping("82cf3a4486bc882207a09bf0d9e2dea4632781aa","413ab57c0210ecbe92298c53ec4e1e39f97e4e4c")
-Mapping("1ed41b072093fe7cccd232f9a2964c5fb6ab9f60","4646a88b7a1e68326d092b9cbbbbdd616a51077f")
-Mapping("07a34df18b437319a7ff510077bbab95cf7ec6bc","df7d9f383848dcb31a2f94bb1df5270ea21aff4b")
-Mapping("3d6705aa5abffe94c83bf09af8c3ba3c599845fc","b777552167d2651ceb13437f9fde4dca95045912")
-Mapping("689fca01c5a1eac2d240bf08aa728171a28f2285","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("e83f7563495dbe2629b0cbc738afb0808c4482e1","ecef6c7c809eba2a4eed5e281f19ab7331998c6f")
-Mapping("7ceebd98c6a15ae30e772eebb676b63ffa1a8122","5d90154886039ddbd7c1b8bf4cc273b774b14ec7")
-Mapping("bbc677480db8da85ea302e1e89d3df1f00e435bf","9fe551ae49289ce6f693ca0dabf4c9c15164f67d")
-Mapping("f8d394e5184fe3af761ea1e5ba73f993cfb36dfe","fb1aa5624dff1d96249080fe365ed794431f45db")
-Mapping("25c8c53dd994acb3f4f7c02fe6bb46076393f8b0","de597fca40d129435c53a69c6662d7bfac29771d")
-Mapping("1705a7d64b833d1c4b69958b0627bd054e6d764b","ab8995bbca73be761402585ead491111163c44d6")
-Mapping("a601302ff0217b91589b5a7310a8a23adb843fdc","8d48e3bbb2da2f5eb5f4a95efd6846e9ea93a160")
-Mapping("1ce08f9d631ef767c915270bc63283c6af40dc3f","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("0b36e9dea3f2ff25b1d0df2669836c33cce89ae5","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("6d77e45f01079fe3d40180b3e256e414ab379f63","4436c9d35498e7ae3da261f6141d6d73b915e1e8")
-Mapping("72b2abfd65ba024e12d7fe51852a309419f494d8","edb5214b29cd7de06dd10f673986d38e568b077c")
-Mapping("2b8116dced2c6c5d02e1c4359e89dc0919d6001b","b03d3dc478ba13f405cf9a877a4894de096a1cc1")
-Mapping("3f5aee2d5241139d808f4fdece0026603489afd1","410550665601a8abe8935f7b55d5732fe4c4224f")
-Mapping("29a54035c77cb2ba7ea2c24b2437760d0495a2c8","dad56c39474377c7d47e261b380d0be3aed104cc")
-Mapping("f4db9ffb22dfcb702dbdb2e0607cb91791866b57","bdaa76cfde64d06bb93c1f9102a0312d84cd0983")
-Mapping("c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be","61150353bf9cc415f4554a9b4851c14e4255329f")
-Mapping("03f19f7ff128a3b01eeab3f87f04cce22883f006","b94e59cc41f8eeb36ee269cae3275d7620189c14")
-Mapping("c0b64d97beebb09325b5587abed39f4f1621026f","8a18fb0f7396ceb1ca18cd82ca3deb795f5e60b2")
-Mapping("175631311716d7dfeceec40d2587cde7142ffa8c","dd8f07223346b06da723c25a3ac42f874e6c945c")
-Mapping("9b471a3f5fe57e5c6e08acf665f2094422415a3d","250eeb4c3c00b7831226cf5266aacb5fca1e13f3")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index b83f3fb..883fa30 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1906,15 +1855,9 @@ impl<T: Read> Read for Take<T> { @@ -1907,6 +1856,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1914,7 +1864,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index b83f3fb..883fa30 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1953,13 +1896,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1953,13 +1903,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index b83f3fb..883fa30 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1975,14 +1916,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1975,14 +1923,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index b83f3fb..883fa30 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2007,13 +1948,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2007,13 +1955,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -311,20 +311,17 @@ diff --git a/cursor.rs b/cursor.rs
index 577a115..8813aba 100644 index 577a115..8813aba 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,8 +1,9 @@ @@ -1,7 +1,7 @@
use io::prelude::*; use io::prelude::*;
-use core::convert::TryInto; -use core::convert::TryInto;
-use cmp; -use cmp;
-use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
+use core::cmp; +use core::cmp;
+use io::{self, Initializer, SeekFrom, Error, ErrorKind}; use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use io::{IoVec, IoVecMut};
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. @@ -70,7 +70,6 @@ use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
@@ -70,7 +71,6 @@ use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -332,7 +329,7 @@ index 577a115..8813aba 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -93,7 +93,6 @@ impl<T> Cursor<T> { @@ -93,7 +92,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -340,7 +337,7 @@ index 577a115..8813aba 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -111,7 +110,6 @@ impl<T> Cursor<T> { @@ -111,7 +109,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -348,7 +345,7 @@ index 577a115..8813aba 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -127,7 +125,6 @@ impl<T> Cursor<T> { @@ -127,7 +124,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -356,7 +353,7 @@ index 577a115..8813aba 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -146,7 +143,6 @@ impl<T> Cursor<T> { @@ -146,7 +142,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -364,7 +361,7 @@ index 577a115..8813aba 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -168,7 +164,6 @@ impl<T> Cursor<T> { @@ -168,7 +163,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -372,7 +369,7 @@ index 577a115..8813aba 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -188,11 +183,9 @@ impl<T> Cursor<T> { @@ -188,11 +182,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -384,7 +381,7 @@ index 577a115..8813aba 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -213,14 +206,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -213,10 +205,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -396,12 +393,7 @@ index 577a115..8813aba 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -235,7 +226,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -235,7 +228,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -410,7 +402,7 @@ index 577a115..8813aba 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -246,12 +239,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -246,12 +237,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -430,15 +422,7 @@ index 577a115..8813aba 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -263,6 +260,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -281,6 +276,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -281,6 +279,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -446,7 +430,7 @@ index 577a115..8813aba 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -307,6 +306,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -307,6 +303,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -454,7 +438,7 @@ index 577a115..8813aba 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -320,13 +320,13 @@ fn vec_write_vectored( @@ -320,7 +317,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -462,14 +446,7 @@ index 577a115..8813aba 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -335,7 +331,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -335,12 +335,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -478,13 +455,7 @@ index 577a115..8813aba 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -348,7 +344,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -348,12 +349,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -493,13 +464,7 @@ index 577a115..8813aba 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -361,8 +357,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -361,13 +363,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -510,12 +475,6 @@ index 577a115..8813aba 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index e9b4f60..31c0ff1 100644 index e9b4f60..31c0ff1 100644
--- a/error.rs --- a/error.rs
@ -835,7 +794,7 @@ diff --git a/impls.rs b/impls.rs
index aa8db17..aaf1b00 100644 index aa8db17..aaf1b00 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use cmp; -use cmp;
-use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -843,8 +802,8 @@ index aa8db17..aaf1b00 100644
-use mem; -use mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -857,14 +816,7 @@ index aa8db17..aaf1b00 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -878,7 +830,7 @@ index aa8db17..aaf1b00 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -886,12 +838,7 @@ index aa8db17..aaf1b00 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -905,7 +852,7 @@ index aa8db17..aaf1b00 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -914,14 +861,7 @@ index aa8db17..aaf1b00 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -935,7 +875,7 @@ index aa8db17..aaf1b00 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -944,12 +884,7 @@ index aa8db17..aaf1b00 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -964,7 +899,7 @@ index aa8db17..aaf1b00 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -172,7 +180,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> { @@ -172,7 +176,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -972,15 +907,7 @@ index aa8db17..aaf1b00 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -192,6 +199,7 @@ impl Read for &[u8] { @@ -231,6 +234,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -231,6 +239,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -988,7 +915,7 @@ index aa8db17..aaf1b00 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -240,7 +249,7 @@ impl Read for &[u8] { @@ -240,7 +244,7 @@ impl Read for &[u8] {
} }
} }
@ -997,7 +924,7 @@ index aa8db17..aaf1b00 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -254,7 +263,6 @@ impl BufRead for &[u8] { @@ -254,7 +258,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1005,15 +932,7 @@ index aa8db17..aaf1b00 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -265,6 +273,7 @@ impl Write for &mut [u8] { @@ -293,7 +296,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -293,7 +302,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1022,14 +941,6 @@ index aa8db17..aaf1b00 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -301,6 +310,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index 613ae7a..7fa4bb0 100644 index 613ae7a..7fa4bb0 100644
--- a/mod.rs --- a/mod.rs
@ -1063,9 +974,9 @@ index 613ae7a..7fa4bb0 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1141,16 +1052,15 @@ index 613ae7a..7fa4bb0 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -530,7 +519,7 @@ pub trait Read { @@ -530,7 +519,6 @@ pub trait Read {
/// ///
/// The default implementation simply passes the first nonempty buffer to /// The default implementation simply passes the first nonempty buffer to
/// `read`. /// `read`.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
match bufs.iter_mut().find(|b| !b.is_empty()) { match bufs.iter_mut().find(|b| !b.is_empty()) {
Some(buf) => self.read(buf), Some(buf) => self.read(buf),
@@ -560,7 +549,6 @@ pub trait Read { @@ -560,7 +548,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1158,7 +1068,7 @@ index 613ae7a..7fa4bb0 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -613,7 +601,7 @@ pub trait Read { @@ -613,7 +600,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1167,7 +1077,7 @@ index 613ae7a..7fa4bb0 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -656,7 +644,7 @@ pub trait Read { @@ -656,7 +643,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1176,7 +1086,7 @@ index 613ae7a..7fa4bb0 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -719,7 +707,6 @@ pub trait Read { @@ -719,7 +706,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1184,7 +1094,7 @@ index 613ae7a..7fa4bb0 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -771,7 +758,6 @@ pub trait Read { @@ -771,7 +757,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1192,7 +1102,7 @@ index 613ae7a..7fa4bb0 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -808,7 +794,6 @@ pub trait Read { @@ -808,7 +793,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1200,7 +1110,7 @@ index 613ae7a..7fa4bb0 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -843,7 +828,6 @@ pub trait Read { @@ -843,7 +827,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1208,7 +1118,7 @@ index 613ae7a..7fa4bb0 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -879,42 +863,77 @@ pub trait Read { @@ -879,22 +862,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1218,10 +1128,8 @@ index 613ae7a..7fa4bb0 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1233,10 +1141,9 @@ index 613ae7a..7fa4bb0 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1260,23 +1167,15 @@ index 613ae7a..7fa4bb0 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -907,14 +920,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1289,41 +1188,31 @@ index 613ae7a..7fa4bb0 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -924,7 +943,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -924,7 +935,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -937,31 +956,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -937,11 +947,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -954,14 +962,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1336,11 +1225,10 @@ index 613ae7a..7fa4bb0 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -972,13 +991,11 @@ impl<'a> Deref for IoVec<'a> { @@ -972,13 +978,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1354,7 +1242,7 @@ index 613ae7a..7fa4bb0 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -992,21 +1009,18 @@ impl Initializer { @@ -992,21 +996,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1376,7 +1264,7 @@ index 613ae7a..7fa4bb0 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1049,7 +1063,6 @@ impl Initializer { @@ -1049,7 +1050,6 @@ impl Initializer {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1384,7 +1272,7 @@ index 613ae7a..7fa4bb0 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1098,7 +1111,6 @@ pub trait Write { @@ -1098,7 +1098,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1392,16 +1280,15 @@ index 613ae7a..7fa4bb0 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1109,7 +1121,7 @@ pub trait Write { @@ -1109,7 +1108,6 @@ pub trait Write {
/// ///
/// The default implementation simply passes the first nonempty buffer to /// The default implementation simply passes the first nonempty buffer to
/// `write`. /// `write`.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
match bufs.iter().find(|b| !b.is_empty()) { match bufs.iter().find(|b| !b.is_empty()) {
Some(buf) => self.write(buf), Some(buf) => self.write(buf),
@@ -1140,7 +1152,6 @@ pub trait Write { @@ -1140,7 +1138,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1409,7 +1296,7 @@ index 613ae7a..7fa4bb0 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1173,7 +1184,6 @@ pub trait Write { @@ -1173,7 +1170,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1417,7 +1304,7 @@ index 613ae7a..7fa4bb0 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1225,7 +1235,6 @@ pub trait Write { @@ -1225,7 +1221,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1425,7 +1312,7 @@ index 613ae7a..7fa4bb0 100644
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1281,7 +1290,6 @@ pub trait Write { @@ -1281,7 +1276,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1433,7 +1320,7 @@ index 613ae7a..7fa4bb0 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1311,7 +1319,6 @@ pub trait Write { @@ -1311,7 +1305,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1441,7 +1328,7 @@ index 613ae7a..7fa4bb0 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1327,7 +1334,6 @@ pub trait Seek { @@ -1327,7 +1320,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1449,7 +1336,7 @@ index 613ae7a..7fa4bb0 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
} }
@@ -1337,29 +1343,26 @@ pub trait Seek { @@ -1337,29 +1329,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1483,7 +1370,7 @@ index 613ae7a..7fa4bb0 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1439,7 +1442,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1439,7 +1428,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1492,7 +1379,7 @@ index 613ae7a..7fa4bb0 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1485,7 +1488,6 @@ pub trait BufRead: Read { @@ -1485,7 +1474,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1500,7 +1387,7 @@ index 613ae7a..7fa4bb0 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1507,7 +1509,6 @@ pub trait BufRead: Read { @@ -1507,7 +1495,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1508,7 +1395,7 @@ index 613ae7a..7fa4bb0 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1563,7 +1564,6 @@ pub trait BufRead: Read { @@ -1563,7 +1550,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1516,7 +1403,7 @@ index 613ae7a..7fa4bb0 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1622,7 +1622,6 @@ pub trait BufRead: Read { @@ -1622,7 +1608,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1524,7 +1411,7 @@ index 613ae7a..7fa4bb0 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1663,7 +1662,6 @@ pub trait BufRead: Read { @@ -1663,7 +1648,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1532,7 +1419,7 @@ index 613ae7a..7fa4bb0 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1702,7 +1700,6 @@ pub trait BufRead: Read { @@ -1702,7 +1686,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1540,7 +1427,7 @@ index 613ae7a..7fa4bb0 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1714,7 +1711,6 @@ pub trait BufRead: Read { @@ -1714,7 +1697,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1548,7 +1435,7 @@ index 613ae7a..7fa4bb0 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1740,7 +1736,6 @@ impl<T, U> Chain<T, U> { @@ -1740,7 +1722,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1556,7 +1443,7 @@ index 613ae7a..7fa4bb0 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1763,7 +1758,6 @@ impl<T, U> Chain<T, U> { @@ -1763,7 +1744,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1564,7 +1451,7 @@ index 613ae7a..7fa4bb0 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1790,13 +1784,11 @@ impl<T, U> Chain<T, U> { @@ -1790,13 +1770,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1578,7 +1465,7 @@ index 613ae7a..7fa4bb0 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1806,7 +1798,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1806,7 +1784,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1586,15 +1473,7 @@ index 613ae7a..7fa4bb0 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1818,6 +1809,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1838,7 +1815,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1838,7 +1830,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1603,7 +1482,7 @@ index 613ae7a..7fa4bb0 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1865,7 +1857,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1865,7 +1842,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1611,7 +1490,7 @@ index 613ae7a..7fa4bb0 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -1900,7 +1891,6 @@ impl<T> Take<T> { @@ -1900,7 +1876,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1619,7 +1498,7 @@ index 613ae7a..7fa4bb0 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -1926,7 +1916,6 @@ impl<T> Take<T> { @@ -1926,7 +1901,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1627,7 +1506,7 @@ index 613ae7a..7fa4bb0 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -1951,7 +1940,6 @@ impl<T> Take<T> { @@ -1951,7 +1925,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1635,7 +1514,7 @@ index 613ae7a..7fa4bb0 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -1976,7 +1964,6 @@ impl<T> Take<T> { @@ -1976,7 +1949,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1643,7 +1522,7 @@ index 613ae7a..7fa4bb0 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2005,13 +1992,11 @@ impl<T> Take<T> { @@ -2005,13 +1977,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1657,16 +1536,16 @@ index 613ae7a..7fa4bb0 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2028,15 +2013,9 @@ impl<T: Read> Read for Take<T> { @@ -2029,6 +1999,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2036,7 +2007,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1674,7 +1553,7 @@ index 613ae7a..7fa4bb0 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2063,13 +2042,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2063,13 +2034,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1688,7 +1567,7 @@ index 613ae7a..7fa4bb0 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2093,14 +2070,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2093,14 +2062,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1705,7 +1584,7 @@ index 613ae7a..7fa4bb0 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2125,13 +2102,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2125,13 +2094,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1748,9 +1627,9 @@ index 5ce955e..c7d8697 100644
-use io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use mem; -use mem;
+use core::fmt; +use core::fmt;
+use io::{self, Read, Initializer, Write, ErrorKind}; +use io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use io::BufRead;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use io::{BufRead, IoVec, IoVecMut};
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
/// ///
@ -1818,15 +1697,7 @@ index 5ce955e..c7d8697 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1834,7 +1705,7 @@ index 5ce955e..c7d8697 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1842,7 +1713,7 @@ index 5ce955e..c7d8697 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1853,12 +1724,7 @@ index 5ce955e..c7d8697 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

File diff suppressed because it is too large Load Diff

View File

@ -970,8 +970,8 @@ index 5137a94..da64ab7 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1412,16 +1412,16 @@ index 5137a94..da64ab7 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1908,15 +1857,9 @@ impl<T: Read> Read for Take<T> { @@ -1909,6 +1858,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1916,7 +1866,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1429,7 +1429,7 @@ index 5137a94..da64ab7 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1943,13 +1886,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -1943,13 +1893,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1443,7 +1443,7 @@ index 5137a94..da64ab7 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1973,14 +1914,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1973,14 +1921,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1460,7 +1460,7 @@ index 5137a94..da64ab7 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2005,13 +1946,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2005,13 +1953,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1409,16 +1409,16 @@ index 076524e..0aa9ade 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1907,15 +1856,9 @@ impl<T: Read> Read for Take<T> { @@ -1908,6 +1857,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1915,7 +1865,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1426,7 +1426,7 @@ index 076524e..0aa9ade 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1954,13 +1897,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1954,13 +1904,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1440,7 +1440,7 @@ index 076524e..0aa9ade 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1976,14 +1917,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1976,14 +1924,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1457,7 +1457,7 @@ index 076524e..0aa9ade 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2008,13 +1949,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2008,13 +1956,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ index bf406bb..067523b 100644
+use core::fmt; +use core::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
-use crate::memchr; -use crate::memchr;
+use io::memchr; +use crate::io::memchr;
/// The `BufReader` struct adds buffering to any reader. /// The `BufReader` struct adds buffering to any reader.
/// ///
@ -311,21 +311,19 @@ diff --git a/cursor.rs b/cursor.rs
index 247d45c..f13522d 100644 index 247d45c..f13522d 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,9 +1,10 @@ @@ -1,9 +1,9 @@
use crate::io::prelude::*; use crate::io::prelude::*;
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+use core::cmp; +use core::cmp;
+use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind}; use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{IoVec, IoVecMut};
-use core::convert::TryInto; -use core::convert::TryInto;
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. /// [`Seek`] implementation.
@@ -71,7 +72,6 @@ use core::convert::TryInto; @@ -71,7 +71,6 @@ use core::convert::TryInto;
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -333,7 +331,7 @@ index 247d45c..f13522d 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -94,7 +94,6 @@ impl<T> Cursor<T> { @@ -94,7 +93,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -341,7 +339,7 @@ index 247d45c..f13522d 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -112,7 +111,6 @@ impl<T> Cursor<T> { @@ -112,7 +110,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -349,7 +347,7 @@ index 247d45c..f13522d 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -128,7 +126,6 @@ impl<T> Cursor<T> { @@ -128,7 +125,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -357,7 +355,7 @@ index 247d45c..f13522d 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -147,7 +144,6 @@ impl<T> Cursor<T> { @@ -147,7 +143,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -365,7 +363,7 @@ index 247d45c..f13522d 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -169,7 +165,6 @@ impl<T> Cursor<T> { @@ -169,7 +164,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -373,7 +371,7 @@ index 247d45c..f13522d 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -189,11 +184,9 @@ impl<T> Cursor<T> { @@ -189,11 +183,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -385,7 +383,7 @@ index 247d45c..f13522d 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -222,14 +215,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -222,10 +214,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -397,12 +395,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -244,7 +235,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -244,7 +237,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -411,7 +404,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -255,12 +248,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -255,12 +246,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -431,15 +424,7 @@ index 247d45c..f13522d 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -272,6 +269,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -290,6 +285,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -290,6 +288,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -447,7 +432,7 @@ index 247d45c..f13522d 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -316,6 +315,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -316,6 +312,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -455,7 +440,7 @@ index 247d45c..f13522d 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -329,13 +329,13 @@ fn vec_write_vectored( @@ -329,7 +326,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -463,14 +448,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -344,7 +340,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -344,12 +344,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -479,13 +457,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -357,7 +353,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -357,12 +358,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -494,13 +466,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -370,8 +366,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -370,13 +372,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -511,12 +477,6 @@ index 247d45c..f13522d 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index c29a68e..c94d8c5 100644 index c29a68e..c94d8c5 100644
--- a/error.rs --- a/error.rs
@ -844,7 +804,7 @@ diff --git a/impls.rs b/impls.rs
index 0eac96f..74d5f66 100644 index 0eac96f..74d5f66 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -852,8 +812,8 @@ index 0eac96f..74d5f66 100644
-use crate::mem; -use crate::mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -866,14 +826,7 @@ index 0eac96f..74d5f66 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -887,7 +840,7 @@ index 0eac96f..74d5f66 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -895,12 +848,7 @@ index 0eac96f..74d5f66 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -914,7 +862,7 @@ index 0eac96f..74d5f66 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -923,14 +871,7 @@ index 0eac96f..74d5f66 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -944,7 +885,7 @@ index 0eac96f..74d5f66 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -953,12 +894,7 @@ index 0eac96f..74d5f66 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -973,7 +909,7 @@ index 0eac96f..74d5f66 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -186,7 +194,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> { @@ -186,7 +190,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -981,15 +917,7 @@ index 0eac96f..74d5f66 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -206,6 +213,7 @@ impl Read for &[u8] { @@ -245,6 +248,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -245,6 +253,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -997,7 +925,7 @@ index 0eac96f..74d5f66 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -254,7 +263,7 @@ impl Read for &[u8] { @@ -254,7 +258,7 @@ impl Read for &[u8] {
} }
} }
@ -1006,7 +934,7 @@ index 0eac96f..74d5f66 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -268,7 +277,6 @@ impl BufRead for &[u8] { @@ -268,7 +272,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1014,15 +942,7 @@ index 0eac96f..74d5f66 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -279,6 +287,7 @@ impl Write for &mut [u8] { @@ -307,7 +310,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -307,7 +316,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1031,14 +951,6 @@ index 0eac96f..74d5f66 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -315,6 +324,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index 1ce66b9..fad199d 100644 index 1ce66b9..fad199d 100644
--- a/mod.rs --- a/mod.rs
@ -1072,9 +984,9 @@ index 1ce66b9..fad199d 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1134,23 +1046,7 @@ index 1ce66b9..fad199d 100644
fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R,
buf: &mut Vec<u8>, buf: &mut Vec<u8>,
reservation_size: usize) -> Result<usize> reservation_size: usize) -> Result<usize>
@@ -390,6 +381,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, @@ -484,7 +475,6 @@ where
ret
}
+#[cfg(feature="collections")]
pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoVecMut<'_>]) -> Result<usize>
where
F: FnOnce(&mut [u8]) -> Result<usize>
@@ -401,6 +393,7 @@ where
read(buf)
}
+#[cfg(feature="collections")]
pub(crate) fn default_write_vectored<F>(write: F, bufs: &[IoVec<'_>]) -> Result<usize>
where
F: FnOnce(&[u8]) -> Result<usize>
@@ -484,7 +477,6 @@ where
/// [`BufReader`]: struct.BufReader.html /// [`BufReader`]: struct.BufReader.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html
@ -1158,7 +1054,7 @@ index 1ce66b9..fad199d 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Read { pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning /// Pull some bytes from this source into the specified buffer, returning
@@ -543,7 +535,6 @@ pub trait Read { @@ -543,7 +533,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1166,16 +1062,15 @@ index 1ce66b9..fad199d 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -554,7 +545,7 @@ pub trait Read { @@ -554,7 +543,6 @@ pub trait Read {
/// ///
/// The default implementation calls `read` with either the first nonempty /// The default implementation calls `read` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
default_read_vectored(|b| self.read(b), bufs) default_read_vectored(|b| self.read(b), bufs)
} }
@@ -581,7 +572,6 @@ pub trait Read { @@ -581,7 +569,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1183,7 +1078,7 @@ index 1ce66b9..fad199d 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -634,7 +624,7 @@ pub trait Read { @@ -634,7 +621,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1192,7 +1087,7 @@ index 1ce66b9..fad199d 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -677,7 +667,7 @@ pub trait Read { @@ -677,7 +664,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1201,7 +1096,7 @@ index 1ce66b9..fad199d 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -740,7 +730,6 @@ pub trait Read { @@ -740,7 +727,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1209,7 +1104,7 @@ index 1ce66b9..fad199d 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -792,7 +781,6 @@ pub trait Read { @@ -792,7 +778,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1217,7 +1112,7 @@ index 1ce66b9..fad199d 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -829,7 +817,6 @@ pub trait Read { @@ -829,7 +814,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1225,7 +1120,7 @@ index 1ce66b9..fad199d 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -864,7 +851,6 @@ pub trait Read { @@ -864,7 +848,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1233,7 +1128,7 @@ index 1ce66b9..fad199d 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -900,42 +886,77 @@ pub trait Read { @@ -900,22 +883,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1243,10 +1138,8 @@ index 1ce66b9..fad199d 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1258,10 +1151,9 @@ index 1ce66b9..fad199d 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1285,23 +1177,15 @@ index 1ce66b9..fad199d 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -928,14 +941,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1314,41 +1198,31 @@ index 1ce66b9..fad199d 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -945,7 +966,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -945,7 +956,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -958,31 +979,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -958,11 +968,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -975,14 +983,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1361,11 +1235,10 @@ index 1ce66b9..fad199d 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -993,13 +1014,11 @@ impl<'a> Deref for IoVec<'a> { @@ -993,13 +999,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1379,7 +1252,7 @@ index 1ce66b9..fad199d 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -1013,21 +1032,18 @@ impl Initializer { @@ -1013,21 +1017,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1401,7 +1274,7 @@ index 1ce66b9..fad199d 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1081,7 +1097,6 @@ impl Initializer { @@ -1081,7 +1082,6 @@ impl Initializer {
/// `write` in a loop until its entire input has been written. /// `write` in a loop until its entire input has been written.
/// ///
/// [`write_all`]: #method.write_all /// [`write_all`]: #method.write_all
@ -1409,7 +1282,7 @@ index 1ce66b9..fad199d 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1130,7 +1145,6 @@ pub trait Write { @@ -1130,7 +1130,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1417,16 +1290,15 @@ index 1ce66b9..fad199d 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1141,7 +1155,7 @@ pub trait Write { @@ -1141,7 +1140,6 @@ pub trait Write {
/// ///
/// The default implementation calls `write` with either the first nonempty /// The default implementation calls `write` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
default_write_vectored(|b| self.write(b), bufs) default_write_vectored(|b| self.write(b), bufs)
} }
@@ -1169,7 +1183,6 @@ pub trait Write { @@ -1169,7 +1167,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1434,7 +1306,7 @@ index 1ce66b9..fad199d 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1202,7 +1215,6 @@ pub trait Write { @@ -1202,7 +1199,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1442,7 +1314,7 @@ index 1ce66b9..fad199d 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1254,7 +1266,6 @@ pub trait Write { @@ -1254,7 +1250,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1450,7 +1322,7 @@ index 1ce66b9..fad199d 100644
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1310,7 +1321,6 @@ pub trait Write { @@ -1310,7 +1305,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1458,7 +1330,7 @@ index 1ce66b9..fad199d 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1340,7 +1350,6 @@ pub trait Write { @@ -1340,7 +1334,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1466,7 +1338,7 @@ index 1ce66b9..fad199d 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1356,7 +1365,6 @@ pub trait Seek { @@ -1356,7 +1349,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1474,7 +1346,7 @@ index 1ce66b9..fad199d 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
/// Returns the length of this stream (in bytes). /// Returns the length of this stream (in bytes).
@@ -1394,7 +1402,6 @@ pub trait Seek { @@ -1394,7 +1386,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1482,7 +1354,7 @@ index 1ce66b9..fad199d 100644
fn stream_len(&mut self) -> Result<u64> { fn stream_len(&mut self) -> Result<u64> {
let old_pos = self.stream_position()?; let old_pos = self.stream_position()?;
let len = self.seek(SeekFrom::End(0))?; let len = self.seek(SeekFrom::End(0))?;
@@ -1433,7 +1440,6 @@ pub trait Seek { @@ -1433,7 +1424,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1490,7 +1362,7 @@ index 1ce66b9..fad199d 100644
fn stream_position(&mut self) -> Result<u64> { fn stream_position(&mut self) -> Result<u64> {
self.seek(SeekFrom::Current(0)) self.seek(SeekFrom::Current(0))
} }
@@ -1445,29 +1451,26 @@ pub trait Seek { @@ -1445,29 +1435,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1524,7 +1396,7 @@ index 1ce66b9..fad199d 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1547,7 +1550,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1547,7 +1534,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1533,7 +1405,7 @@ index 1ce66b9..fad199d 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1593,7 +1596,6 @@ pub trait BufRead: Read { @@ -1593,7 +1580,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1541,7 +1413,7 @@ index 1ce66b9..fad199d 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1615,7 +1617,6 @@ pub trait BufRead: Read { @@ -1615,7 +1601,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1549,7 +1421,7 @@ index 1ce66b9..fad199d 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1671,7 +1672,6 @@ pub trait BufRead: Read { @@ -1671,7 +1656,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1557,7 +1429,7 @@ index 1ce66b9..fad199d 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1730,7 +1730,6 @@ pub trait BufRead: Read { @@ -1730,7 +1714,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1565,7 +1437,7 @@ index 1ce66b9..fad199d 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1771,7 +1770,6 @@ pub trait BufRead: Read { @@ -1771,7 +1754,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1573,7 +1445,7 @@ index 1ce66b9..fad199d 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1810,7 +1808,6 @@ pub trait BufRead: Read { @@ -1810,7 +1792,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1581,7 +1453,7 @@ index 1ce66b9..fad199d 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1822,7 +1819,6 @@ pub trait BufRead: Read { @@ -1822,7 +1803,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1589,7 +1461,7 @@ index 1ce66b9..fad199d 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1848,7 +1844,6 @@ impl<T, U> Chain<T, U> { @@ -1848,7 +1828,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1597,7 +1469,7 @@ index 1ce66b9..fad199d 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1871,7 +1866,6 @@ impl<T, U> Chain<T, U> { @@ -1871,7 +1850,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1605,7 +1477,7 @@ index 1ce66b9..fad199d 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1898,13 +1892,11 @@ impl<T, U> Chain<T, U> { @@ -1898,13 +1876,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1619,7 +1491,7 @@ index 1ce66b9..fad199d 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1914,7 +1906,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1914,7 +1890,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1627,15 +1499,7 @@ index 1ce66b9..fad199d 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1926,6 +1917,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1946,7 +1921,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1946,7 +1938,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1644,7 +1508,7 @@ index 1ce66b9..fad199d 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1973,7 +1965,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1973,7 +1948,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1652,7 +1516,7 @@ index 1ce66b9..fad199d 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -2008,7 +1999,6 @@ impl<T> Take<T> { @@ -2008,7 +1982,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1660,7 +1524,7 @@ index 1ce66b9..fad199d 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -2034,7 +2024,6 @@ impl<T> Take<T> { @@ -2034,7 +2007,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1668,7 +1532,7 @@ index 1ce66b9..fad199d 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -2059,7 +2048,6 @@ impl<T> Take<T> { @@ -2059,7 +2031,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1676,7 +1540,7 @@ index 1ce66b9..fad199d 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -2084,7 +2072,6 @@ impl<T> Take<T> { @@ -2084,7 +2055,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1684,7 +1548,7 @@ index 1ce66b9..fad199d 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2113,13 +2100,11 @@ impl<T> Take<T> { @@ -2113,13 +2083,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1698,16 +1562,16 @@ index 1ce66b9..fad199d 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2136,15 +2121,9 @@ impl<T: Read> Read for Take<T> { @@ -2137,6 +2105,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2144,7 +2113,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1715,7 +1579,7 @@ index 1ce66b9..fad199d 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2171,13 +2150,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2171,13 +2140,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1729,7 +1593,7 @@ index 1ce66b9..fad199d 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2201,14 +2178,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2201,14 +2168,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1746,7 +1610,7 @@ index 1ce66b9..fad199d 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2233,13 +2210,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2233,13 +2200,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1789,8 +1653,8 @@ index d2638be..1296fe1 100644
-use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use crate::mem; -use crate::mem;
+use core::fmt; +use core::fmt;
+use crate::io::{self, Read, Initializer, Write, ErrorKind}; +use crate::io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVec, IoVecMut}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::mem; +use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
@ -1859,15 +1723,7 @@ index d2638be..1296fe1 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1875,7 +1731,7 @@ index d2638be..1296fe1 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1883,7 +1739,7 @@ index d2638be..1296fe1 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1894,12 +1750,7 @@ index d2638be..1296fe1 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1410,16 +1410,16 @@ index dc97701..6ea0b47 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1907,15 +1856,9 @@ impl<T: Read> Read for Take<T> { @@ -1908,6 +1857,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1915,7 +1865,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1427,7 +1427,7 @@ index dc97701..6ea0b47 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1954,13 +1897,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1954,13 +1904,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1441,7 +1441,7 @@ index dc97701..6ea0b47 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1976,14 +1917,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1976,14 +1924,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1458,7 +1458,7 @@ index dc97701..6ea0b47 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2008,13 +1949,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2008,13 +1956,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

View File

@ -962,8 +962,8 @@ index 28a6fbd..2f5ae43 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1404,16 +1404,16 @@ index 28a6fbd..2f5ae43 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1898,15 +1847,9 @@ impl<T: Read> Read for Take<T> { @@ -1899,6 +1848,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1906,7 +1856,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1421,7 +1421,7 @@ index 28a6fbd..2f5ae43 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1933,13 +1876,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -1933,13 +1883,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1435,7 +1435,7 @@ index 28a6fbd..2f5ae43 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1963,14 +1904,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1963,14 +1911,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1452,7 +1452,7 @@ index 28a6fbd..2f5ae43 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -1995,13 +1936,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -1995,13 +1943,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1496,8 +1496,8 @@ index 8df961a..2b08122 100644
-use mem; -use mem;
+use core::fmt; +use core::fmt;
+use io::{self, Read, Initializer, Write, ErrorKind}; +use io::{self, Read, Initializer, Write, ErrorKind};
+use core::mem;
+#[cfg(feature="collections")] use io::BufRead; +#[cfg(feature="collections")] use io::BufRead;
+use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
/// ///

View File

@ -962,8 +962,8 @@ index 040669b..ee4d22c 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1404,16 +1404,16 @@ index 040669b..ee4d22c 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1898,15 +1847,9 @@ impl<T: Read> Read for Take<T> { @@ -1899,6 +1848,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1906,7 +1856,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1421,7 +1421,7 @@ index 040669b..ee4d22c 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1933,13 +1876,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -1933,13 +1883,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1435,7 +1435,7 @@ index 040669b..ee4d22c 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1963,14 +1904,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1963,14 +1911,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1452,7 +1452,7 @@ index 040669b..ee4d22c 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -1995,13 +1936,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -1995,13 +1943,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1496,8 +1496,8 @@ index 8df961a..2b08122 100644
-use mem; -use mem;
+use core::fmt; +use core::fmt;
+use io::{self, Read, Initializer, Write, ErrorKind}; +use io::{self, Read, Initializer, Write, ErrorKind};
+use core::mem;
+#[cfg(feature="collections")] use io::BufRead; +#[cfg(feature="collections")] use io::BufRead;
+use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
/// ///

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1408,16 +1408,16 @@ index b83f3fb..883fa30 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1906,15 +1855,9 @@ impl<T: Read> Read for Take<T> { @@ -1907,6 +1856,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1914,7 +1864,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1425,7 +1425,7 @@ index b83f3fb..883fa30 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1953,13 +1896,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1953,13 +1903,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1439,7 +1439,7 @@ index b83f3fb..883fa30 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1975,14 +1916,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1975,14 +1923,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1456,7 +1456,7 @@ index b83f3fb..883fa30 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2007,13 +1948,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2007,13 +1955,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ index 3370a44..f1f0573 100644
+use core::fmt; +use core::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
-use crate::memchr; -use crate::memchr;
+use io::memchr; +use crate::io::memchr;
/// The `BufReader` struct adds buffering to any reader. /// The `BufReader` struct adds buffering to any reader.
/// ///
@ -311,21 +311,19 @@ diff --git a/cursor.rs b/cursor.rs
index 247d45c..f13522d 100644 index 247d45c..f13522d 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,9 +1,10 @@ @@ -1,9 +1,9 @@
use crate::io::prelude::*; use crate::io::prelude::*;
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+use core::cmp; +use core::cmp;
+use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind}; use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{IoVec, IoVecMut};
-use core::convert::TryInto; -use core::convert::TryInto;
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. /// [`Seek`] implementation.
@@ -71,7 +72,6 @@ use core::convert::TryInto; @@ -71,7 +71,6 @@ use core::convert::TryInto;
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -333,7 +331,7 @@ index 247d45c..f13522d 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -94,7 +94,6 @@ impl<T> Cursor<T> { @@ -94,7 +93,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -341,7 +339,7 @@ index 247d45c..f13522d 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -112,7 +111,6 @@ impl<T> Cursor<T> { @@ -112,7 +110,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -349,7 +347,7 @@ index 247d45c..f13522d 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -128,7 +126,6 @@ impl<T> Cursor<T> { @@ -128,7 +125,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -357,7 +355,7 @@ index 247d45c..f13522d 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -147,7 +144,6 @@ impl<T> Cursor<T> { @@ -147,7 +143,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -365,7 +363,7 @@ index 247d45c..f13522d 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -169,7 +165,6 @@ impl<T> Cursor<T> { @@ -169,7 +164,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -373,7 +371,7 @@ index 247d45c..f13522d 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -189,11 +184,9 @@ impl<T> Cursor<T> { @@ -189,11 +183,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -385,7 +383,7 @@ index 247d45c..f13522d 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -222,14 +215,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -222,10 +214,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -397,12 +395,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -244,7 +235,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -244,7 +237,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -411,7 +404,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -255,12 +248,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -255,12 +246,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -431,15 +424,7 @@ index 247d45c..f13522d 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -272,6 +269,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -290,6 +285,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -290,6 +288,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -447,7 +432,7 @@ index 247d45c..f13522d 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -316,6 +315,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -316,6 +312,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -455,7 +440,7 @@ index 247d45c..f13522d 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -329,13 +329,13 @@ fn vec_write_vectored( @@ -329,7 +326,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -463,14 +448,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -344,7 +340,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -344,12 +344,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -479,13 +457,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -357,7 +353,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -357,12 +358,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -494,13 +466,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -370,8 +366,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -370,13 +372,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -511,12 +477,6 @@ index 247d45c..f13522d 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index c29a68e..c94d8c5 100644 index c29a68e..c94d8c5 100644
--- a/error.rs --- a/error.rs
@ -844,7 +804,7 @@ diff --git a/impls.rs b/impls.rs
index 0eac96f..74d5f66 100644 index 0eac96f..74d5f66 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -852,8 +812,8 @@ index 0eac96f..74d5f66 100644
-use crate::mem; -use crate::mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -866,14 +826,7 @@ index 0eac96f..74d5f66 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -887,7 +840,7 @@ index 0eac96f..74d5f66 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -895,12 +848,7 @@ index 0eac96f..74d5f66 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -914,7 +862,7 @@ index 0eac96f..74d5f66 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -923,14 +871,7 @@ index 0eac96f..74d5f66 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -944,7 +885,7 @@ index 0eac96f..74d5f66 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -953,12 +894,7 @@ index 0eac96f..74d5f66 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -973,7 +909,7 @@ index 0eac96f..74d5f66 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -186,7 +194,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> { @@ -186,7 +190,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -981,15 +917,7 @@ index 0eac96f..74d5f66 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -206,6 +213,7 @@ impl Read for &[u8] { @@ -245,6 +248,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -245,6 +253,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -997,7 +925,7 @@ index 0eac96f..74d5f66 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -254,7 +263,7 @@ impl Read for &[u8] { @@ -254,7 +258,7 @@ impl Read for &[u8] {
} }
} }
@ -1006,7 +934,7 @@ index 0eac96f..74d5f66 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -268,7 +277,6 @@ impl BufRead for &[u8] { @@ -268,7 +272,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1014,15 +942,7 @@ index 0eac96f..74d5f66 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -279,6 +287,7 @@ impl Write for &mut [u8] { @@ -307,7 +310,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -307,7 +316,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1031,16 +951,8 @@ index 0eac96f..74d5f66 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -315,6 +324,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index 1ce66b9..fad199d 100644 index 1ce66b9..6e83804 100644
--- a/mod.rs --- a/mod.rs
+++ b/mod.rs +++ b/mod.rs
@@ -257,50 +257,38 @@ @@ -257,50 +257,38 @@
@ -1072,9 +984,9 @@ index 1ce66b9..fad199d 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1134,23 +1046,7 @@ index 1ce66b9..fad199d 100644
fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R,
buf: &mut Vec<u8>, buf: &mut Vec<u8>,
reservation_size: usize) -> Result<usize> reservation_size: usize) -> Result<usize>
@@ -390,6 +381,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, @@ -484,7 +475,6 @@ where
ret
}
+#[cfg(feature="collections")]
pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoVecMut<'_>]) -> Result<usize>
where
F: FnOnce(&mut [u8]) -> Result<usize>
@@ -401,6 +393,7 @@ where
read(buf)
}
+#[cfg(feature="collections")]
pub(crate) fn default_write_vectored<F>(write: F, bufs: &[IoVec<'_>]) -> Result<usize>
where
F: FnOnce(&[u8]) -> Result<usize>
@@ -484,7 +477,6 @@ where
/// [`BufReader`]: struct.BufReader.html /// [`BufReader`]: struct.BufReader.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html
@ -1158,7 +1054,7 @@ index 1ce66b9..fad199d 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Read { pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning /// Pull some bytes from this source into the specified buffer, returning
@@ -543,7 +535,6 @@ pub trait Read { @@ -543,7 +533,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1166,16 +1062,15 @@ index 1ce66b9..fad199d 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -554,7 +545,7 @@ pub trait Read { @@ -554,7 +543,6 @@ pub trait Read {
/// ///
/// The default implementation calls `read` with either the first nonempty /// The default implementation calls `read` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
default_read_vectored(|b| self.read(b), bufs) default_read_vectored(|b| self.read(b), bufs)
} }
@@ -581,7 +572,6 @@ pub trait Read { @@ -581,7 +569,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1183,7 +1078,7 @@ index 1ce66b9..fad199d 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -634,7 +624,7 @@ pub trait Read { @@ -634,7 +621,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1192,7 +1087,7 @@ index 1ce66b9..fad199d 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -677,7 +667,7 @@ pub trait Read { @@ -677,7 +664,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1201,7 +1096,7 @@ index 1ce66b9..fad199d 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -740,7 +730,6 @@ pub trait Read { @@ -740,7 +727,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1209,7 +1104,7 @@ index 1ce66b9..fad199d 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -792,7 +781,6 @@ pub trait Read { @@ -792,7 +778,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1217,7 +1112,7 @@ index 1ce66b9..fad199d 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -829,7 +817,6 @@ pub trait Read { @@ -829,7 +814,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1225,7 +1120,7 @@ index 1ce66b9..fad199d 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -864,7 +851,6 @@ pub trait Read { @@ -864,7 +848,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1233,7 +1128,7 @@ index 1ce66b9..fad199d 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -900,42 +886,77 @@ pub trait Read { @@ -900,22 +883,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1243,10 +1138,8 @@ index 1ce66b9..fad199d 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1258,10 +1151,9 @@ index 1ce66b9..fad199d 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1285,23 +1177,15 @@ index 1ce66b9..fad199d 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -928,14 +941,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1314,41 +1198,31 @@ index 1ce66b9..fad199d 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -945,7 +966,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -945,7 +956,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -958,31 +979,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -958,11 +968,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -975,14 +983,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1361,11 +1235,10 @@ index 1ce66b9..fad199d 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -993,13 +1014,11 @@ impl<'a> Deref for IoVec<'a> { @@ -993,13 +999,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1379,7 +1252,7 @@ index 1ce66b9..fad199d 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -1013,21 +1032,18 @@ impl Initializer { @@ -1013,21 +1017,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1401,7 +1274,7 @@ index 1ce66b9..fad199d 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1081,7 +1097,6 @@ impl Initializer { @@ -1081,7 +1082,6 @@ impl Initializer {
/// `write` in a loop until its entire input has been written. /// `write` in a loop until its entire input has been written.
/// ///
/// [`write_all`]: #method.write_all /// [`write_all`]: #method.write_all
@ -1409,7 +1282,7 @@ index 1ce66b9..fad199d 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1130,7 +1145,6 @@ pub trait Write { @@ -1130,7 +1130,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1417,16 +1290,15 @@ index 1ce66b9..fad199d 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1141,7 +1155,7 @@ pub trait Write { @@ -1141,7 +1140,6 @@ pub trait Write {
/// ///
/// The default implementation calls `write` with either the first nonempty /// The default implementation calls `write` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
default_write_vectored(|b| self.write(b), bufs) default_write_vectored(|b| self.write(b), bufs)
} }
@@ -1169,7 +1183,6 @@ pub trait Write { @@ -1169,7 +1167,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1434,7 +1306,7 @@ index 1ce66b9..fad199d 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1202,7 +1215,6 @@ pub trait Write { @@ -1202,7 +1199,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1442,7 +1314,7 @@ index 1ce66b9..fad199d 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1254,7 +1266,6 @@ pub trait Write { @@ -1254,7 +1250,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1450,7 +1322,7 @@ index 1ce66b9..fad199d 100644
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1310,7 +1321,6 @@ pub trait Write { @@ -1310,7 +1305,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1458,7 +1330,7 @@ index 1ce66b9..fad199d 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1340,7 +1350,6 @@ pub trait Write { @@ -1340,7 +1334,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1466,7 +1338,7 @@ index 1ce66b9..fad199d 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1356,7 +1365,6 @@ pub trait Seek { @@ -1356,7 +1349,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1474,7 +1346,7 @@ index 1ce66b9..fad199d 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
/// Returns the length of this stream (in bytes). /// Returns the length of this stream (in bytes).
@@ -1394,7 +1402,6 @@ pub trait Seek { @@ -1394,7 +1386,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1482,7 +1354,7 @@ index 1ce66b9..fad199d 100644
fn stream_len(&mut self) -> Result<u64> { fn stream_len(&mut self) -> Result<u64> {
let old_pos = self.stream_position()?; let old_pos = self.stream_position()?;
let len = self.seek(SeekFrom::End(0))?; let len = self.seek(SeekFrom::End(0))?;
@@ -1433,7 +1440,6 @@ pub trait Seek { @@ -1433,7 +1424,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1490,7 +1362,7 @@ index 1ce66b9..fad199d 100644
fn stream_position(&mut self) -> Result<u64> { fn stream_position(&mut self) -> Result<u64> {
self.seek(SeekFrom::Current(0)) self.seek(SeekFrom::Current(0))
} }
@@ -1445,29 +1451,26 @@ pub trait Seek { @@ -1445,29 +1435,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1524,7 +1396,7 @@ index 1ce66b9..fad199d 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1547,7 +1550,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1547,7 +1534,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1533,7 +1405,7 @@ index 1ce66b9..fad199d 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1593,7 +1596,6 @@ pub trait BufRead: Read { @@ -1593,7 +1580,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1541,7 +1413,7 @@ index 1ce66b9..fad199d 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1615,7 +1617,6 @@ pub trait BufRead: Read { @@ -1615,7 +1601,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1549,7 +1421,7 @@ index 1ce66b9..fad199d 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1671,7 +1672,6 @@ pub trait BufRead: Read { @@ -1671,7 +1656,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1557,7 +1429,7 @@ index 1ce66b9..fad199d 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1730,7 +1730,6 @@ pub trait BufRead: Read { @@ -1730,7 +1714,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1565,7 +1437,7 @@ index 1ce66b9..fad199d 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1771,7 +1770,6 @@ pub trait BufRead: Read { @@ -1771,7 +1754,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1573,7 +1445,7 @@ index 1ce66b9..fad199d 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1810,7 +1808,6 @@ pub trait BufRead: Read { @@ -1810,7 +1792,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1581,7 +1453,7 @@ index 1ce66b9..fad199d 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1822,7 +1819,6 @@ pub trait BufRead: Read { @@ -1822,7 +1803,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1589,7 +1461,7 @@ index 1ce66b9..fad199d 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1848,7 +1844,6 @@ impl<T, U> Chain<T, U> { @@ -1848,7 +1828,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1597,7 +1469,7 @@ index 1ce66b9..fad199d 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1871,7 +1866,6 @@ impl<T, U> Chain<T, U> { @@ -1871,7 +1850,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1605,7 +1477,7 @@ index 1ce66b9..fad199d 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1898,13 +1892,11 @@ impl<T, U> Chain<T, U> { @@ -1898,13 +1876,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1619,7 +1491,7 @@ index 1ce66b9..fad199d 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1914,7 +1906,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1914,7 +1890,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1627,15 +1499,7 @@ index 1ce66b9..fad199d 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1926,6 +1917,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1946,7 +1921,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1946,7 +1938,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1644,7 +1508,7 @@ index 1ce66b9..fad199d 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1973,7 +1965,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1973,7 +1948,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1652,7 +1516,7 @@ index 1ce66b9..fad199d 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -2008,7 +1999,6 @@ impl<T> Take<T> { @@ -2008,7 +1982,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1660,7 +1524,7 @@ index 1ce66b9..fad199d 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -2034,7 +2024,6 @@ impl<T> Take<T> { @@ -2034,7 +2007,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1668,7 +1532,7 @@ index 1ce66b9..fad199d 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -2059,7 +2048,6 @@ impl<T> Take<T> { @@ -2059,7 +2031,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1676,7 +1540,7 @@ index 1ce66b9..fad199d 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -2084,7 +2072,6 @@ impl<T> Take<T> { @@ -2084,7 +2055,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1684,7 +1548,7 @@ index 1ce66b9..fad199d 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2113,13 +2100,11 @@ impl<T> Take<T> { @@ -2113,13 +2083,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1698,16 +1562,16 @@ index 1ce66b9..fad199d 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2136,15 +2121,9 @@ impl<T: Read> Read for Take<T> { @@ -2137,6 +2105,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2144,7 +2113,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1715,7 +1579,7 @@ index 1ce66b9..fad199d 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2171,13 +2150,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2171,13 +2140,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1729,7 +1593,7 @@ index 1ce66b9..fad199d 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2201,14 +2178,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2201,14 +2168,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1746,7 +1610,7 @@ index 1ce66b9..fad199d 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2233,13 +2210,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2233,13 +2200,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1789,8 +1653,8 @@ index d2638be..1296fe1 100644
-use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use crate::mem; -use crate::mem;
+use core::fmt; +use core::fmt;
+use crate::io::{self, Read, Initializer, Write, ErrorKind}; +use crate::io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVec, IoVecMut}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::mem; +use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
@ -1859,15 +1723,7 @@ index d2638be..1296fe1 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1875,7 +1731,7 @@ index d2638be..1296fe1 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1883,7 +1739,7 @@ index d2638be..1296fe1 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1894,12 +1750,7 @@ index d2638be..1296fe1 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index 278ee79..ebe2495 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1907,15 +1856,9 @@ impl<T: Read> Read for Take<T> { @@ -1908,6 +1857,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1915,7 +1865,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index 278ee79..ebe2495 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1954,13 +1897,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1954,13 +1904,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index 278ee79..ebe2495 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1976,14 +1917,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1976,14 +1924,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index 278ee79..ebe2495 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2008,13 +1949,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2008,13 +1956,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index b83f3fb..883fa30 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1906,15 +1855,9 @@ impl<T: Read> Read for Take<T> { @@ -1907,6 +1856,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1914,7 +1864,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index b83f3fb..883fa30 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1953,13 +1896,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1953,13 +1903,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index b83f3fb..883fa30 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1975,14 +1916,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1975,14 +1923,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index b83f3fb..883fa30 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2007,13 +1948,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2007,13 +1955,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index e263db2..2176464 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1907,15 +1856,9 @@ impl<T: Read> Read for Take<T> { @@ -1908,6 +1857,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1915,7 +1865,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index e263db2..2176464 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1954,13 +1897,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1954,13 +1904,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index e263db2..2176464 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1976,14 +1917,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1976,14 +1924,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index e263db2..2176464 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2008,13 +1949,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2008,13 +1956,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index b83f3fb..883fa30 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1906,15 +1855,9 @@ impl<T: Read> Read for Take<T> { @@ -1907,6 +1856,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1914,7 +1864,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index b83f3fb..883fa30 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1953,13 +1896,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1953,13 +1903,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index b83f3fb..883fa30 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1975,14 +1916,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1975,14 +1923,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index b83f3fb..883fa30 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2007,13 +1948,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2007,13 +1955,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index b83f3fb..883fa30 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1906,15 +1855,9 @@ impl<T: Read> Read for Take<T> { @@ -1907,6 +1856,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1914,7 +1864,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index b83f3fb..883fa30 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1953,13 +1896,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1953,13 +1903,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index b83f3fb..883fa30 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1975,14 +1916,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1975,14 +1923,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index b83f3fb..883fa30 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2007,13 +1948,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2007,13 +1955,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ index 4668e3e..4c125bd 100644
+use core::fmt; +use core::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
-use crate::memchr; -use crate::memchr;
+use io::memchr; +use crate::io::memchr;
/// The `BufReader` struct adds buffering to any reader. /// The `BufReader` struct adds buffering to any reader.
/// ///
@ -308,24 +308,22 @@ index 4668e3e..4c125bd 100644
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("LineWriter") fmt.debug_struct("LineWriter")
diff --git a/cursor.rs b/cursor.rs diff --git a/cursor.rs b/cursor.rs
index 247d45c..f13522d 100644 index 247d45c..d47179e 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,9 +1,10 @@ @@ -1,9 +1,9 @@
use crate::io::prelude::*; use crate::io::prelude::*;
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+use core::cmp; +use core::cmp;
+use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind}; use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{IoVec, IoVecMut};
-use core::convert::TryInto; -use core::convert::TryInto;
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. /// [`Seek`] implementation.
@@ -71,7 +72,6 @@ use core::convert::TryInto; @@ -71,7 +71,6 @@ use core::convert::TryInto;
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -333,7 +331,7 @@ index 247d45c..f13522d 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -94,7 +94,6 @@ impl<T> Cursor<T> { @@ -94,7 +93,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -341,7 +339,7 @@ index 247d45c..f13522d 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -112,7 +111,6 @@ impl<T> Cursor<T> { @@ -112,7 +110,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -349,7 +347,7 @@ index 247d45c..f13522d 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -128,7 +126,6 @@ impl<T> Cursor<T> { @@ -128,7 +125,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -357,7 +355,7 @@ index 247d45c..f13522d 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -147,7 +144,6 @@ impl<T> Cursor<T> { @@ -147,7 +143,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -365,7 +363,7 @@ index 247d45c..f13522d 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -169,7 +165,6 @@ impl<T> Cursor<T> { @@ -169,7 +164,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -373,7 +371,7 @@ index 247d45c..f13522d 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -189,11 +184,9 @@ impl<T> Cursor<T> { @@ -189,11 +183,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -385,7 +383,7 @@ index 247d45c..f13522d 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -222,14 +215,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -222,10 +214,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -397,12 +395,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -244,7 +235,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -244,7 +237,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -411,7 +404,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -255,12 +248,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -255,12 +246,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -431,15 +424,7 @@ index 247d45c..f13522d 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -272,6 +269,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -290,6 +285,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -290,6 +288,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -447,7 +432,7 @@ index 247d45c..f13522d 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -316,6 +315,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -316,6 +312,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -455,7 +440,7 @@ index 247d45c..f13522d 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -329,13 +329,13 @@ fn vec_write_vectored( @@ -329,7 +326,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -463,14 +448,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -344,7 +340,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -344,12 +344,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -479,13 +457,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -357,7 +353,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -357,12 +358,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -494,13 +466,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -370,8 +366,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -370,13 +372,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -511,12 +477,6 @@ index 247d45c..f13522d 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index 614b791..e4ce8b5 100644 index 614b791..e4ce8b5 100644
--- a/error.rs --- a/error.rs
@ -844,7 +804,7 @@ diff --git a/impls.rs b/impls.rs
index b286e40..7472d9c 100644 index b286e40..7472d9c 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -852,8 +812,8 @@ index b286e40..7472d9c 100644
-use crate::mem; -use crate::mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -866,14 +826,7 @@ index b286e40..7472d9c 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -887,7 +840,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -895,12 +848,7 @@ index b286e40..7472d9c 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -914,7 +862,7 @@ index b286e40..7472d9c 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -923,14 +871,7 @@ index b286e40..7472d9c 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -944,7 +885,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -953,12 +894,7 @@ index b286e40..7472d9c 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -973,7 +909,7 @@ index b286e40..7472d9c 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -186,7 +194,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> { @@ -186,7 +190,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -981,15 +917,7 @@ index b286e40..7472d9c 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -206,6 +213,7 @@ impl Read for &[u8] { @@ -245,6 +248,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -245,6 +253,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -997,7 +925,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -254,7 +263,7 @@ impl Read for &[u8] { @@ -254,7 +258,7 @@ impl Read for &[u8] {
} }
} }
@ -1006,7 +934,7 @@ index b286e40..7472d9c 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -268,7 +277,6 @@ impl BufRead for &[u8] { @@ -268,7 +272,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1014,15 +942,7 @@ index b286e40..7472d9c 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -279,6 +287,7 @@ impl Write for &mut [u8] { @@ -307,7 +310,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -307,7 +316,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1031,14 +951,6 @@ index b286e40..7472d9c 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -315,6 +324,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index 4c88fc8..2059b5a 100644 index 4c88fc8..2059b5a 100644
--- a/mod.rs --- a/mod.rs
@ -1072,9 +984,9 @@ index 4c88fc8..2059b5a 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1134,23 +1046,7 @@ index 4c88fc8..2059b5a 100644
fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R,
buf: &mut Vec<u8>, buf: &mut Vec<u8>,
reservation_size: usize) -> Result<usize> reservation_size: usize) -> Result<usize>
@@ -390,6 +381,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, @@ -484,7 +475,6 @@ where
ret
}
+#[cfg(feature="collections")]
pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoVecMut<'_>]) -> Result<usize>
where
F: FnOnce(&mut [u8]) -> Result<usize>
@@ -401,6 +393,7 @@ where
read(buf)
}
+#[cfg(feature="collections")]
pub(crate) fn default_write_vectored<F>(write: F, bufs: &[IoVec<'_>]) -> Result<usize>
where
F: FnOnce(&[u8]) -> Result<usize>
@@ -484,7 +477,6 @@ where
/// [`BufReader`]: struct.BufReader.html /// [`BufReader`]: struct.BufReader.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html
@ -1158,7 +1054,7 @@ index 4c88fc8..2059b5a 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Read { pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning /// Pull some bytes from this source into the specified buffer, returning
@@ -541,7 +533,6 @@ pub trait Read { @@ -541,7 +531,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1166,16 +1062,15 @@ index 4c88fc8..2059b5a 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -552,7 +543,7 @@ pub trait Read { @@ -552,7 +541,6 @@ pub trait Read {
/// ///
/// The default implementation calls `read` with either the first nonempty /// The default implementation calls `read` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
default_read_vectored(|b| self.read(b), bufs) default_read_vectored(|b| self.read(b), bufs)
} }
@@ -579,7 +570,6 @@ pub trait Read { @@ -579,7 +567,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1183,7 +1078,7 @@ index 4c88fc8..2059b5a 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -632,7 +622,7 @@ pub trait Read { @@ -632,7 +619,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1192,7 +1087,7 @@ index 4c88fc8..2059b5a 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -675,7 +665,7 @@ pub trait Read { @@ -675,7 +662,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1201,7 +1096,7 @@ index 4c88fc8..2059b5a 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -738,7 +728,6 @@ pub trait Read { @@ -738,7 +725,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1209,7 +1104,7 @@ index 4c88fc8..2059b5a 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -790,7 +779,6 @@ pub trait Read { @@ -790,7 +776,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1217,7 +1112,7 @@ index 4c88fc8..2059b5a 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -827,7 +815,6 @@ pub trait Read { @@ -827,7 +812,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1225,7 +1120,7 @@ index 4c88fc8..2059b5a 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -862,7 +849,6 @@ pub trait Read { @@ -862,7 +846,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1233,7 +1128,7 @@ index 4c88fc8..2059b5a 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -898,42 +884,77 @@ pub trait Read { @@ -898,22 +881,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1243,10 +1138,8 @@ index 4c88fc8..2059b5a 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1258,10 +1151,9 @@ index 4c88fc8..2059b5a 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1285,23 +1177,15 @@ index 4c88fc8..2059b5a 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -926,14 +939,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1314,41 +1198,31 @@ index 4c88fc8..2059b5a 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -943,7 +964,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -943,7 +954,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -956,31 +977,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -956,11 +966,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -973,14 +981,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1361,11 +1235,10 @@ index 4c88fc8..2059b5a 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -991,13 +1012,11 @@ impl<'a> Deref for IoVec<'a> { @@ -991,13 +997,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1379,7 +1252,7 @@ index 4c88fc8..2059b5a 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -1011,21 +1030,18 @@ impl Initializer { @@ -1011,21 +1015,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1401,7 +1274,7 @@ index 4c88fc8..2059b5a 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1068,7 +1084,6 @@ impl Initializer { @@ -1068,7 +1069,6 @@ impl Initializer {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1409,7 +1282,7 @@ index 4c88fc8..2059b5a 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1117,7 +1132,6 @@ pub trait Write { @@ -1117,7 +1117,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1417,16 +1290,15 @@ index 4c88fc8..2059b5a 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1128,7 +1142,7 @@ pub trait Write { @@ -1128,7 +1127,6 @@ pub trait Write {
/// ///
/// The default implementation calls `write` with either the first nonempty /// The default implementation calls `write` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
default_write_vectored(|b| self.write(b), bufs) default_write_vectored(|b| self.write(b), bufs)
} }
@@ -1156,7 +1170,6 @@ pub trait Write { @@ -1156,7 +1154,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1434,7 +1306,7 @@ index 4c88fc8..2059b5a 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1189,7 +1202,6 @@ pub trait Write { @@ -1189,7 +1186,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1442,7 +1314,7 @@ index 4c88fc8..2059b5a 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1241,7 +1253,6 @@ pub trait Write { @@ -1241,7 +1237,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1450,7 +1322,7 @@ index 4c88fc8..2059b5a 100644
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1297,7 +1308,6 @@ pub trait Write { @@ -1297,7 +1292,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1458,7 +1330,7 @@ index 4c88fc8..2059b5a 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1327,7 +1337,6 @@ pub trait Write { @@ -1327,7 +1321,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1466,7 +1338,7 @@ index 4c88fc8..2059b5a 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1343,7 +1352,6 @@ pub trait Seek { @@ -1343,7 +1336,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1474,7 +1346,7 @@ index 4c88fc8..2059b5a 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
/// Returns the length of this stream (in bytes). /// Returns the length of this stream (in bytes).
@@ -1381,7 +1389,6 @@ pub trait Seek { @@ -1381,7 +1373,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1482,7 +1354,7 @@ index 4c88fc8..2059b5a 100644
fn stream_len(&mut self) -> Result<u64> { fn stream_len(&mut self) -> Result<u64> {
let old_pos = self.stream_position()?; let old_pos = self.stream_position()?;
let len = self.seek(SeekFrom::End(0))?; let len = self.seek(SeekFrom::End(0))?;
@@ -1420,7 +1427,6 @@ pub trait Seek { @@ -1420,7 +1411,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1490,7 +1362,7 @@ index 4c88fc8..2059b5a 100644
fn stream_position(&mut self) -> Result<u64> { fn stream_position(&mut self) -> Result<u64> {
self.seek(SeekFrom::Current(0)) self.seek(SeekFrom::Current(0))
} }
@@ -1432,29 +1438,26 @@ pub trait Seek { @@ -1432,29 +1422,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1524,7 +1396,7 @@ index 4c88fc8..2059b5a 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1534,7 +1537,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1534,7 +1521,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1533,7 +1405,7 @@ index 4c88fc8..2059b5a 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1580,7 +1583,6 @@ pub trait BufRead: Read { @@ -1580,7 +1567,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1541,7 +1413,7 @@ index 4c88fc8..2059b5a 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1602,7 +1604,6 @@ pub trait BufRead: Read { @@ -1602,7 +1588,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1549,7 +1421,7 @@ index 4c88fc8..2059b5a 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1658,7 +1659,6 @@ pub trait BufRead: Read { @@ -1658,7 +1643,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1557,7 +1429,7 @@ index 4c88fc8..2059b5a 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1717,7 +1717,6 @@ pub trait BufRead: Read { @@ -1717,7 +1701,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1565,7 +1437,7 @@ index 4c88fc8..2059b5a 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1758,7 +1757,6 @@ pub trait BufRead: Read { @@ -1758,7 +1741,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1573,7 +1445,7 @@ index 4c88fc8..2059b5a 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1797,7 +1795,6 @@ pub trait BufRead: Read { @@ -1797,7 +1779,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1581,7 +1453,7 @@ index 4c88fc8..2059b5a 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1809,7 +1806,6 @@ pub trait BufRead: Read { @@ -1809,7 +1790,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1589,7 +1461,7 @@ index 4c88fc8..2059b5a 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1835,7 +1831,6 @@ impl<T, U> Chain<T, U> { @@ -1835,7 +1815,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1597,7 +1469,7 @@ index 4c88fc8..2059b5a 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1858,7 +1853,6 @@ impl<T, U> Chain<T, U> { @@ -1858,7 +1837,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1605,7 +1477,7 @@ index 4c88fc8..2059b5a 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1885,13 +1879,11 @@ impl<T, U> Chain<T, U> { @@ -1885,13 +1863,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1619,7 +1491,7 @@ index 4c88fc8..2059b5a 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1901,7 +1893,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1901,7 +1877,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1627,15 +1499,7 @@ index 4c88fc8..2059b5a 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1913,6 +1904,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1933,7 +1908,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1933,7 +1925,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1644,7 +1508,7 @@ index 4c88fc8..2059b5a 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1960,7 +1952,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1960,7 +1935,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1652,7 +1516,7 @@ index 4c88fc8..2059b5a 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -1995,7 +1986,6 @@ impl<T> Take<T> { @@ -1995,7 +1969,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1660,7 +1524,7 @@ index 4c88fc8..2059b5a 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -2021,7 +2011,6 @@ impl<T> Take<T> { @@ -2021,7 +1994,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1668,7 +1532,7 @@ index 4c88fc8..2059b5a 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -2046,7 +2035,6 @@ impl<T> Take<T> { @@ -2046,7 +2018,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1676,7 +1540,7 @@ index 4c88fc8..2059b5a 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -2071,7 +2059,6 @@ impl<T> Take<T> { @@ -2071,7 +2042,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1684,7 +1548,7 @@ index 4c88fc8..2059b5a 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2100,13 +2087,11 @@ impl<T> Take<T> { @@ -2100,13 +2070,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1698,16 +1562,16 @@ index 4c88fc8..2059b5a 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2123,15 +2108,9 @@ impl<T: Read> Read for Take<T> { @@ -2124,6 +2092,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2131,7 +2100,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1715,7 +1579,7 @@ index 4c88fc8..2059b5a 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2158,13 +2137,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2158,13 +2127,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1729,7 +1593,7 @@ index 4c88fc8..2059b5a 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2188,14 +2165,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2188,14 +2155,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1746,7 +1610,7 @@ index 4c88fc8..2059b5a 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2220,13 +2197,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2220,13 +2187,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1789,8 +1653,8 @@ index 6aaf8f1..447ce47 100644
-use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use crate::mem; -use crate::mem;
+use core::fmt; +use core::fmt;
+use crate::io::{self, Read, Initializer, Write, ErrorKind}; +use crate::io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVec, IoVecMut}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::mem; +use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
@ -1859,15 +1723,7 @@ index 6aaf8f1..447ce47 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1875,7 +1731,7 @@ index 6aaf8f1..447ce47 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1883,7 +1739,7 @@ index 6aaf8f1..447ce47 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1894,12 +1750,7 @@ index 6aaf8f1..447ce47 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ index 441f6b9..540d4aa 100644
+use core::fmt; +use core::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
-use crate::memchr; -use crate::memchr;
+use io::memchr; +use crate::io::memchr;
/// The `BufReader` struct adds buffering to any reader. /// The `BufReader` struct adds buffering to any reader.
/// ///
@ -311,21 +311,19 @@ diff --git a/cursor.rs b/cursor.rs
index 247d45c..f13522d 100644 index 247d45c..f13522d 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,9 +1,10 @@ @@ -1,9 +1,9 @@
use crate::io::prelude::*; use crate::io::prelude::*;
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+use core::cmp; +use core::cmp;
+use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind}; use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{IoVec, IoVecMut};
-use core::convert::TryInto; -use core::convert::TryInto;
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. /// [`Seek`] implementation.
@@ -71,7 +72,6 @@ use core::convert::TryInto; @@ -71,7 +71,6 @@ use core::convert::TryInto;
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -333,7 +331,7 @@ index 247d45c..f13522d 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -94,7 +94,6 @@ impl<T> Cursor<T> { @@ -94,7 +93,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -341,7 +339,7 @@ index 247d45c..f13522d 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -112,7 +111,6 @@ impl<T> Cursor<T> { @@ -112,7 +110,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -349,7 +347,7 @@ index 247d45c..f13522d 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -128,7 +126,6 @@ impl<T> Cursor<T> { @@ -128,7 +125,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -357,7 +355,7 @@ index 247d45c..f13522d 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -147,7 +144,6 @@ impl<T> Cursor<T> { @@ -147,7 +143,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -365,7 +363,7 @@ index 247d45c..f13522d 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -169,7 +165,6 @@ impl<T> Cursor<T> { @@ -169,7 +164,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -373,7 +371,7 @@ index 247d45c..f13522d 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -189,11 +184,9 @@ impl<T> Cursor<T> { @@ -189,11 +183,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -385,7 +383,7 @@ index 247d45c..f13522d 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -222,14 +215,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -222,10 +214,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -397,12 +395,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -244,7 +235,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -244,7 +237,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -411,7 +404,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -255,12 +248,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -255,12 +246,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -431,15 +424,7 @@ index 247d45c..f13522d 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -272,6 +269,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -290,6 +285,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -290,6 +288,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -447,7 +432,7 @@ index 247d45c..f13522d 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -316,6 +315,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -316,6 +312,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -455,7 +440,7 @@ index 247d45c..f13522d 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -329,13 +329,13 @@ fn vec_write_vectored( @@ -329,7 +326,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -463,14 +448,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -344,7 +340,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -344,12 +344,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -479,13 +457,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -357,7 +353,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -357,12 +358,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -494,13 +466,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -370,8 +366,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -370,13 +372,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -511,12 +477,6 @@ index 247d45c..f13522d 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index 614b791..e4ce8b5 100644 index 614b791..e4ce8b5 100644
--- a/error.rs --- a/error.rs
@ -844,7 +804,7 @@ diff --git a/impls.rs b/impls.rs
index b286e40..7472d9c 100644 index b286e40..7472d9c 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -852,8 +812,8 @@ index b286e40..7472d9c 100644
-use crate::mem; -use crate::mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -866,14 +826,7 @@ index b286e40..7472d9c 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -887,7 +840,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -895,12 +848,7 @@ index b286e40..7472d9c 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -914,7 +862,7 @@ index b286e40..7472d9c 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -923,14 +871,7 @@ index b286e40..7472d9c 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -944,7 +885,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -953,12 +894,7 @@ index b286e40..7472d9c 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -973,7 +909,7 @@ index b286e40..7472d9c 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -186,7 +194,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> { @@ -186,7 +190,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -981,15 +917,7 @@ index b286e40..7472d9c 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -206,6 +213,7 @@ impl Read for &[u8] { @@ -245,6 +248,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -245,6 +253,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -997,7 +925,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -254,7 +263,7 @@ impl Read for &[u8] { @@ -254,7 +258,7 @@ impl Read for &[u8] {
} }
} }
@ -1006,7 +934,7 @@ index b286e40..7472d9c 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -268,7 +277,6 @@ impl BufRead for &[u8] { @@ -268,7 +272,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1014,15 +942,7 @@ index b286e40..7472d9c 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -279,6 +287,7 @@ impl Write for &mut [u8] { @@ -307,7 +310,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -307,7 +316,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1031,14 +951,6 @@ index b286e40..7472d9c 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -315,6 +324,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index 14c850b..eaa3481 100644 index 14c850b..eaa3481 100644
--- a/mod.rs --- a/mod.rs
@ -1072,9 +984,9 @@ index 14c850b..eaa3481 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1134,23 +1046,7 @@ index 14c850b..eaa3481 100644
fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R,
buf: &mut Vec<u8>, buf: &mut Vec<u8>,
reservation_size: usize) -> Result<usize> reservation_size: usize) -> Result<usize>
@@ -390,6 +381,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, @@ -484,7 +475,6 @@ where
ret
}
+#[cfg(feature="collections")]
pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoVecMut<'_>]) -> Result<usize>
where
F: FnOnce(&mut [u8]) -> Result<usize>
@@ -401,6 +393,7 @@ where
read(buf)
}
+#[cfg(feature="collections")]
pub(crate) fn default_write_vectored<F>(write: F, bufs: &[IoVec<'_>]) -> Result<usize>
where
F: FnOnce(&[u8]) -> Result<usize>
@@ -484,7 +477,6 @@ where
/// [`BufReader`]: struct.BufReader.html /// [`BufReader`]: struct.BufReader.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html
@ -1158,7 +1054,7 @@ index 14c850b..eaa3481 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Read { pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning /// Pull some bytes from this source into the specified buffer, returning
@@ -541,7 +533,6 @@ pub trait Read { @@ -541,7 +531,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1166,16 +1062,15 @@ index 14c850b..eaa3481 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -552,7 +543,7 @@ pub trait Read { @@ -552,7 +541,6 @@ pub trait Read {
/// ///
/// The default implementation calls `read` with either the first nonempty /// The default implementation calls `read` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
default_read_vectored(|b| self.read(b), bufs) default_read_vectored(|b| self.read(b), bufs)
} }
@@ -579,7 +570,6 @@ pub trait Read { @@ -579,7 +567,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1183,7 +1078,7 @@ index 14c850b..eaa3481 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -632,7 +622,7 @@ pub trait Read { @@ -632,7 +619,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1192,7 +1087,7 @@ index 14c850b..eaa3481 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -675,7 +665,7 @@ pub trait Read { @@ -675,7 +662,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1201,7 +1096,7 @@ index 14c850b..eaa3481 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -738,7 +728,6 @@ pub trait Read { @@ -738,7 +725,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1209,7 +1104,7 @@ index 14c850b..eaa3481 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -790,7 +779,6 @@ pub trait Read { @@ -790,7 +776,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1217,7 +1112,7 @@ index 14c850b..eaa3481 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -827,7 +815,6 @@ pub trait Read { @@ -827,7 +812,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1225,7 +1120,7 @@ index 14c850b..eaa3481 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -862,7 +849,6 @@ pub trait Read { @@ -862,7 +846,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1233,7 +1128,7 @@ index 14c850b..eaa3481 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -898,42 +884,77 @@ pub trait Read { @@ -898,22 +881,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1243,10 +1138,8 @@ index 14c850b..eaa3481 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1258,10 +1151,9 @@ index 14c850b..eaa3481 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1285,23 +1177,15 @@ index 14c850b..eaa3481 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -926,14 +939,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1314,41 +1198,31 @@ index 14c850b..eaa3481 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -943,7 +964,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -943,7 +954,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -956,31 +977,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -956,11 +966,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -973,14 +981,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1361,11 +1235,10 @@ index 14c850b..eaa3481 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -991,13 +1012,11 @@ impl<'a> Deref for IoVec<'a> { @@ -991,13 +997,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1379,7 +1252,7 @@ index 14c850b..eaa3481 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -1011,21 +1030,18 @@ impl Initializer { @@ -1011,21 +1015,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1401,7 +1274,7 @@ index 14c850b..eaa3481 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1068,7 +1084,6 @@ impl Initializer { @@ -1068,7 +1069,6 @@ impl Initializer {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1409,7 +1282,7 @@ index 14c850b..eaa3481 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1117,7 +1132,6 @@ pub trait Write { @@ -1117,7 +1117,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1417,16 +1290,15 @@ index 14c850b..eaa3481 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1128,7 +1142,7 @@ pub trait Write { @@ -1128,7 +1127,6 @@ pub trait Write {
/// ///
/// The default implementation calls `write` with either the first nonempty /// The default implementation calls `write` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
default_write_vectored(|b| self.write(b), bufs) default_write_vectored(|b| self.write(b), bufs)
} }
@@ -1156,7 +1170,6 @@ pub trait Write { @@ -1156,7 +1154,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1434,7 +1306,7 @@ index 14c850b..eaa3481 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1189,7 +1202,6 @@ pub trait Write { @@ -1189,7 +1186,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1442,7 +1314,7 @@ index 14c850b..eaa3481 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1241,7 +1253,6 @@ pub trait Write { @@ -1241,7 +1237,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1450,7 +1322,7 @@ index 14c850b..eaa3481 100644
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1297,7 +1308,6 @@ pub trait Write { @@ -1297,7 +1292,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1458,7 +1330,7 @@ index 14c850b..eaa3481 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1327,7 +1337,6 @@ pub trait Write { @@ -1327,7 +1321,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1466,7 +1338,7 @@ index 14c850b..eaa3481 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1343,7 +1352,6 @@ pub trait Seek { @@ -1343,7 +1336,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1474,7 +1346,7 @@ index 14c850b..eaa3481 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
/// Returns the length of this stream (in bytes). /// Returns the length of this stream (in bytes).
@@ -1381,7 +1389,6 @@ pub trait Seek { @@ -1381,7 +1373,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1482,7 +1354,7 @@ index 14c850b..eaa3481 100644
fn stream_len(&mut self) -> Result<u64> { fn stream_len(&mut self) -> Result<u64> {
let old_pos = self.stream_position()?; let old_pos = self.stream_position()?;
let len = self.seek(SeekFrom::End(0))?; let len = self.seek(SeekFrom::End(0))?;
@@ -1420,7 +1427,6 @@ pub trait Seek { @@ -1420,7 +1411,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1490,7 +1362,7 @@ index 14c850b..eaa3481 100644
fn stream_position(&mut self) -> Result<u64> { fn stream_position(&mut self) -> Result<u64> {
self.seek(SeekFrom::Current(0)) self.seek(SeekFrom::Current(0))
} }
@@ -1432,29 +1438,26 @@ pub trait Seek { @@ -1432,29 +1422,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1524,7 +1396,7 @@ index 14c850b..eaa3481 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1534,7 +1537,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1534,7 +1521,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1533,7 +1405,7 @@ index 14c850b..eaa3481 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1580,7 +1583,6 @@ pub trait BufRead: Read { @@ -1580,7 +1567,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1541,7 +1413,7 @@ index 14c850b..eaa3481 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1602,7 +1604,6 @@ pub trait BufRead: Read { @@ -1602,7 +1588,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1549,7 +1421,7 @@ index 14c850b..eaa3481 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1658,7 +1659,6 @@ pub trait BufRead: Read { @@ -1658,7 +1643,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1557,7 +1429,7 @@ index 14c850b..eaa3481 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1717,7 +1717,6 @@ pub trait BufRead: Read { @@ -1717,7 +1701,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1565,7 +1437,7 @@ index 14c850b..eaa3481 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1758,7 +1757,6 @@ pub trait BufRead: Read { @@ -1758,7 +1741,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1573,7 +1445,7 @@ index 14c850b..eaa3481 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1797,7 +1795,6 @@ pub trait BufRead: Read { @@ -1797,7 +1779,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1581,7 +1453,7 @@ index 14c850b..eaa3481 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1809,7 +1806,6 @@ pub trait BufRead: Read { @@ -1809,7 +1790,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1589,7 +1461,7 @@ index 14c850b..eaa3481 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1835,7 +1831,6 @@ impl<T, U> Chain<T, U> { @@ -1835,7 +1815,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1597,7 +1469,7 @@ index 14c850b..eaa3481 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1858,7 +1853,6 @@ impl<T, U> Chain<T, U> { @@ -1858,7 +1837,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1605,7 +1477,7 @@ index 14c850b..eaa3481 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1885,13 +1879,11 @@ impl<T, U> Chain<T, U> { @@ -1885,13 +1863,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1619,7 +1491,7 @@ index 14c850b..eaa3481 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1901,7 +1893,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1901,7 +1877,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1627,15 +1499,7 @@ index 14c850b..eaa3481 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1913,6 +1904,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1933,7 +1908,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1933,7 +1925,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1644,7 +1508,7 @@ index 14c850b..eaa3481 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1960,7 +1952,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1960,7 +1935,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1652,7 +1516,7 @@ index 14c850b..eaa3481 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -1995,7 +1986,6 @@ impl<T> Take<T> { @@ -1995,7 +1969,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1660,7 +1524,7 @@ index 14c850b..eaa3481 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -2021,7 +2011,6 @@ impl<T> Take<T> { @@ -2021,7 +1994,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1668,7 +1532,7 @@ index 14c850b..eaa3481 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -2046,7 +2035,6 @@ impl<T> Take<T> { @@ -2046,7 +2018,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1676,7 +1540,7 @@ index 14c850b..eaa3481 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -2071,7 +2059,6 @@ impl<T> Take<T> { @@ -2071,7 +2042,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1684,7 +1548,7 @@ index 14c850b..eaa3481 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2100,13 +2087,11 @@ impl<T> Take<T> { @@ -2100,13 +2070,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1698,16 +1562,16 @@ index 14c850b..eaa3481 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2123,15 +2108,9 @@ impl<T: Read> Read for Take<T> { @@ -2124,6 +2092,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2131,7 +2100,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1715,7 +1579,7 @@ index 14c850b..eaa3481 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2158,13 +2137,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2158,13 +2127,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1729,7 +1593,7 @@ index 14c850b..eaa3481 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2188,14 +2165,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2188,14 +2155,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1746,7 +1610,7 @@ index 14c850b..eaa3481 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2220,13 +2197,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2220,13 +2187,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1789,8 +1653,8 @@ index 6aaf8f1..447ce47 100644
-use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use crate::mem; -use crate::mem;
+use core::fmt; +use core::fmt;
+use crate::io::{self, Read, Initializer, Write, ErrorKind}; +use crate::io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVec, IoVecMut}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::mem; +use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
@ -1859,15 +1723,7 @@ index 6aaf8f1..447ce47 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1875,7 +1731,7 @@ index 6aaf8f1..447ce47 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1883,7 +1739,7 @@ index 6aaf8f1..447ce47 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1894,12 +1750,7 @@ index 6aaf8f1..447ce47 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ index 559a54d..bd888d2 100644
+use core::fmt; +use core::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
-use crate::memchr; -use crate::memchr;
+use io::memchr; +use crate::io::memchr;
/// The `BufReader` struct adds buffering to any reader. /// The `BufReader` struct adds buffering to any reader.
/// ///
@ -311,21 +311,19 @@ diff --git a/cursor.rs b/cursor.rs
index 873da08..3d39e57 100644 index 873da08..3d39e57 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,9 +1,10 @@ @@ -1,9 +1,9 @@
use crate::io::prelude::*; use crate::io::prelude::*;
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+use core::cmp; +use core::cmp;
+use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind}; use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{IoVec, IoVecMut};
-use core::convert::TryInto; -use core::convert::TryInto;
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. /// [`Seek`] implementation.
@@ -71,7 +72,6 @@ use core::convert::TryInto; @@ -71,7 +71,6 @@ use core::convert::TryInto;
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -333,7 +331,7 @@ index 873da08..3d39e57 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -94,7 +94,6 @@ impl<T> Cursor<T> { @@ -94,7 +93,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -341,7 +339,7 @@ index 873da08..3d39e57 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -112,7 +111,6 @@ impl<T> Cursor<T> { @@ -112,7 +110,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -349,7 +347,7 @@ index 873da08..3d39e57 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -128,7 +126,6 @@ impl<T> Cursor<T> { @@ -128,7 +125,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -357,7 +355,7 @@ index 873da08..3d39e57 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -147,7 +144,6 @@ impl<T> Cursor<T> { @@ -147,7 +143,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -365,7 +363,7 @@ index 873da08..3d39e57 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -169,7 +165,6 @@ impl<T> Cursor<T> { @@ -169,7 +164,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -373,7 +371,7 @@ index 873da08..3d39e57 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -189,11 +184,9 @@ impl<T> Cursor<T> { @@ -189,11 +183,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -385,7 +383,7 @@ index 873da08..3d39e57 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -214,14 +207,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -214,10 +206,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -397,12 +395,7 @@ index 873da08..3d39e57 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -236,7 +227,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -236,7 +229,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -411,7 +404,7 @@ index 873da08..3d39e57 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -247,12 +240,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -247,12 +238,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -431,15 +424,7 @@ index 873da08..3d39e57 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -264,6 +261,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -282,6 +277,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -282,6 +280,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -447,7 +432,7 @@ index 873da08..3d39e57 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -308,6 +307,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -308,6 +304,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -455,7 +440,7 @@ index 873da08..3d39e57 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -321,13 +321,13 @@ fn vec_write_vectored( @@ -321,7 +318,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -463,14 +448,7 @@ index 873da08..3d39e57 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -336,7 +332,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -336,12 +336,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -479,13 +457,7 @@ index 873da08..3d39e57 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -349,7 +345,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -349,12 +350,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -494,13 +466,7 @@ index 873da08..3d39e57 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -362,8 +358,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -362,13 +364,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -511,12 +477,6 @@ index 873da08..3d39e57 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index fdc5625..e4ce8b5 100644 index fdc5625..e4ce8b5 100644
--- a/error.rs --- a/error.rs
@ -836,7 +796,7 @@ diff --git a/impls.rs b/impls.rs
index bd3d0a4..c44cc70 100644 index bd3d0a4..c44cc70 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -844,8 +804,8 @@ index bd3d0a4..c44cc70 100644
-use crate::mem; -use crate::mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -858,14 +818,7 @@ index bd3d0a4..c44cc70 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -879,7 +832,7 @@ index bd3d0a4..c44cc70 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -887,12 +840,7 @@ index bd3d0a4..c44cc70 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -906,7 +854,7 @@ index bd3d0a4..c44cc70 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -915,14 +863,7 @@ index bd3d0a4..c44cc70 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -936,7 +877,7 @@ index bd3d0a4..c44cc70 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -945,12 +886,7 @@ index bd3d0a4..c44cc70 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -965,7 +901,7 @@ index bd3d0a4..c44cc70 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -172,7 +180,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> { @@ -172,7 +176,6 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -973,15 +909,7 @@ index bd3d0a4..c44cc70 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -192,6 +199,7 @@ impl Read for &[u8] { @@ -231,6 +234,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -231,6 +239,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -989,7 +917,7 @@ index bd3d0a4..c44cc70 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -240,7 +249,7 @@ impl Read for &[u8] { @@ -240,7 +244,7 @@ impl Read for &[u8] {
} }
} }
@ -998,7 +926,7 @@ index bd3d0a4..c44cc70 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -254,7 +263,6 @@ impl BufRead for &[u8] { @@ -254,7 +258,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1006,15 +934,7 @@ index bd3d0a4..c44cc70 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -265,6 +273,7 @@ impl Write for &mut [u8] { @@ -293,7 +296,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -293,7 +302,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1023,14 +943,6 @@ index bd3d0a4..c44cc70 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -301,6 +310,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index e3e2754..400eca6 100644 index e3e2754..400eca6 100644
--- a/mod.rs --- a/mod.rs
@ -1064,9 +976,9 @@ index e3e2754..400eca6 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1142,16 +1054,15 @@ index e3e2754..400eca6 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -530,7 +519,7 @@ pub trait Read { @@ -530,7 +519,6 @@ pub trait Read {
/// ///
/// The default implementation simply passes the first nonempty buffer to /// The default implementation simply passes the first nonempty buffer to
/// `read`. /// `read`.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
match bufs.iter_mut().find(|b| !b.is_empty()) { match bufs.iter_mut().find(|b| !b.is_empty()) {
Some(buf) => self.read(buf), Some(buf) => self.read(buf),
@@ -560,7 +549,6 @@ pub trait Read { @@ -560,7 +548,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1159,7 +1070,7 @@ index e3e2754..400eca6 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -613,7 +601,7 @@ pub trait Read { @@ -613,7 +600,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1168,7 +1079,7 @@ index e3e2754..400eca6 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -656,7 +644,7 @@ pub trait Read { @@ -656,7 +643,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1177,7 +1088,7 @@ index e3e2754..400eca6 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -719,7 +707,6 @@ pub trait Read { @@ -719,7 +706,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1185,7 +1096,7 @@ index e3e2754..400eca6 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -771,7 +758,6 @@ pub trait Read { @@ -771,7 +757,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1193,7 +1104,7 @@ index e3e2754..400eca6 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -808,7 +794,6 @@ pub trait Read { @@ -808,7 +793,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1201,7 +1112,7 @@ index e3e2754..400eca6 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -843,7 +828,6 @@ pub trait Read { @@ -843,7 +827,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1209,7 +1120,7 @@ index e3e2754..400eca6 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -879,42 +863,77 @@ pub trait Read { @@ -879,22 +862,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1219,10 +1130,8 @@ index e3e2754..400eca6 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1234,10 +1143,9 @@ index e3e2754..400eca6 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1261,23 +1169,15 @@ index e3e2754..400eca6 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -907,14 +920,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1290,41 +1190,31 @@ index e3e2754..400eca6 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -924,7 +943,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -924,7 +935,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -937,31 +956,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -937,11 +947,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -954,14 +962,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1337,11 +1227,10 @@ index e3e2754..400eca6 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -972,13 +991,11 @@ impl<'a> Deref for IoVec<'a> { @@ -972,13 +978,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1355,7 +1244,7 @@ index e3e2754..400eca6 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -992,21 +1009,18 @@ impl Initializer { @@ -992,21 +996,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1377,7 +1266,7 @@ index e3e2754..400eca6 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1049,7 +1063,6 @@ impl Initializer { @@ -1049,7 +1050,6 @@ impl Initializer {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1385,7 +1274,7 @@ index e3e2754..400eca6 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1098,7 +1111,6 @@ pub trait Write { @@ -1098,7 +1098,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1393,16 +1282,15 @@ index e3e2754..400eca6 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1109,7 +1121,7 @@ pub trait Write { @@ -1109,7 +1108,6 @@ pub trait Write {
/// ///
/// The default implementation simply passes the first nonempty buffer to /// The default implementation simply passes the first nonempty buffer to
/// `write`. /// `write`.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
match bufs.iter().find(|b| !b.is_empty()) { match bufs.iter().find(|b| !b.is_empty()) {
Some(buf) => self.write(buf), Some(buf) => self.write(buf),
@@ -1140,7 +1152,6 @@ pub trait Write { @@ -1140,7 +1138,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1410,7 +1298,7 @@ index e3e2754..400eca6 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1173,7 +1184,6 @@ pub trait Write { @@ -1173,7 +1170,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1418,7 +1306,7 @@ index e3e2754..400eca6 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1225,7 +1235,6 @@ pub trait Write { @@ -1225,7 +1221,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1426,7 +1314,7 @@ index e3e2754..400eca6 100644
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1281,7 +1290,6 @@ pub trait Write { @@ -1281,7 +1276,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1434,7 +1322,7 @@ index e3e2754..400eca6 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1311,7 +1319,6 @@ pub trait Write { @@ -1311,7 +1305,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1442,7 +1330,7 @@ index e3e2754..400eca6 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1327,7 +1334,6 @@ pub trait Seek { @@ -1327,7 +1320,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1450,7 +1338,7 @@ index e3e2754..400eca6 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
} }
@@ -1337,29 +1343,26 @@ pub trait Seek { @@ -1337,29 +1329,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1484,7 +1372,7 @@ index e3e2754..400eca6 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1439,7 +1442,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1439,7 +1428,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1493,7 +1381,7 @@ index e3e2754..400eca6 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1485,7 +1488,6 @@ pub trait BufRead: Read { @@ -1485,7 +1474,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1501,7 +1389,7 @@ index e3e2754..400eca6 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1507,7 +1509,6 @@ pub trait BufRead: Read { @@ -1507,7 +1495,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1509,7 +1397,7 @@ index e3e2754..400eca6 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1563,7 +1564,6 @@ pub trait BufRead: Read { @@ -1563,7 +1550,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1517,7 +1405,7 @@ index e3e2754..400eca6 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1622,7 +1622,6 @@ pub trait BufRead: Read { @@ -1622,7 +1608,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1525,7 +1413,7 @@ index e3e2754..400eca6 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1663,7 +1662,6 @@ pub trait BufRead: Read { @@ -1663,7 +1648,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1533,7 +1421,7 @@ index e3e2754..400eca6 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1702,7 +1700,6 @@ pub trait BufRead: Read { @@ -1702,7 +1686,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1541,7 +1429,7 @@ index e3e2754..400eca6 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1714,7 +1711,6 @@ pub trait BufRead: Read { @@ -1714,7 +1697,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1549,7 +1437,7 @@ index e3e2754..400eca6 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1740,7 +1736,6 @@ impl<T, U> Chain<T, U> { @@ -1740,7 +1722,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1557,7 +1445,7 @@ index e3e2754..400eca6 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1763,7 +1758,6 @@ impl<T, U> Chain<T, U> { @@ -1763,7 +1744,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1565,7 +1453,7 @@ index e3e2754..400eca6 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1790,13 +1784,11 @@ impl<T, U> Chain<T, U> { @@ -1790,13 +1770,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1579,7 +1467,7 @@ index e3e2754..400eca6 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1806,7 +1798,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1806,7 +1784,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1587,15 +1475,7 @@ index e3e2754..400eca6 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1818,6 +1809,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1838,7 +1815,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1838,7 +1830,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1604,7 +1484,7 @@ index e3e2754..400eca6 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1865,7 +1857,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1865,7 +1842,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1612,7 +1492,7 @@ index e3e2754..400eca6 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -1900,7 +1891,6 @@ impl<T> Take<T> { @@ -1900,7 +1876,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1620,7 +1500,7 @@ index e3e2754..400eca6 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -1926,7 +1916,6 @@ impl<T> Take<T> { @@ -1926,7 +1901,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1628,7 +1508,7 @@ index e3e2754..400eca6 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -1951,7 +1940,6 @@ impl<T> Take<T> { @@ -1951,7 +1925,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1636,7 +1516,7 @@ index e3e2754..400eca6 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -1976,7 +1964,6 @@ impl<T> Take<T> { @@ -1976,7 +1949,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1644,7 +1524,7 @@ index e3e2754..400eca6 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2005,13 +1992,11 @@ impl<T> Take<T> { @@ -2005,13 +1977,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1658,16 +1538,16 @@ index e3e2754..400eca6 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2028,15 +2013,9 @@ impl<T: Read> Read for Take<T> { @@ -2029,6 +1999,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2036,7 +2007,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1675,7 +1555,7 @@ index e3e2754..400eca6 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2063,13 +2042,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2063,13 +2034,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1689,7 +1569,7 @@ index e3e2754..400eca6 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2093,14 +2070,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2093,14 +2062,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1706,7 +1586,7 @@ index e3e2754..400eca6 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2125,13 +2102,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2125,13 +2094,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1739,7 +1619,7 @@ index 2e19edf..66294a3 100644
+#[cfg(feature="collections")] pub use alloc::boxed::Box; +#[cfg(feature="collections")] pub use alloc::boxed::Box;
+#[cfg(feature="collections")] pub use collections::vec::Vec; +#[cfg(feature="collections")] pub use collections::vec::Vec;
diff --git a/util.rs b/util.rs diff --git a/util.rs b/util.rs
index 6aaf8f1..447ce47 100644 index 6aaf8f1..15ce0af 100644
--- a/util.rs --- a/util.rs
+++ b/util.rs +++ b/util.rs
@@ -1,8 +1,9 @@ @@ -1,8 +1,9 @@
@ -1749,8 +1629,8 @@ index 6aaf8f1..447ce47 100644
-use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use crate::mem; -use crate::mem;
+use core::fmt; +use core::fmt;
+use crate::io::{self, Read, Initializer, Write, ErrorKind}; +use crate::io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVec, IoVecMut}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::mem; +use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
@ -1819,15 +1699,7 @@ index 6aaf8f1..447ce47 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1835,7 +1707,7 @@ index 6aaf8f1..447ce47 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1843,7 +1715,7 @@ index 6aaf8f1..447ce47 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1854,12 +1726,7 @@ index 6aaf8f1..447ce47 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

View File

@ -962,8 +962,8 @@ index c0570ae..f10d775 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1404,16 +1404,16 @@ index c0570ae..f10d775 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1898,15 +1847,9 @@ impl<T: Read> Read for Take<T> { @@ -1899,6 +1848,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1906,7 +1856,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1421,7 +1421,7 @@ index c0570ae..f10d775 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1933,13 +1876,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -1933,13 +1883,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1435,7 +1435,7 @@ index c0570ae..f10d775 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1963,14 +1904,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1963,14 +1911,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1452,7 +1452,7 @@ index c0570ae..f10d775 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -1995,13 +1936,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -1995,13 +1943,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1496,8 +1496,8 @@ index 8df961a..2b08122 100644
-use mem; -use mem;
+use core::fmt; +use core::fmt;
+use io::{self, Read, Initializer, Write, ErrorKind}; +use io::{self, Read, Initializer, Write, ErrorKind};
+use core::mem;
+#[cfg(feature="collections")] use io::BufRead; +#[cfg(feature="collections")] use io::BufRead;
+use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
/// ///

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1409,16 +1409,16 @@ index e263db2..2176464 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1907,15 +1856,9 @@ impl<T: Read> Read for Take<T> { @@ -1908,6 +1857,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1915,7 +1865,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1426,7 +1426,7 @@ index e263db2..2176464 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1954,13 +1897,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1954,13 +1904,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1440,7 +1440,7 @@ index e263db2..2176464 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1976,14 +1917,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1976,14 +1924,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1457,7 +1457,7 @@ index e263db2..2176464 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2008,13 +1949,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2008,13 +1956,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1408,16 +1408,16 @@ index b83f3fb..883fa30 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1906,15 +1855,9 @@ impl<T: Read> Read for Take<T> { @@ -1907,6 +1856,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1914,7 +1864,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1425,7 +1425,7 @@ index b83f3fb..883fa30 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1953,13 +1896,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1953,13 +1903,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1439,7 +1439,7 @@ index b83f3fb..883fa30 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1975,14 +1916,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1975,14 +1923,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1456,7 +1456,7 @@ index b83f3fb..883fa30 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2007,13 +1948,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2007,13 +1955,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

View File

@ -15,7 +15,7 @@ index 441f6b9..540d4aa 100644
+use core::fmt; +use core::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
-use crate::memchr; -use crate::memchr;
+use io::memchr; +use crate::io::memchr;
/// The `BufReader` struct adds buffering to any reader. /// The `BufReader` struct adds buffering to any reader.
/// ///
@ -311,21 +311,19 @@ diff --git a/cursor.rs b/cursor.rs
index 247d45c..f13522d 100644 index 247d45c..f13522d 100644
--- a/cursor.rs --- a/cursor.rs
+++ b/cursor.rs +++ b/cursor.rs
@@ -1,9 +1,10 @@ @@ -1,9 +1,9 @@
use crate::io::prelude::*; use crate::io::prelude::*;
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+use core::cmp; +use core::cmp;
+use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind}; use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{IoVec, IoVecMut};
-use core::convert::TryInto; -use core::convert::TryInto;
+#[cfg(feature="collections")] use core::convert::TryInto; +#[cfg(feature="collections")] use core::convert::TryInto;
/// A `Cursor` wraps an in-memory buffer and provides it with a /// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation. /// [`Seek`] implementation.
@@ -71,7 +72,6 @@ use core::convert::TryInto; @@ -71,7 +71,6 @@ use core::convert::TryInto;
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); /// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
/// } /// }
/// ``` /// ```
@ -333,7 +331,7 @@ index 247d45c..f13522d 100644
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Cursor<T> { pub struct Cursor<T> {
inner: T, inner: T,
@@ -94,7 +94,6 @@ impl<T> Cursor<T> { @@ -94,7 +93,6 @@ impl<T> Cursor<T> {
/// # fn force_inference(_: &Cursor<Vec<u8>>) {} /// # fn force_inference(_: &Cursor<Vec<u8>>) {}
/// # force_inference(&buff); /// # force_inference(&buff);
/// ``` /// ```
@ -341,7 +339,7 @@ index 247d45c..f13522d 100644
pub fn new(inner: T) -> Cursor<T> { pub fn new(inner: T) -> Cursor<T> {
Cursor { pos: 0, inner: inner } Cursor { pos: 0, inner: inner }
} }
@@ -112,7 +111,6 @@ impl<T> Cursor<T> { @@ -112,7 +110,6 @@ impl<T> Cursor<T> {
/// ///
/// let vec = buff.into_inner(); /// let vec = buff.into_inner();
/// ``` /// ```
@ -349,7 +347,7 @@ index 247d45c..f13522d 100644
pub fn into_inner(self) -> T { self.inner } pub fn into_inner(self) -> T { self.inner }
/// Gets a reference to the underlying value in this cursor. /// Gets a reference to the underlying value in this cursor.
@@ -128,7 +126,6 @@ impl<T> Cursor<T> { @@ -128,7 +125,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_ref(); /// let reference = buff.get_ref();
/// ``` /// ```
@ -357,7 +355,7 @@ index 247d45c..f13522d 100644
pub fn get_ref(&self) -> &T { &self.inner } pub fn get_ref(&self) -> &T { &self.inner }
/// Gets a mutable reference to the underlying value in this cursor. /// Gets a mutable reference to the underlying value in this cursor.
@@ -147,7 +144,6 @@ impl<T> Cursor<T> { @@ -147,7 +143,6 @@ impl<T> Cursor<T> {
/// ///
/// let reference = buff.get_mut(); /// let reference = buff.get_mut();
/// ``` /// ```
@ -365,7 +363,7 @@ index 247d45c..f13522d 100644
pub fn get_mut(&mut self) -> &mut T { &mut self.inner } pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
/// Returns the current position of this cursor. /// Returns the current position of this cursor.
@@ -169,7 +165,6 @@ impl<T> Cursor<T> { @@ -169,7 +164,6 @@ impl<T> Cursor<T> {
/// buff.seek(SeekFrom::Current(-1)).unwrap(); /// buff.seek(SeekFrom::Current(-1)).unwrap();
/// assert_eq!(buff.position(), 1); /// assert_eq!(buff.position(), 1);
/// ``` /// ```
@ -373,7 +371,7 @@ index 247d45c..f13522d 100644
pub fn position(&self) -> u64 { self.pos } pub fn position(&self) -> u64 { self.pos }
/// Sets the position of this cursor. /// Sets the position of this cursor.
@@ -189,11 +184,9 @@ impl<T> Cursor<T> { @@ -189,11 +183,9 @@ impl<T> Cursor<T> {
/// buff.set_position(4); /// buff.set_position(4);
/// assert_eq!(buff.position(), 4); /// assert_eq!(buff.position(), 4);
/// ``` /// ```
@ -385,7 +383,7 @@ index 247d45c..f13522d 100644
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
let (base_pos, offset) = match style { let (base_pos, offset) = match style {
@@ -222,14 +215,14 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> { @@ -222,10 +214,9 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -397,12 +395,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(n) Ok(n)
} }
@@ -244,7 +235,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
for buf in bufs {
@@ -244,7 +237,7 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
let n = buf.len(); let n = buf.len();
@ -411,7 +404,7 @@ index 247d45c..f13522d 100644
self.pos += n as u64; self.pos += n as u64;
Ok(()) Ok(())
} }
@@ -255,12 +248,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> { @@ -255,12 +246,16 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
} }
} }
@ -431,15 +424,7 @@ index 247d45c..f13522d 100644
fn consume(&mut self, amt: usize) { self.pos += amt as u64; } fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
} }
@@ -272,6 +269,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<us @@ -290,6 +285,7 @@ fn slice_write_vectored(
Ok(amt)
}
+#[cfg(feature="collections")]
fn slice_write_vectored(
pos_mut: &mut u64,
slice: &mut [u8],
@@ -290,6 +288,7 @@ fn slice_write_vectored(
} }
// Resizing write implementation // Resizing write implementation
@ -447,7 +432,7 @@ index 247d45c..f13522d 100644
fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> {
let pos: usize = (*pos_mut).try_into().map_err(|_| { let pos: usize = (*pos_mut).try_into().map_err(|_| {
Error::new(ErrorKind::InvalidInput, Error::new(ErrorKind::InvalidInput,
@@ -316,6 +315,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi @@ -316,6 +312,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usi
Ok(buf.len()) Ok(buf.len())
} }
@ -455,7 +440,7 @@ index 247d45c..f13522d 100644
fn vec_write_vectored( fn vec_write_vectored(
pos_mut: &mut u64, pos_mut: &mut u64,
vec: &mut Vec<u8>, vec: &mut Vec<u8>,
@@ -329,13 +329,13 @@ fn vec_write_vectored( @@ -329,7 +326,6 @@ fn vec_write_vectored(
Ok(nwritten) Ok(nwritten)
} }
@ -463,14 +448,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut [u8]> { impl Write for Cursor<&mut [u8]> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, self.inner, buf) @@ -344,7 +340,7 @@ impl Write for Cursor<&mut [u8]> {
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, self.inner, bufs)
@@ -344,12 +344,13 @@ impl Write for Cursor<&mut [u8]> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -479,13 +457,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<&mut Vec<u8>> { impl Write for Cursor<&mut Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, self.inner, buf) vec_write(&mut self.pos, self.inner, buf)
} @@ -357,7 +353,7 @@ impl Write for Cursor<&mut Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, self.inner, bufs)
}
@@ -357,12 +358,13 @@ impl Write for Cursor<&mut Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -494,13 +466,7 @@ index 247d45c..f13522d 100644
impl Write for Cursor<Vec<u8>> { impl Write for Cursor<Vec<u8>> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
vec_write(&mut self.pos, &mut self.inner, buf) vec_write(&mut self.pos, &mut self.inner, buf)
} @@ -370,8 +366,8 @@ impl Write for Cursor<Vec<u8>> {
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
vec_write_vectored(&mut self.pos, &mut self.inner, bufs)
}
@@ -370,13 +372,14 @@ impl Write for Cursor<Vec<u8>> {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }
@ -511,12 +477,6 @@ index 247d45c..f13522d 100644
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
slice_write(&mut self.pos, &mut self.inner, buf) slice_write(&mut self.pos, &mut self.inner, buf)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
slice_write_vectored(&mut self.pos, &mut self.inner, bufs)
diff --git a/error.rs b/error.rs diff --git a/error.rs b/error.rs
index 614b791..e4ce8b5 100644 index 614b791..e4ce8b5 100644
--- a/error.rs --- a/error.rs
@ -844,7 +804,7 @@ diff --git a/impls.rs b/impls.rs
index b286e40..7472d9c 100644 index b286e40..7472d9c 100644
--- a/impls.rs --- a/impls.rs
+++ b/impls.rs +++ b/impls.rs
@@ -1,19 +1,22 @@ @@ -1,13 +1,15 @@
-use crate::cmp; -use crate::cmp;
-use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, -use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
- IoVec}; - IoVec};
@ -852,8 +812,8 @@ index b286e40..7472d9c 100644
-use crate::mem; -use crate::mem;
+#[cfg(feature="alloc")] use alloc::boxed::Box; +#[cfg(feature="alloc")] use alloc::boxed::Box;
+use core::cmp; +use core::cmp;
+use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind}; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, Error, ErrorKind, IoVecMut, IoVec};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVecMut, IoVec}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::fmt; +use core::fmt;
+use core::mem; +use core::mem;
+#[cfg(feature="collections")] use collections::string::String; +#[cfg(feature="collections")] use collections::string::String;
@ -866,14 +826,7 @@ index b286e40..7472d9c 100644
impl<R: Read + ?Sized> Read for &mut R { impl<R: Read + ?Sized> Read for &mut R {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -24,11 +26,13 @@ impl<R: Read + ?Sized> Read for &mut R {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -24,11 +27,13 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).initializer() (**self).initializer()
} }
@ -887,7 +840,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -39,11 +44,11 @@ impl<R: Read + ?Sized> Read for &mut R { @@ -39,7 +43,6 @@ impl<R: Read + ?Sized> Read for &mut R {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -895,12 +848,7 @@ index b286e40..7472d9c 100644
impl<W: Write + ?Sized> Write for &mut W { impl<W: Write + ?Sized> Write for &mut W {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -62,12 +65,11 @@ impl<W: Write + ?Sized> Write for &mut W {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -62,12 +67,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -914,7 +862,7 @@ index b286e40..7472d9c 100644
impl<B: BufRead + ?Sized> BufRead for &mut B { impl<B: BufRead + ?Sized> BufRead for &mut B {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -86,13 +90,14 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -86,7 +88,7 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
} }
} }
@ -923,14 +871,7 @@ index b286e40..7472d9c 100644
impl<R: Read + ?Sized> Read for Box<R> { impl<R: Read + ?Sized> Read for Box<R> {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf) @@ -103,11 +105,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
(**self).read_vectored(bufs)
@@ -103,11 +108,13 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).initializer() (**self).initializer()
} }
@ -944,7 +885,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_to_string(buf) (**self).read_to_string(buf)
@@ -118,11 +125,12 @@ impl<R: Read + ?Sized> Read for Box<R> { @@ -118,7 +122,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
(**self).read_exact(buf) (**self).read_exact(buf)
} }
} }
@ -953,12 +894,7 @@ index b286e40..7472d9c 100644
impl<W: Write + ?Sized> Write for Box<W> { impl<W: Write + ?Sized> Write for Box<W> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
@@ -141,12 +145,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
(**self).write_vectored(bufs)
@@ -141,12 +149,12 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_fmt(fmt) (**self).write_fmt(fmt)
} }
} }
@ -973,7 +909,7 @@ index b286e40..7472d9c 100644
impl<B: BufRead + ?Sized> BufRead for Box<B> { impl<B: BufRead + ?Sized> BufRead for Box<B> {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() } fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
@@ -186,7 +194,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> { @@ -186,7 +190,6 @@ impl Write for Box<dyn (::realstd::io::Write) + Send> {
/// ///
/// Note that reading updates the slice to point to the yet unread part. /// Note that reading updates the slice to point to the yet unread part.
/// The slice will be empty when EOF is reached. /// The slice will be empty when EOF is reached.
@ -981,15 +917,7 @@ index b286e40..7472d9c 100644
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -206,6 +213,7 @@ impl Read for &[u8] { @@ -245,6 +248,7 @@ impl Read for &[u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nread = 0;
@@ -245,6 +253,7 @@ impl Read for &[u8] {
Ok(()) Ok(())
} }
@ -997,7 +925,7 @@ index b286e40..7472d9c 100644
#[inline] #[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self); buf.extend_from_slice(*self);
@@ -254,7 +263,7 @@ impl Read for &[u8] { @@ -254,7 +258,7 @@ impl Read for &[u8] {
} }
} }
@ -1006,7 +934,7 @@ index b286e40..7472d9c 100644
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) } fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
@@ -268,7 +277,6 @@ impl BufRead for &[u8] { @@ -268,7 +272,6 @@ impl BufRead for &[u8] {
/// ///
/// Note that writing updates the slice to point to the yet unwritten part. /// Note that writing updates the slice to point to the yet unwritten part.
/// The slice will be empty when it has been completely overwritten. /// The slice will be empty when it has been completely overwritten.
@ -1014,15 +942,7 @@ index b286e40..7472d9c 100644
impl Write for &mut [u8] { impl Write for &mut [u8] {
#[inline] #[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> { fn write(&mut self, data: &[u8]) -> io::Result<usize> {
@@ -279,6 +287,7 @@ impl Write for &mut [u8] { @@ -307,7 +310,7 @@ impl Write for &mut [u8] {
Ok(amt)
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -307,7 +316,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector. /// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed. /// The vector will grow as needed.
@ -1031,14 +951,6 @@ index b286e40..7472d9c 100644
impl Write for Vec<u8> { impl Write for Vec<u8> {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -315,6 +324,7 @@ impl Write for Vec<u8> {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let len = bufs.iter().map(|b| b.len()).sum();
diff --git a/mod.rs b/mod.rs diff --git a/mod.rs b/mod.rs
index 14a16f3..07792b7 100644 index 14a16f3..07792b7 100644
--- a/mod.rs --- a/mod.rs
@ -1072,9 +984,9 @@ index 14a16f3..07792b7 100644
+mod memchr; +mod memchr;
+#[cfg(all(feature="collections",core_memchr))] +#[cfg(all(feature="collections",core_memchr))]
+use core::slice::memchr; +use core::slice::memchr;
+#[cfg(feature="collections")] use core::ops::{Deref, DerefMut};
+use core::ptr;
+use core::slice; +use core::slice;
+use core::ops::{Deref, DerefMut};
+use core::ptr;
+ +
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; +#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError; +#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
@ -1134,23 +1046,7 @@ index 14a16f3..07792b7 100644
fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R,
buf: &mut Vec<u8>, buf: &mut Vec<u8>,
reservation_size: usize) -> Result<usize> reservation_size: usize) -> Result<usize>
@@ -390,6 +381,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, @@ -484,7 +475,6 @@ where
ret
}
+#[cfg(feature="collections")]
pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoVecMut<'_>]) -> Result<usize>
where
F: FnOnce(&mut [u8]) -> Result<usize>
@@ -401,6 +393,7 @@ where
read(buf)
}
+#[cfg(feature="collections")]
pub(crate) fn default_write_vectored<F>(write: F, bufs: &[IoVec<'_>]) -> Result<usize>
where
F: FnOnce(&[u8]) -> Result<usize>
@@ -484,7 +477,6 @@ where
/// [`BufReader`]: struct.BufReader.html /// [`BufReader`]: struct.BufReader.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html
@ -1158,7 +1054,7 @@ index 14a16f3..07792b7 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Read { pub trait Read {
/// Pull some bytes from this source into the specified buffer, returning /// Pull some bytes from this source into the specified buffer, returning
@@ -543,7 +535,6 @@ pub trait Read { @@ -543,7 +533,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1166,16 +1062,15 @@ index 14a16f3..07792b7 100644
fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
/// Like `read`, except that it reads into a slice of buffers. /// Like `read`, except that it reads into a slice of buffers.
@@ -554,7 +545,7 @@ pub trait Read { @@ -554,7 +543,6 @@ pub trait Read {
/// ///
/// The default implementation calls `read` with either the first nonempty /// The default implementation calls `read` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
default_read_vectored(|b| self.read(b), bufs) default_read_vectored(|b| self.read(b), bufs)
} }
@@ -581,7 +572,6 @@ pub trait Read { @@ -581,7 +569,6 @@ pub trait Read {
/// ///
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
/// [`Initializer`]: ../../std/io/struct.Initializer.html /// [`Initializer`]: ../../std/io/struct.Initializer.html
@ -1183,7 +1078,7 @@ index 14a16f3..07792b7 100644
#[inline] #[inline]
unsafe fn initializer(&self) -> Initializer { unsafe fn initializer(&self) -> Initializer {
Initializer::zeroing() Initializer::zeroing()
@@ -634,7 +624,7 @@ pub trait Read { @@ -634,7 +621,7 @@ pub trait Read {
/// file.) /// file.)
/// ///
/// [`std::fs::read`]: ../fs/fn.read.html /// [`std::fs::read`]: ../fs/fn.read.html
@ -1192,7 +1087,7 @@ index 14a16f3..07792b7 100644
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
read_to_end(self, buf) read_to_end(self, buf)
} }
@@ -677,7 +667,7 @@ pub trait Read { @@ -677,7 +664,7 @@ pub trait Read {
/// reading from a file.) /// reading from a file.)
/// ///
/// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html
@ -1201,7 +1096,7 @@ index 14a16f3..07792b7 100644
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing // Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -740,7 +730,6 @@ pub trait Read { @@ -740,7 +727,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1209,7 +1104,7 @@ index 14a16f3..07792b7 100644
fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.read(buf) { match self.read(buf) {
@@ -792,7 +781,6 @@ pub trait Read { @@ -792,7 +778,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1217,7 +1112,7 @@ index 14a16f3..07792b7 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
/// Transforms this `Read` instance to an [`Iterator`] over its bytes. /// Transforms this `Read` instance to an [`Iterator`] over its bytes.
@@ -829,7 +817,6 @@ pub trait Read { @@ -829,7 +814,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1225,7 +1120,7 @@ index 14a16f3..07792b7 100644
fn bytes(self) -> Bytes<Self> where Self: Sized { fn bytes(self) -> Bytes<Self> where Self: Sized {
Bytes { inner: self } Bytes { inner: self }
} }
@@ -864,7 +851,6 @@ pub trait Read { @@ -864,7 +848,6 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1233,7 +1128,7 @@ index 14a16f3..07792b7 100644
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized { fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized {
Chain { first: self, second: next, done_first: false } Chain { first: self, second: next, done_first: false }
} }
@@ -900,42 +886,77 @@ pub trait Read { @@ -900,22 +883,52 @@ pub trait Read {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1243,10 +1138,8 @@ index 14a16f3..07792b7 100644
} }
} }
+#[cfg(feature="collections")]
+pub struct IoVecBuffer<'a>(&'a [u8]); +pub struct IoVecBuffer<'a>(&'a [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecBuffer<'a> { +impl<'a> IoVecBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> { + pub fn new(buf: &'a [u8]) -> IoVecBuffer<'a> {
@ -1258,10 +1151,9 @@ index 14a16f3..07792b7 100644
+ self.0 + self.0
+ } + }
+} +}
+#[cfg(feature="collections")] +
+pub struct IoVecMutBuffer<'a>(&'a mut [u8]); +pub struct IoVecMutBuffer<'a>(&'a mut [u8]);
+ +
+#[cfg(feature="collections")]
+impl<'a> IoVecMutBuffer<'a> { +impl<'a> IoVecMutBuffer<'a> {
+ #[inline] + #[inline]
+ pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> { + pub fn new(buf: &'a mut [u8]) -> IoVecMutBuffer<'a> {
@ -1285,23 +1177,15 @@ index 14a16f3..07792b7 100644
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
+pub struct IoVecMut<'a>(IoVecMutBuffer<'a>); +pub struct IoVecMut<'a>(IoVecMutBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVecMut<'a> { impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -928,14 +941,12 @@ impl<'a> IoVecMut<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVecMut<'a> {
/// Creates a new `IoVecMut` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1314,41 +1198,31 @@ index 14a16f3..07792b7 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVecMut<'a> { impl<'a> Deref for IoVecMut<'a> {
type Target = [u8]; type Target = [u8];
@@ -945,7 +966,7 @@ impl<'a> Deref for IoVecMut<'a> { @@ -945,7 +956,6 @@ impl<'a> Deref for IoVecMut<'a> {
} }
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> DerefMut for IoVecMut<'a> { impl<'a> DerefMut for IoVecMut<'a> {
#[inline] #[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
@@ -958,31 +979,31 @@ impl<'a> DerefMut for IoVecMut<'a> { @@ -958,11 +968,9 @@ impl<'a> DerefMut for IoVecMut<'a> {
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows. /// Windows.
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
#[repr(transparent)] #[repr(transparent)]
-pub struct IoVec<'a>(sys::io::IoVec<'a>); -pub struct IoVec<'a>(sys::io::IoVec<'a>);
+pub struct IoVec<'a>(IoVecBuffer<'a>); +pub struct IoVec<'a>(IoVecBuffer<'a>);
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> fmt::Debug for IoVec<'a> { impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt) fmt::Debug::fmt(self.0.as_slice(), fmt)
} @@ -975,14 +983,12 @@ impl<'a> IoVec<'a> {
}
+#[cfg(feature="collections")]
impl<'a> IoVec<'a> {
/// Creates a new `IoVec` wrapping a byte slice.
///
/// # Panics /// # Panics
/// ///
/// Panics on Windows if the slice is larger than 4GB. /// Panics on Windows if the slice is larger than 4GB.
@ -1361,11 +1235,10 @@ index 14a16f3..07792b7 100644
} }
-#[unstable(feature = "iovec", issue = "58452")] -#[unstable(feature = "iovec", issue = "58452")]
+#[cfg(feature="collections")]
impl<'a> Deref for IoVec<'a> { impl<'a> Deref for IoVec<'a> {
type Target = [u8]; type Target = [u8];
@@ -993,13 +1014,11 @@ impl<'a> Deref for IoVec<'a> { @@ -993,13 +999,11 @@ impl<'a> Deref for IoVec<'a> {
} }
/// A type used to conditionally initialize buffers passed to `Read` methods. /// A type used to conditionally initialize buffers passed to `Read` methods.
@ -1379,7 +1252,7 @@ index 14a16f3..07792b7 100644
#[inline] #[inline]
pub fn zeroing() -> Initializer { pub fn zeroing() -> Initializer {
Initializer(true) Initializer(true)
@@ -1013,21 +1032,18 @@ impl Initializer { @@ -1013,21 +1017,18 @@ impl Initializer {
/// read from buffers passed to `Read` methods, and that the return value of /// read from buffers passed to `Read` methods, and that the return value of
/// the method accurately reflects the number of bytes that have been /// the method accurately reflects the number of bytes that have been
/// written to the head of the buffer. /// written to the head of the buffer.
@ -1401,7 +1274,7 @@ index 14a16f3..07792b7 100644
#[inline] #[inline]
pub fn initialize(&self, buf: &mut [u8]) { pub fn initialize(&self, buf: &mut [u8]) {
if self.should_initialize() { if self.should_initialize() {
@@ -1081,7 +1097,6 @@ impl Initializer { @@ -1081,7 +1082,6 @@ impl Initializer {
/// `write` in a loop until its entire input has been written. /// `write` in a loop until its entire input has been written.
/// ///
/// [`write_all`]: #method.write_all /// [`write_all`]: #method.write_all
@ -1409,7 +1282,7 @@ index 14a16f3..07792b7 100644
#[doc(spotlight)] #[doc(spotlight)]
pub trait Write { pub trait Write {
/// Write a buffer into this writer, returning how many bytes were written. /// Write a buffer into this writer, returning how many bytes were written.
@@ -1130,7 +1145,6 @@ pub trait Write { @@ -1130,7 +1130,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1417,16 +1290,15 @@ index 14a16f3..07792b7 100644
fn write(&mut self, buf: &[u8]) -> Result<usize>; fn write(&mut self, buf: &[u8]) -> Result<usize>;
/// Like `write`, except that it writes from a slice of buffers. /// Like `write`, except that it writes from a slice of buffers.
@@ -1141,7 +1155,7 @@ pub trait Write { @@ -1141,7 +1140,6 @@ pub trait Write {
/// ///
/// The default implementation calls `write` with either the first nonempty /// The default implementation calls `write` with either the first nonempty
/// buffer provided, or an empty one if none exists. /// buffer provided, or an empty one if none exists.
- #[unstable(feature = "iovec", issue = "58452")] - #[unstable(feature = "iovec", issue = "58452")]
+ #[cfg(feature="collections")]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result<usize> {
default_write_vectored(|b| self.write(b), bufs) default_write_vectored(|b| self.write(b), bufs)
} }
@@ -1169,7 +1183,6 @@ pub trait Write { @@ -1169,7 +1167,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1434,7 +1306,7 @@ index 14a16f3..07792b7 100644
fn flush(&mut self) -> Result<()>; fn flush(&mut self) -> Result<()>;
/// Attempts to write an entire buffer into this writer. /// Attempts to write an entire buffer into this writer.
@@ -1202,7 +1215,6 @@ pub trait Write { @@ -1202,7 +1199,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1442,7 +1314,7 @@ index 14a16f3..07792b7 100644
fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { fn write_all(&mut self, mut buf: &[u8]) -> Result<()> {
while !buf.is_empty() { while !buf.is_empty() {
match self.write(buf) { match self.write(buf) {
@@ -1254,7 +1266,6 @@ pub trait Write { @@ -1254,7 +1250,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1450,7 +1322,7 @@ index 14a16f3..07792b7 100644
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> { fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves // Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them // off I/O errors. instead of discarding them
@@ -1310,7 +1321,6 @@ pub trait Write { @@ -1310,7 +1305,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1458,7 +1330,7 @@ index 14a16f3..07792b7 100644
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
} }
@@ -1340,7 +1350,6 @@ pub trait Write { @@ -1340,7 +1334,6 @@ pub trait Write {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1466,7 +1338,7 @@ index 14a16f3..07792b7 100644
pub trait Seek { pub trait Seek {
/// Seek to an offset, in bytes, in a stream. /// Seek to an offset, in bytes, in a stream.
/// ///
@@ -1356,7 +1365,6 @@ pub trait Seek { @@ -1356,7 +1349,6 @@ pub trait Seek {
/// Seeking to a negative offset is considered an error. /// Seeking to a negative offset is considered an error.
/// ///
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
@ -1474,7 +1346,7 @@ index 14a16f3..07792b7 100644
fn seek(&mut self, pos: SeekFrom) -> Result<u64>; fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
/// Returns the length of this stream (in bytes). /// Returns the length of this stream (in bytes).
@@ -1394,7 +1402,6 @@ pub trait Seek { @@ -1394,7 +1386,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1482,7 +1354,7 @@ index 14a16f3..07792b7 100644
fn stream_len(&mut self) -> Result<u64> { fn stream_len(&mut self) -> Result<u64> {
let old_pos = self.stream_position()?; let old_pos = self.stream_position()?;
let len = self.seek(SeekFrom::End(0))?; let len = self.seek(SeekFrom::End(0))?;
@@ -1433,7 +1440,6 @@ pub trait Seek { @@ -1433,7 +1424,6 @@ pub trait Seek {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1490,7 +1362,7 @@ index 14a16f3..07792b7 100644
fn stream_position(&mut self) -> Result<u64> { fn stream_position(&mut self) -> Result<u64> {
self.seek(SeekFrom::Current(0)) self.seek(SeekFrom::Current(0))
} }
@@ -1445,29 +1451,26 @@ pub trait Seek { @@ -1445,29 +1435,26 @@ pub trait Seek {
/// ///
/// [`Seek`]: trait.Seek.html /// [`Seek`]: trait.Seek.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, PartialEq, Eq, Clone, Debug)]
@ -1524,7 +1396,7 @@ index 14a16f3..07792b7 100644
fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
-> Result<usize> { -> Result<usize> {
let mut read = 0; let mut read = 0;
@@ -1547,7 +1550,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) @@ -1547,7 +1534,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// } /// }
/// ``` /// ```
/// ///
@ -1533,7 +1405,7 @@ index 14a16f3..07792b7 100644
pub trait BufRead: Read { pub trait BufRead: Read {
/// Returns the contents of the internal buffer, filling it with more data /// Returns the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty. /// from the inner reader if it is empty.
@@ -1593,7 +1596,6 @@ pub trait BufRead: Read { @@ -1593,7 +1580,6 @@ pub trait BufRead: Read {
/// // ensure the bytes we worked with aren't returned again later /// // ensure the bytes we worked with aren't returned again later
/// stdin.consume(length); /// stdin.consume(length);
/// ``` /// ```
@ -1541,7 +1413,7 @@ index 14a16f3..07792b7 100644
fn fill_buf(&mut self) -> Result<&[u8]>; fn fill_buf(&mut self) -> Result<&[u8]>;
/// Tells this buffer that `amt` bytes have been consumed from the buffer, /// Tells this buffer that `amt` bytes have been consumed from the buffer,
@@ -1615,7 +1617,6 @@ pub trait BufRead: Read { @@ -1615,7 +1601,6 @@ pub trait BufRead: Read {
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
@ -1549,7 +1421,7 @@ index 14a16f3..07792b7 100644
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
@@ -1671,7 +1672,6 @@ pub trait BufRead: Read { @@ -1671,7 +1656,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b""); /// assert_eq!(buf, b"");
/// ``` /// ```
@ -1557,7 +1429,7 @@ index 14a16f3..07792b7 100644
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
read_until(self, byte, buf) read_until(self, byte, buf)
} }
@@ -1730,7 +1730,6 @@ pub trait BufRead: Read { @@ -1730,7 +1714,6 @@ pub trait BufRead: Read {
/// assert_eq!(num_bytes, 0); /// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, ""); /// assert_eq!(buf, "");
/// ``` /// ```
@ -1565,7 +1437,7 @@ index 14a16f3..07792b7 100644
fn read_line(&mut self, buf: &mut String) -> Result<usize> { fn read_line(&mut self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but // Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see // rather our hardcoded implementation. For more details as to why, see
@@ -1771,7 +1770,6 @@ pub trait BufRead: Read { @@ -1771,7 +1754,6 @@ pub trait BufRead: Read {
/// assert_eq!(split_iter.next(), Some(b"dolor".to_vec())); /// assert_eq!(split_iter.next(), Some(b"dolor".to_vec()));
/// assert_eq!(split_iter.next(), None); /// assert_eq!(split_iter.next(), None);
/// ``` /// ```
@ -1573,7 +1445,7 @@ index 14a16f3..07792b7 100644
fn split(self, byte: u8) -> Split<Self> where Self: Sized { fn split(self, byte: u8) -> Split<Self> where Self: Sized {
Split { buf: self, delim: byte } Split { buf: self, delim: byte }
} }
@@ -1810,7 +1808,6 @@ pub trait BufRead: Read { @@ -1810,7 +1792,6 @@ pub trait BufRead: Read {
/// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
@ -1581,7 +1453,7 @@ index 14a16f3..07792b7 100644
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
} }
@@ -1822,7 +1819,6 @@ pub trait BufRead: Read { @@ -1822,7 +1803,6 @@ pub trait BufRead: Read {
/// Please see the documentation of [`chain`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
@ -1589,7 +1461,7 @@ index 14a16f3..07792b7 100644
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
second: U, second: U,
@@ -1848,7 +1844,6 @@ impl<T, U> Chain<T, U> { @@ -1848,7 +1828,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1597,7 +1469,7 @@ index 14a16f3..07792b7 100644
pub fn into_inner(self) -> (T, U) { pub fn into_inner(self) -> (T, U) {
(self.first, self.second) (self.first, self.second)
} }
@@ -1871,7 +1866,6 @@ impl<T, U> Chain<T, U> { @@ -1871,7 +1850,6 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1605,7 +1477,7 @@ index 14a16f3..07792b7 100644
pub fn get_ref(&self) -> (&T, &U) { pub fn get_ref(&self) -> (&T, &U) {
(&self.first, &self.second) (&self.first, &self.second)
} }
@@ -1898,13 +1892,11 @@ impl<T, U> Chain<T, U> { @@ -1898,13 +1876,11 @@ impl<T, U> Chain<T, U> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1619,7 +1491,7 @@ index 14a16f3..07792b7 100644
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Chain") f.debug_struct("Chain")
@@ -1914,7 +1906,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { @@ -1914,7 +1890,6 @@ impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
} }
} }
@ -1627,15 +1499,7 @@ index 14a16f3..07792b7 100644
impl<T: Read, U: Read> Read for Chain<T, U> { impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
if !self.done_first { if !self.done_first {
@@ -1926,6 +1917,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> { @@ -1946,7 +1921,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
self.second.read(buf)
}
+ #[cfg(feature="collections")]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result<usize> {
if !self.done_first {
match self.first.read_vectored(bufs)? {
@@ -1946,7 +1938,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
} }
} }
@ -1644,7 +1508,7 @@ index 14a16f3..07792b7 100644
impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
if !self.done_first { if !self.done_first {
@@ -1973,7 +1965,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { @@ -1973,7 +1948,6 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Please see the documentation of [`take`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
@ -1652,7 +1516,7 @@ index 14a16f3..07792b7 100644
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
inner: T, inner: T,
@@ -2008,7 +1999,6 @@ impl<T> Take<T> { @@ -2008,7 +1982,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1660,7 +1524,7 @@ index 14a16f3..07792b7 100644
pub fn limit(&self) -> u64 { self.limit } pub fn limit(&self) -> u64 { self.limit }
/// Sets the number of bytes that can be read before this instance will /// Sets the number of bytes that can be read before this instance will
@@ -2034,7 +2024,6 @@ impl<T> Take<T> { @@ -2034,7 +2007,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1668,7 +1532,7 @@ index 14a16f3..07792b7 100644
pub fn set_limit(&mut self, limit: u64) { pub fn set_limit(&mut self, limit: u64) {
self.limit = limit; self.limit = limit;
} }
@@ -2059,7 +2048,6 @@ impl<T> Take<T> { @@ -2059,7 +2031,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1676,7 +1540,7 @@ index 14a16f3..07792b7 100644
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
self.inner self.inner
} }
@@ -2084,7 +2072,6 @@ impl<T> Take<T> { @@ -2084,7 +2055,6 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1684,7 +1548,7 @@ index 14a16f3..07792b7 100644
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.inner &self.inner
} }
@@ -2113,13 +2100,11 @@ impl<T> Take<T> { @@ -2113,13 +2083,11 @@ impl<T> Take<T> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -1698,16 +1562,16 @@ index 14a16f3..07792b7 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2136,15 +2121,9 @@ impl<T: Read> Read for Take<T> { @@ -2137,6 +2105,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -2144,7 +2113,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1715,7 +1579,7 @@ index 14a16f3..07792b7 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -2171,13 +2150,11 @@ impl<T: BufRead> BufRead for Take<T> { @@ -2171,13 +2140,11 @@ impl<T: BufRead> BufRead for Take<T> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1729,7 +1593,7 @@ index 14a16f3..07792b7 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -2201,14 +2178,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -2201,14 +2168,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1746,7 +1610,7 @@ index 14a16f3..07792b7 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2233,13 +2210,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2233,13 +2200,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines
@ -1789,8 +1653,8 @@ index 6aaf8f1..447ce47 100644
-use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
-use crate::mem; -use crate::mem;
+use core::fmt; +use core::fmt;
+use crate::io::{self, Read, Initializer, Write, ErrorKind}; +use crate::io::{self, Read, Initializer, Write, ErrorKind, IoVec, IoVecMut};
+#[cfg(feature="collections")] use crate::io::{BufRead, IoVec, IoVecMut}; +#[cfg(feature="collections")] use crate::io::BufRead;
+use core::mem; +use core::mem;
/// Copies the entire contents of a reader into a writer. /// Copies the entire contents of a reader into a writer.
@ -1859,15 +1723,7 @@ index 6aaf8f1..447ce47 100644
impl Read for Repeat { impl Read for Repeat {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -152,6 +146,7 @@ impl Read for Repeat { @@ -167,7 +161,6 @@ impl Read for Repeat {
Ok(buf.len())
}
+ #[cfg(feature="collections")]
#[inline]
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut nwritten = 0;
@@ -167,7 +162,6 @@ impl Read for Repeat {
} }
} }
@ -1875,7 +1731,7 @@ index 6aaf8f1..447ce47 100644
impl fmt::Debug for Repeat { impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Repeat { .. }") f.pad("Repeat { .. }")
@@ -180,7 +174,6 @@ impl fmt::Debug for Repeat { @@ -180,7 +173,6 @@ impl fmt::Debug for Repeat {
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html
@ -1883,7 +1739,7 @@ index 6aaf8f1..447ce47 100644
pub struct Sink { _priv: () } pub struct Sink { _priv: () }
/// Creates an instance of a writer which will successfully consume all data. /// Creates an instance of a writer which will successfully consume all data.
@@ -197,14 +190,13 @@ pub struct Sink { _priv: () } @@ -197,10 +189,8 @@ pub struct Sink { _priv: () }
/// let num_bytes = io::sink().write(&buffer).unwrap(); /// let num_bytes = io::sink().write(&buffer).unwrap();
/// assert_eq!(num_bytes, 5); /// assert_eq!(num_bytes, 5);
/// ``` /// ```
@ -1894,12 +1750,7 @@ index 6aaf8f1..447ce47 100644
impl Write for Sink { impl Write for Sink {
#[inline] #[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) } fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
@@ -215,7 +205,6 @@ impl Write for Sink {
+ #[cfg(feature="collections")]
#[inline]
fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum();
@@ -215,7 +207,6 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) } fn flush(&mut self) -> io::Result<()> { Ok(()) }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1401,16 +1401,16 @@ index e263db2..2176464 100644
impl<T: Read> Read for Take<T> { impl<T: Read> Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1907,15 +1856,9 @@ impl<T: Read> Read for Take<T> { @@ -1908,6 +1857,7 @@ impl<T: Read> Read for Take<T> {
unsafe fn initializer(&self) -> Initializer {
self.inner.initializer() self.inner.initializer()
} }
-
- fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + #[cfg(feature="collections")]
- let reservation_size = cmp::min(self.limit, 32) as usize; fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- let reservation_size = cmp::min(self.limit, 32) as usize;
- read_to_end_with_reservation(self, buf, reservation_size)
- } @@ -1915,7 +1865,7 @@ impl<T: Read> Read for Take<T> {
}
} }
-#[stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")]
@ -1418,7 +1418,7 @@ index e263db2..2176464 100644
impl<T: BufRead> BufRead for Take<T> { impl<T: BufRead> BufRead for Take<T> {
fn fill_buf(&mut self) -> Result<&[u8]> { fn fill_buf(&mut self) -> Result<&[u8]> {
// Don't call into inner reader at all at EOF because it may still block // Don't call into inner reader at all at EOF because it may still block
@@ -1954,13 +1897,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> { @@ -1954,13 +1904,11 @@ fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
/// Please see the documentation of [`bytes`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
@ -1432,7 +1432,7 @@ index e263db2..2176464 100644
impl<R: Read> Iterator for Bytes<R> { impl<R: Read> Iterator for Bytes<R> {
type Item = Result<u8>; type Item = Result<u8>;
@@ -1976,14 +1917,14 @@ impl<R: Read> Iterator for Bytes<R> { @@ -1976,14 +1924,14 @@ impl<R: Read> Iterator for Bytes<R> {
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1449,7 +1449,7 @@ index e263db2..2176464 100644
impl<B: BufRead> Iterator for Split<B> { impl<B: BufRead> Iterator for Split<B> {
type Item = Result<Vec<u8>>; type Item = Result<Vec<u8>>;
@@ -2008,13 +1949,13 @@ impl<B: BufRead> Iterator for Split<B> { @@ -2008,13 +1956,13 @@ impl<B: BufRead> Iterator for Split<B> {
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More