Make availability of Error impl conditional
+#[cfg(feature = "use_std")]
use std::error::Error;
+#[cfg(feature = "use_std")]
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
+
use std::iter::ExactSizeIterator;
use either::Either;
@@ -70,6 +73,7 @@ where
impl<I> ExactSizeIterator for ExactlyOneError<I> where I: ExactSizeIterator {}
+#[cfg(feature = "use_std")]
impl<I> Display for ExactlyOneError<I>
where I: Iterator
{
@@ -83,6 +87,7 @@ impl<I> Display for ExactlyOneError<I>
}
}
+#[cfg(feature = "use_std")]
impl<I> Debug for ExactlyOneError<I>
where I: Iterator,
I::Item: Debug,
@@ -102,9 +107,10 @@ impl<I> Debug for ExactlyOneError<I>
}
}
+#[cfg(feature = "use_std")]
impl<I> Error for ExactlyOneError<I> where I: Iterator, I::Item: Debug, {}
-#[cfg(test)]
+#[cfg(all(test, feature = "use_std"))]
mod tests {
use super::*;
