Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Add `{read,write}_vectored` for more types #59852

Merged
merged 1 commit into from Apr 14, 2019

Conversation

Projects
None yet
6 participants
@alexcrichton
Copy link
Member

commented Apr 10, 2019

This commit implements the {read,write}_vectored methods on more types
in the standard library, namely:

  • std::fs::File
  • std::process::ChildStd{in,out,err}
  • std::io::Std{in,out,err}
  • std::io::Std{in,out,err}Lock
  • std::io::Std{in,out,err}Raw

Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.

std: Add `{read,write}_vectored` for more types
This commit implements the `{read,write}_vectored` methods on more types
in the standard library, namely:

* `std::fs::File`
* `std::process::ChildStd{in,out,err}`
* `std::io::Std{in,out,err}`
* `std::io::Std{in,out,err}Lock`
* `std::io::Std{in,out,err}Raw`

Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.
@alexcrichton

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Apr 10, 2019

r? @joshtriplett

(rust_highfive has picked a reviewer for you, use r? to override)

@sfackler

This comment has been minimized.

Copy link
Member

commented Apr 10, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2019

📌 Commit acf3ddb has been approved by sfackler

@@ -13,8 +13,12 @@ impl Stdin {
}

pub fn read(&self, data: &mut [u8]) -> io::Result<usize> {
self.read_vectored(&mut [IoVecMut::new(data)])

This comment has been minimized.

Copy link
@fbstj

fbstj Apr 10, 2019

Contributor

are vectored reads somehow more "fundamental" on wasi? might be worth a comment?

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Apr 10, 2019

Author Member

They are yeah where at the syscall layer there's only vectored reads/writes, but this is in general just deduplicating code

let ret = fd.write(buf);
fd.into_raw(); // do not close this FD
ret
ManuallyDrop::new(FileDesc::new(libc::STDOUT_FILENO)).write(buf)

This comment has been minimized.

Copy link
@fbstj

fbstj Apr 10, 2019

Contributor

is this change coming from some other PR?

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Apr 10, 2019

Author Member

Nah this is an intended change for this PR

Centril added a commit to Centril/rust that referenced this pull request Apr 12, 2019

Rollup merge of rust-lang#59852 - alexcrichton:more-vectored, r=sfackler
std: Add `{read,write}_vectored` for more types

This commit implements the `{read,write}_vectored` methods on more types
in the standard library, namely:

* `std::fs::File`
* `std::process::ChildStd{in,out,err}`
* `std::io::Std{in,out,err}`
* `std::io::Std{in,out,err}Lock`
* `std::io::Std{in,out,err}Raw`

Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.

bors added a commit that referenced this pull request Apr 12, 2019

Auto merge of #59921 - Centril:rollup-amorbbw, r=Centril
Rollup of 17 pull requests

Successful merges:

 - #59675 (Stabilize the `alloc` crate.)
 - #59693 (Increase `Span` from 4 bytes to 8 bytes.)
 - #59708 (Mark variables captured by reference as mutable correctly)
 - #59735 (remove lookup_char_pos_adj)
 - #59747 (Copy book.toml unstable book generator)
 - #59752 (Limit dylib symbols)
 - #59796 (Retire `IsNotConst` naming)
 - #59804 (Clean up jobserver integration)
 - #59818 (Eliminate `FnBox` usages from libstd.)
 - #59830 (Fix links on keyword docs.)
 - #59835 (Re-export NonZero signed variant in std)
 - #59852 (std: Add `{read,write}_vectored` for more types)
 - #59855 (Fix attributes position in type declaration)
 - #59858 (Make duplicate matcher bindings a hard error)
 - #59879 (Use SecRandomCopyBytes instead of /dev/urandom on MacOS)
 - #59899 (In `-Zprint-type-size` output, sort enum variants by size.)
 - #59912 (MaybeUninit: remove deprecated functions)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Apr 13, 2019

Rollup merge of rust-lang#59852 - alexcrichton:more-vectored, r=sfackler
std: Add `{read,write}_vectored` for more types

This commit implements the `{read,write}_vectored` methods on more types
in the standard library, namely:

* `std::fs::File`
* `std::process::ChildStd{in,out,err}`
* `std::io::Std{in,out,err}`
* `std::io::Std{in,out,err}Lock`
* `std::io::Std{in,out,err}Raw`

Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.

Centril added a commit to Centril/rust that referenced this pull request Apr 13, 2019

Rollup merge of rust-lang#59937 - Centril:rollup-6pousju, r=Centril
Rollup of 18 pull requests

Successful merges:

 - rust-lang#59612 (Use normal newtype_index macro for MIR dataflows)
 - rust-lang#59675 (Stabilize the `alloc` crate.)
 - rust-lang#59708 (Mark variables captured by reference as mutable correctly)
 - rust-lang#59735 (remove lookup_char_pos_adj)
 - rust-lang#59747 (Copy book.toml unstable book generator)
 - rust-lang#59796 (Retire `IsNotConst` naming)
 - rust-lang#59804 (Clean up jobserver integration)
 - rust-lang#59818 (Eliminate `FnBox` usages from libstd.)
 - rust-lang#59830 (Fix links on keyword docs.)
 - rust-lang#59835 (Re-export NonZero signed variant in std)
 - rust-lang#59852 (std: Add `{read,write}_vectored` for more types)
 - rust-lang#59855 (Fix attributes position in type declaration)
 - rust-lang#59858 (Make duplicate matcher bindings a hard error)
 - rust-lang#59879 (Use SecRandomCopyBytes instead of /dev/urandom on MacOS)
 - rust-lang#59899 (In `-Zprint-type-size` output, sort enum variants by size.)
 - rust-lang#59912 (MaybeUninit: remove deprecated functions)
 - rust-lang#59925 (Fix paste error in split_ascii_whitespace docs.)
 - rust-lang#59930 (Exclude some copies of old book editions from search engines)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Apr 13, 2019

Auto merge of #59937 - Centril:rollup-6pousju, r=Centril
Rollup of 18 pull requests

Successful merges:

 - #59612 (Use normal newtype_index macro for MIR dataflows)
 - #59675 (Stabilize the `alloc` crate.)
 - #59708 (Mark variables captured by reference as mutable correctly)
 - #59735 (remove lookup_char_pos_adj)
 - #59747 (Copy book.toml unstable book generator)
 - #59796 (Retire `IsNotConst` naming)
 - #59804 (Clean up jobserver integration)
 - #59818 (Eliminate `FnBox` usages from libstd.)
 - #59830 (Fix links on keyword docs.)
 - #59835 (Re-export NonZero signed variant in std)
 - #59852 (std: Add `{read,write}_vectored` for more types)
 - #59855 (Fix attributes position in type declaration)
 - #59858 (Make duplicate matcher bindings a hard error)
 - #59879 (Use SecRandomCopyBytes instead of /dev/urandom on MacOS)
 - #59899 (In `-Zprint-type-size` output, sort enum variants by size.)
 - #59912 (MaybeUninit: remove deprecated functions)
 - #59925 (Fix paste error in split_ascii_whitespace docs.)
 - #59930 (Exclude some copies of old book editions from search engines)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Apr 13, 2019

Rollup merge of rust-lang#59852 - alexcrichton:more-vectored, r=sfackler
std: Add `{read,write}_vectored` for more types

This commit implements the `{read,write}_vectored` methods on more types
in the standard library, namely:

* `std::fs::File`
* `std::process::ChildStd{in,out,err}`
* `std::io::Std{in,out,err}`
* `std::io::Std{in,out,err}Lock`
* `std::io::Std{in,out,err}Raw`

Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.

bors added a commit that referenced this pull request Apr 13, 2019

Auto merge of #59941 - Centril:rollup-ugml7zw, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #59675 (Stabilize the `alloc` crate.)
 - #59708 (Mark variables captured by reference as mutable correctly)
 - #59735 (remove lookup_char_pos_adj)
 - #59747 (Copy book.toml unstable book generator)
 - #59796 (Retire `IsNotConst` naming)
 - #59818 (Eliminate `FnBox` usages from libstd.)
 - #59830 (Fix links on keyword docs.)
 - #59835 (Re-export NonZero signed variant in std)
 - #59852 (std: Add `{read,write}_vectored` for more types)
 - #59855 (Fix attributes position in type declaration)
 - #59858 (Make duplicate matcher bindings a hard error)
 - #59879 (Use SecRandomCopyBytes instead of /dev/urandom on MacOS)
 - #59899 (In `-Zprint-type-size` output, sort enum variants by size.)
 - #59912 (MaybeUninit: remove deprecated functions)
 - #59925 (Fix paste error in split_ascii_whitespace docs.)
 - #59930 (Exclude some copies of old book editions from search engines)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Apr 13, 2019

Rollup merge of rust-lang#59852 - alexcrichton:more-vectored, r=sfackler
std: Add `{read,write}_vectored` for more types

This commit implements the `{read,write}_vectored` methods on more types
in the standard library, namely:

* `std::fs::File`
* `std::process::ChildStd{in,out,err}`
* `std::io::Std{in,out,err}`
* `std::io::Std{in,out,err}Lock`
* `std::io::Std{in,out,err}Raw`

Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.

bors added a commit that referenced this pull request Apr 13, 2019

Auto merge of #59949 - Centril:rollup-lsiqq1g, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #59675 (Stabilize the `alloc` crate.)
 - #59708 (Mark variables captured by reference as mutable correctly)
 - #59735 (remove lookup_char_pos_adj)
 - #59747 (Copy book.toml unstable book generator)
 - #59796 (Retire `IsNotConst` naming)
 - #59804 (Clean up jobserver integration)
 - #59818 (Eliminate `FnBox` usages from libstd.)
 - #59830 (Fix links on keyword docs.)
 - #59835 (Re-export NonZero signed variant in std)
 - #59852 (std: Add `{read,write}_vectored` for more types)
 - #59855 (Fix attributes position in type declaration)
 - #59858 (Make duplicate matcher bindings a hard error)
 - #59899 (In `-Zprint-type-size` output, sort enum variants by size.)
 - #59912 (MaybeUninit: remove deprecated functions)
 - #59925 (Fix paste error in split_ascii_whitespace docs.)
 - #59930 (Exclude some copies of old book editions from search engines)

Failed merges:

r? @ghost

@bors bors merged commit acf3ddb into rust-lang:master Apr 14, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details

@alexcrichton alexcrichton deleted the alexcrichton:more-vectored branch May 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.