summaryrefslogtreecommitdiffstats
path: root/vendor/either
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
commit2ff14448863ac1a1dd9533461708e29aae170c2d (patch)
tree85b9fea2bbfe3f06473cfa381eed11f273b57c5c /vendor/either
parentAdding debian version 1.64.0+dfsg1-1. (diff)
downloadrustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz
rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/either')
-rw-r--r--vendor/either/.cargo-checksum.json2
-rw-r--r--vendor/either/Cargo.toml4
-rw-r--r--vendor/either/README.rst13
-rw-r--r--vendor/either/src/lib.rs71
4 files changed, 86 insertions, 4 deletions
diff --git a/vendor/either/.cargo-checksum.json b/vendor/either/.cargo-checksum.json
index 207aba04a..5e1f8841d 100644
--- a/vendor/either/.cargo-checksum.json
+++ b/vendor/either/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"77c37f327af7a6146ba111c1c0a3e861bd444f31cfe44c3645c8e090502f66b4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README-crates.io.md":"b775991a01ab4a0a8de6169f597775319d9ce8178f5c74ccdc634f13a286b20c","README.rst":"f948f4333e9d66477128bcaf69a449a139bf00633eb57491fa1b379a3ce30b74","src/lib.rs":"e0f7c05e75af07765c2298a1791c65ea80f3c099491ed95c2e6c771041aa9931","src/serde_untagged.rs":"e826ee0ab31616e49c3e3f3711c8441001ee424b3e7a8c4c466cfcc4f8a7701a","src/serde_untagged_optional.rs":"86265f09d0795428bb2ce013b070d1badf1e2210217844a9ff3f04b2795868ab"},"package":"3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be"} \ No newline at end of file
+{"files":{"Cargo.toml":"321950b99b4f04079e2470d754419bedba9851b71d1a2d8bd9c9046e38b87640","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README-crates.io.md":"b775991a01ab4a0a8de6169f597775319d9ce8178f5c74ccdc634f13a286b20c","README.rst":"1369598deaae0ff925e8910df42354d33a43606961c40e7b71a7454a7f0b775e","src/lib.rs":"bc950126c901ea5c12ce4d02a7e58e3b1e2b428caca68bd510bad1f2488e2ced","src/serde_untagged.rs":"e826ee0ab31616e49c3e3f3711c8441001ee424b3e7a8c4c466cfcc4f8a7701a","src/serde_untagged_optional.rs":"86265f09d0795428bb2ce013b070d1badf1e2210217844a9ff3f04b2795868ab"},"package":"90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"} \ No newline at end of file
diff --git a/vendor/either/Cargo.toml b/vendor/either/Cargo.toml
index d571ff8da..eb1c5b4b5 100644
--- a/vendor/either/Cargo.toml
+++ b/vendor/either/Cargo.toml
@@ -11,9 +11,9 @@
[package]
edition = "2018"
-rust-version = "1.31"
+rust-version = "1.36"
name = "either"
-version = "1.7.0"
+version = "1.8.0"
authors = ["bluss"]
description = """
The enum `Either` with variants `Left` and `Right` is a general purpose sum type with two cases.
diff --git a/vendor/either/README.rst b/vendor/either/README.rst
index 992e49c50..43c156a9f 100644
--- a/vendor/either/README.rst
+++ b/vendor/either/README.rst
@@ -25,12 +25,23 @@ __ https://docs.rs/either/
How to use with cargo::
[dependencies]
- either = "1.7"
+ either = "1.8"
Recent Changes
--------------
+- 1.8.0
+
+ - **MSRV**: ``either`` now requires Rust 1.36 or later.
+
+ - Add new methods ``.as_pin_ref()`` and ``.as_pin_mut()`` to project a
+ pinned ``Either`` as inner ``Pin`` variants, by @cuviper (#77)
+
+ - Implement the ``Future`` trait, by @cuviper (#77)
+
+ - Specialize more methods of the ``io`` traits, by @Kixunil and @cuviper (#75)
+
- 1.7.0
- **MSRV**: ``either`` now requires Rust 1.31 or later.
diff --git a/vendor/either/src/lib.rs b/vendor/either/src/lib.rs
index a4f2a5454..9a271c351 100644
--- a/vendor/either/src/lib.rs
+++ b/vendor/either/src/lib.rs
@@ -26,9 +26,11 @@ pub mod serde_untagged_optional;
use core::convert::{AsMut, AsRef};
use core::fmt;
+use core::future::Future;
use core::iter;
use core::ops::Deref;
use core::ops::DerefMut;
+use core::pin::Pin;
#[cfg(any(test, feature = "use_std"))]
use std::error::Error;
@@ -255,6 +257,35 @@ impl<L, R> Either<L, R> {
}
}
+ /// Convert `Pin<&Either<L, R>>` to `Either<Pin<&L>, Pin<&R>>`,
+ /// pinned projections of the inner variants.
+ pub fn as_pin_ref(self: Pin<&Self>) -> Either<Pin<&L>, Pin<&R>> {
+ // SAFETY: We can use `new_unchecked` because the `inner` parts are
+ // guaranteed to be pinned, as they come from `self` which is pinned.
+ unsafe {
+ match *Pin::get_ref(self) {
+ Left(ref inner) => Left(Pin::new_unchecked(inner)),
+ Right(ref inner) => Right(Pin::new_unchecked(inner)),
+ }
+ }
+ }
+
+ /// Convert `Pin<&mut Either<L, R>>` to `Either<Pin<&mut L>, Pin<&mut R>>`,
+ /// pinned projections of the inner variants.
+ pub fn as_pin_mut(self: Pin<&mut Self>) -> Either<Pin<&mut L>, Pin<&mut R>> {
+ // SAFETY: `get_unchecked_mut` is fine because we don't move anything.
+ // We can use `new_unchecked` because the `inner` parts are guaranteed
+ // to be pinned, as they come from `self` which is pinned, and we never
+ // offer an unpinned `&mut L` or `&mut R` through `Pin<&mut Self>`. We
+ // also don't have an implementation of `Drop`, nor manual `Unpin`.
+ unsafe {
+ match *Pin::get_unchecked_mut(self) {
+ Left(ref mut inner) => Left(Pin::new_unchecked(inner)),
+ Right(ref mut inner) => Right(Pin::new_unchecked(inner)),
+ }
+ }
+ }
+
/// Convert `Either<L, R>` to `Either<R, L>`.
///
/// ```
@@ -1038,6 +1069,22 @@ where
{
}
+/// `Either<L, R>` is a future if both `L` and `R` are futures.
+impl<L, R> Future for Either<L, R>
+where
+ L: Future,
+ R: Future<Output = L::Output>,
+{
+ type Output = L::Output;
+
+ fn poll(
+ self: Pin<&mut Self>,
+ cx: &mut core::task::Context<'_>,
+ ) -> core::task::Poll<Self::Output> {
+ for_both!(self.as_pin_mut(), inner => inner.poll(cx))
+ }
+}
+
#[cfg(any(test, feature = "use_std"))]
/// `Either<L, R>` implements `Read` if both `L` and `R` do.
///
@@ -1051,9 +1098,17 @@ where
for_both!(*self, ref mut inner => inner.read(buf))
}
+ fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
+ for_both!(*self, ref mut inner => inner.read_exact(buf))
+ }
+
fn read_to_end(&mut self, buf: &mut std::vec::Vec<u8>) -> io::Result<usize> {
for_both!(*self, ref mut inner => inner.read_to_end(buf))
}
+
+ fn read_to_string(&mut self, buf: &mut std::string::String) -> io::Result<usize> {
+ for_both!(*self, ref mut inner => inner.read_to_string(buf))
+ }
}
#[cfg(any(test, feature = "use_std"))]
@@ -1084,6 +1139,14 @@ where
fn consume(&mut self, amt: usize) {
for_both!(*self, ref mut inner => inner.consume(amt))
}
+
+ fn read_until(&mut self, byte: u8, buf: &mut std::vec::Vec<u8>) -> io::Result<usize> {
+ for_both!(*self, ref mut inner => inner.read_until(byte, buf))
+ }
+
+ fn read_line(&mut self, buf: &mut std::string::String) -> io::Result<usize> {
+ for_both!(*self, ref mut inner => inner.read_line(buf))
+ }
}
#[cfg(any(test, feature = "use_std"))]
@@ -1099,6 +1162,14 @@ where
for_both!(*self, ref mut inner => inner.write(buf))
}
+ fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
+ for_both!(*self, ref mut inner => inner.write_all(buf))
+ }
+
+ fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
+ for_both!(*self, ref mut inner => inner.write_fmt(fmt))
+ }
+
fn flush(&mut self) -> io::Result<()> {
for_both!(*self, ref mut inner => inner.flush())
}