summaryrefslogtreecommitdiffstats
path: root/vendor/io-close
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/io-close')
-rw-r--r--vendor/io-close/.cargo-checksum.json1
-rw-r--r--vendor/io-close/Cargo.toml33
-rw-r--r--vendor/io-close/LICENSE2
-rw-r--r--vendor/io-close/LICENSE-APACHE201
-rw-r--r--vendor/io-close/LICENSE-MIT25
-rw-r--r--vendor/io-close/README.md1
-rw-r--r--vendor/io-close/rustfmt.toml3
-rw-r--r--vendor/io-close/src/fs.rs24
-rw-r--r--vendor/io-close/src/lib.rs226
9 files changed, 516 insertions, 0 deletions
diff --git a/vendor/io-close/.cargo-checksum.json b/vendor/io-close/.cargo-checksum.json
new file mode 100644
index 000000000..9a7242ef3
--- /dev/null
+++ b/vendor/io-close/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"73683a1dc96ecb6fca1ec733a4017dc4b2f000676db6ffd9e3ca699503cadc40","LICENSE":"0ff5fd909226ed2bb30c59f57ef6659108b39d63df8de0d757f37cc498c3aa17","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c77a4cf9da729987d0fe7ccd811e3bd27393914ddf3d23467c18cc22954513b3","README.md":"7858c98417c1f0ef7e1353814f8fe14d78207303203928a376d0ca328a7c9436","rustfmt.toml":"f62a0c365c36add267d752c01abbe679a07796bfec59a40527c81407e5d7c382","src/fs.rs":"045917ecf411b39bb859ccc600ffa5b20e120fbda459f39d721a1bcc2d544d7d","src/lib.rs":"02703699e9d9ea29143d1260262587262a6f281b97a6868e452e0b6609cd7666"},"package":"9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc"} \ No newline at end of file
diff --git a/vendor/io-close/Cargo.toml b/vendor/io-close/Cargo.toml
new file mode 100644
index 000000000..5e3644469
--- /dev/null
+++ b/vendor/io-close/Cargo.toml
@@ -0,0 +1,33 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "io-close"
+version = "0.3.7"
+authors = ["wufz"]
+description = "An extension trait for safely dropping I/O writers such as File and BufWriter."
+license = "MIT OR Apache-2.0"
+repository = "https://gitlab.com/wufz/io-close"
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+[dependencies.os_pipe]
+version = "0.9.2"
+optional = true
+[dev-dependencies.tempfile]
+version = "3.1.0"
+[target."cfg(unix)".dependencies.libc]
+version = "0.2.80"
+[target."cfg(windows)".dependencies.winapi]
+version = "0.3.9"
+features = ["handleapi", "std", "winsock2"]
diff --git a/vendor/io-close/LICENSE b/vendor/io-close/LICENSE
new file mode 100644
index 000000000..f95499e7d
--- /dev/null
+++ b/vendor/io-close/LICENSE
@@ -0,0 +1,2 @@
+This project is licensed under the MIT license (LICENSE-MIT) or the
+Apache License, Version 2.0 (LICENSE-APACHE), at your option.
diff --git a/vendor/io-close/LICENSE-APACHE b/vendor/io-close/LICENSE-APACHE
new file mode 100644
index 000000000..16fe87b06
--- /dev/null
+++ b/vendor/io-close/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/vendor/io-close/LICENSE-MIT b/vendor/io-close/LICENSE-MIT
new file mode 100644
index 000000000..59f49a934
--- /dev/null
+++ b/vendor/io-close/LICENSE-MIT
@@ -0,0 +1,25 @@
+MIT License
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/vendor/io-close/README.md b/vendor/io-close/README.md
new file mode 100644
index 000000000..f649ef87c
--- /dev/null
+++ b/vendor/io-close/README.md
@@ -0,0 +1 @@
+Please see <https://docs.rs/io-close>.
diff --git a/vendor/io-close/rustfmt.toml b/vendor/io-close/rustfmt.toml
new file mode 100644
index 000000000..ec0b293c7
--- /dev/null
+++ b/vendor/io-close/rustfmt.toml
@@ -0,0 +1,3 @@
+use_small_heuristics = "Max"
+edition = "2018"
+max_width = 78
diff --git a/vendor/io-close/src/fs.rs b/vendor/io-close/src/fs.rs
new file mode 100644
index 000000000..8b76a80cd
--- /dev/null
+++ b/vendor/io-close/src/fs.rs
@@ -0,0 +1,24 @@
+//! Filesystem manipulation operations.
+
+use std::fs::File;
+use std::io::{Result, Write};
+use std::path::Path;
+
+use crate::Close;
+
+/// Write a slice as the entire contents of a file.
+///
+/// This function is identical to [`std::fs::write`] but uses [`Close`]
+/// to drop the [`File`](std::fs::File) created from path, returning any
+/// errors encountered when doing so.
+pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(
+ path: P,
+ contents: C,
+) -> Result<()> {
+ fn inner(path: &Path, contents: &[u8]) -> Result<()> {
+ let mut f = File::create(path)?;
+ f.write_all(contents)?;
+ f.close()
+ }
+ inner(path.as_ref(), contents.as_ref())
+}
diff --git a/vendor/io-close/src/lib.rs b/vendor/io-close/src/lib.rs
new file mode 100644
index 000000000..a530c9bb7
--- /dev/null
+++ b/vendor/io-close/src/lib.rs
@@ -0,0 +1,226 @@
+#![cfg_attr(docsrs, feature(doc_cfg))]
+
+//! An extension trait for safely dropping [I/O writers](std::io::Write)
+//! such as [`File`](std::fs::File) and
+//! [`BufWriter`](std::io::BufWriter). Specifically, it is for I/O
+//! writers which may contain a resource handle (such as a raw file
+//! descriptor), and where the automatic process of closing this handle
+//! during drop may generate an unseen I/O error. Using this trait
+//! (called [`Close`]) these errors can be seen and dealt with.
+//!
+//! In the case of Linux [the man page for
+//! close(2)](https://linux.die.net/man/2/close) has the following to
+//! say:
+//!
+//! > Not checking the return value of close() is a common but
+//! > nevertheless serious programming error. It is quite possible that
+//! > errors on a previous write(2) operation are first reported at the
+//! > final close(). Not checking the return value when closing the file
+//! > may lead to silent loss of data. This can especially be observed
+//! > with NFS and with disk quota.
+//!
+//! Implementations of [`Close`] are provided for most standard library
+//! I/O writers and (optionally) for a selection of I/O writers defined
+//! in external crates.
+//!
+//! # BufWriter example
+//!
+//! ```
+//! use std::io::{BufWriter, Result, Write};
+//! use io_close::Close;
+//!
+//! fn main() -> Result<()> {
+//! let data = b"hello world";
+//! let mut buffer = BufWriter::new(tempfile::tempfile()?);
+//! buffer.write_all(data)?;
+//! buffer.close()?; // safely drop buffer and its contained File
+//! Ok(())
+//! }
+//! ```
+//!
+//! # Optional implementations
+//!
+//! Optional implementations of [`Close`] are provided for the following
+//! I/O writers defined in external crates, enabled through cargo features:
+//!
+//! - [`os_pipe::PipeWriter`] (feature: `os_pipe`)
+
+use std::io::{Error, Result, Write};
+
+pub mod fs;
+
+/// An extension trait for safely dropping I/O writers.
+pub trait Close: Write {
+ /// Drops an I/O writer and closes any resource handle contained
+ /// inside (such as a raw file descriptor). Ensures that I/O errors
+ /// resulting from closing a handle are not ignored. The writer is
+ /// flushed before any handle is closed. If any errors occur during
+ /// flushing or closing the first such error is returned.
+ fn close(self) -> Result<()>;
+}
+
+// MACRO DEFINITIONS
+
+macro_rules! unix_impl_close_raw_fd {
+ ($ty:ty, "std" $(,$lt:lifetime)* $(,$id:ident)*) => {
+ unix_impl_close_raw_fd!($ty, "unix" $(,$lt)* $(,$id)*);
+ };
+ ($ty:ty, $ft_fm:literal $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(unix)]
+ #[cfg(any(feature = $ft_fm, target_family = $ft_fm))]
+ #[cfg_attr(all(docsrs, feature = $ft_fm), doc(cfg(feature = $ft_fm)))]
+ impl<$($lt,)* $($id,)*> Close for $ty {
+ /// Drops an I/O writer containing a raw file descriptor.
+ fn close(mut self) -> Result<()> {
+ use std::io::ErrorKind;
+ use std::os::unix::io::IntoRawFd;
+
+ self.flush()?;
+ let fd = self.into_raw_fd();
+ let rv = unsafe { libc::close(fd) };
+ if rv != -1 {
+ Ok(())
+ } else {
+ match Error::last_os_error() {
+ e if e.kind() == ErrorKind::Interrupted => Ok(()),
+ e => Err(e),
+ }
+ }
+ }
+ }
+ };
+}
+
+macro_rules! windows_impl_close_raw_handle {
+ ($ty:ty, "std" $(,$lt:lifetime)* $(,$id:ident)*) => {
+ windows_impl_close_raw_handle!($ty, "windows" $(,$lt)* $(,$id)*);
+ };
+ ($ty:ty, $ft_fm:literal $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(windows)]
+ #[cfg(any(feature = $ft_fm, target_family = $ft_fm))]
+ #[cfg_attr(all(docsrs, feature = $ft_fm), doc(cfg(feature = $ft_fm)))]
+ impl<$($lt,)* $($id,)*> Close for $ty {
+ /// Drops an I/O writer containing a raw handle.
+ fn close(mut self) -> Result<()> {
+ use std::os::windows::io::IntoRawHandle;
+ use winapi::um::handleapi;
+
+ self.flush()?;
+ let handle = self.into_raw_handle();
+ let rv = unsafe { handleapi::CloseHandle(handle) };
+ if rv != 0 {
+ Ok(())
+ } else {
+ Err(Error::last_os_error())
+ }
+ }
+ }
+ };
+}
+
+macro_rules! windows_impl_close_raw_socket {
+ ($ty:ty, "std" $(,$lt:lifetime)* $(,$id:ident)*) => {
+ windows_impl_close_raw_socket!($ty, "windows" $(,$lt)* $(,$id)*);
+ };
+ ($ty:ty, $ft_fm:literal $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(windows)]
+ #[cfg(any(feature = $ft_fm, target_family = $ft_fm))]
+ #[cfg_attr(all(docsrs, feature = $ft_fm), doc(cfg(feature = $ft_fm)))]
+ impl<$($lt,)* $($id,)*> Close for $ty {
+ /// Drops an I/O writer containing a raw socket.
+ fn close(mut self) -> Result<()> {
+ use std::convert::TryInto;
+ use std::os::windows::io::IntoRawSocket;
+ use winapi::um::winsock2;
+
+ self.flush()?;
+ let socket = self.into_raw_socket().try_into().unwrap();
+ let rv = unsafe { winsock2::closesocket(socket) };
+ if rv == 0 {
+ Ok(())
+ } else {
+ Err(Error::from_raw_os_error(unsafe {
+ winsock2::WSAGetLastError()
+ }))
+ }
+ }
+ }
+ };
+}
+
+macro_rules! impl_close_no_error_no_flush {
+ ($ty:ty, "std" $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(unix)]
+ impl_close_no_error_no_flush!($ty, "unix" $(,$lt)* $(,$id)*);
+ #[cfg(windows)]
+ impl_close_no_error_no_flush!($ty, "windows" $(,$lt)* $(,$id)*);
+ };
+ ($ty:ty, $ft_fm:literal $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(any(unix, windows))]
+ #[cfg(any(feature = $ft_fm, target_family = $ft_fm))]
+ #[cfg_attr(all(docsrs, feature = $ft_fm), doc(cfg(feature = $ft_fm)))]
+ impl<$($lt,)* $($id,)*> Close for $ty {
+ /// Drops an I/O writer for which `close()` never produces
+ /// an error, and for which flushing is unnecessary.
+ #[inline]
+ fn close(self) -> Result<()> {
+ Ok(())
+ }
+ }
+ };
+}
+
+macro_rules! impl_close_into_inner {
+ ($ty:ty, "std" $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(unix)]
+ impl_close_into_inner!($ty, "unix" $(,$lt)* $(,$id)*);
+ #[cfg(windows)]
+ impl_close_into_inner!($ty, "windows" $(,$lt)* $(,$id)*);
+ };
+ ($ty:ty, $ft_fm:literal $(,$lt:lifetime)* $(,$id:ident)*) => {
+ #[cfg(any(unix, windows))]
+ #[cfg(any(feature = $ft_fm, target_family = $ft_fm))]
+ #[cfg_attr(all(docsrs, feature = $ft_fm), doc(cfg(feature = $ft_fm)))]
+ impl<$($lt,)* W: Close, $($id,)*> Close for $ty {
+ /// Drops an I/O writer which can be unwrapped using
+ /// `into_inner()` to return an underlying writer.
+ fn close(self) -> Result<()> {
+ self.into_inner()?.close()
+ }
+ }
+ };
+}
+
+// IMPLEMENTATIONS
+//
+// In the below macro implementations for Close the macro parameters use
+// the following system:
+//
+// 1st paramater: the type that Close is being implemented for
+// 2nd parameter: either "std", or a feature name
+// 3rd, 4th, etc. parameters: additional generic arguments for type
+//
+// If the 2nd parameter is a feature name then the implementation will
+// be conditionally compiled only when that feature is present.
+
+unix_impl_close_raw_fd!(std::fs::File, "std");
+unix_impl_close_raw_fd!(std::net::TcpStream, "std");
+unix_impl_close_raw_fd!(std::os::unix::net::UnixStream, "std");
+unix_impl_close_raw_fd!(std::process::ChildStdin, "std");
+unix_impl_close_raw_fd!(os_pipe::PipeWriter, "os_pipe");
+
+windows_impl_close_raw_handle!(std::fs::File, "std");
+windows_impl_close_raw_socket!(std::net::TcpStream, "std");
+windows_impl_close_raw_handle!(std::process::ChildStdin, "std");
+windows_impl_close_raw_handle!(os_pipe::PipeWriter, "os_pipe");
+
+impl_close_no_error_no_flush!(&mut [u8], "std");
+impl_close_no_error_no_flush!(std::io::Cursor<&mut Vec<u8>>, "std");
+impl_close_no_error_no_flush!(std::io::Cursor<&mut [u8]>, "std");
+impl_close_no_error_no_flush!(std::io::Cursor<Box<[u8]>>, "std");
+impl_close_no_error_no_flush!(std::io::Cursor<Vec<u8>>, "std");
+impl_close_no_error_no_flush!(std::io::Sink, "std");
+impl_close_no_error_no_flush!(Vec<u8>, "std");
+
+impl_close_into_inner!(std::io::BufWriter<W>, "std");
+impl_close_into_inner!(std::io::LineWriter<W>, "std");