pub fn stream_exhaustive<'v, S>(build: impl Fn() -> S, check: impl Fn(Result<S, crate::Error>))
    where
        S: Stream<'v>,
    {
        use crate::std::{
            boxed::Box,
            collections::BTreeMap,
        };

        let source = {
            #[cfg(not(feature = "std"))]
            {
                Source(OwnedSource::empty())
            }

            #[cfg(feature = "std")]
            {
                use crate::std::io;

                Source::new(&io::Error::from(io::ErrorKind::Other))
            }
        };

        #[allow(clippy::excessive_precision)]
        let values: Vec<Box<dyn Value>> = vec![
            Box::new(u8::max_value()),
            Box::new(u16::max_value()),
            Box::new(u32::max_value()),
            Box::new(u64::max_value()),
            Box::new(u128::max_value()),
            Box::new(i8::min_value()),
            Box::new(i16::min_value()),
            Box::new(i32::min_value()),
            Box::new(i64::min_value()),
            Box::new(i128::min_value()),
            Box::new(4.25827473958372f32),
            Box::new(4271.00000000001f64),
            Box::new('山'),
            Box::new("🍔∈🌏"),
            Box::new(Some(1)),
            Box::new(Option::None::<u8>),
            Box::new(vec![1, 2, 3, 4]),
            Box::new({
                let v: Vec<Box<dyn Value>> = vec![Box::new(1), Box::new('a')];
                v
            }),
            Box::new({
                let mut v = BTreeMap::new();
                v.insert(String::from("a"), 1);
                v.insert(String::from("b"), 2);
                v.insert(String::from("c"), 3);
                v.insert(String::from("d"), 4);
                v
            }),
            Box::new({
                let mut v = BTreeMap::new();
                v.insert(1, 1);
                v.insert(2, 2);
                v.insert(3, 3);
                v.insert(4, 4);
                v
            }),
            Box::new({
                let mut v: BTreeMap<String, Box<dyn Value>> = BTreeMap::new();
                v.insert(String::from("a"), Box::new(1));
                v.insert(String::from("b"), Box::new('a'));
                v
            }),
            Box::new({
                let v: Vec<Box<dyn Value>> = vec![
                    Box::new(1),
                    Box::new({
                        let mut v: BTreeMap<String, Box<dyn Value>> = BTreeMap::new();
                        v.insert(String::from("a"), Box::new(1));
                        v.insert(String::from("b"), Box::new('a'));
                        v
                    }),
                ];
                v
            }),
            Box::new(stream::Source::from(&source.0)),
        ];

        macro_rules! check {
            ($build:expr, $value:expr) => {
                let mut s = $build;

                let r = crate::stream_owned(&mut s, &$value);

                if let Err(e) = &r {
                    // We only care about errors from the stream when a method isn't overridden
                    // If the stream intentionally returns unsupported then this condition isn't hit
                    if e.is_default_unsupported() {
                        let tokens = tokens(&$value);
                        panic!("value `{:?}` is unsupported (a method on `Stream` hasn't been overridden)", tokens);
                    }
                }

                check(r.map(|_| s));
            };
        }

        // Check fmt separately for lifetime reasons
        check!(build(), format_args!("A {} value", "🍔∈🌏"));

        for value in values {
            check!(build(), value);
        }
    }
/**
    Ensure a stream is valid for various inputs.

    This is useful for smoke-testing stream implementations to make sure they explicitly
    implement all methods on `Stream`. The stream will only be given technically valid inputs.

    Any new methods added to `Stream` may cause this method to panic until the given `Stream` is updated.
    */
Ensure a stream is valid for various inputs.
This is useful for smoke-testing stream implementations to make sure they explicitly
implement all methods on `Stream`. The stream will only be given technically valid inputs.

Any new methods added to `Stream` may cause this method to panic until the given `Stream` is updated.
Ensure a stream is valid for various inputs . This is useful for smoke - testing stream implementations to make sure they explicitly implement all methods on ` Stream ` . The stream will only be given technically valid inputs . Any new methods added to ` Stream ` may cause this method to panic until the given ` Stream ` is updated .
pub fn stream_exhaustive<'v, S>(build: impl Fn() -> S, check: impl Fn(Result<S, crate::Error>))
    where
        S: Stream<'v>,
    {
        use crate::std::{
            boxed::Box,
            collections::BTreeMap,
        };
        let source = {
            #[cfg(not(feature = "std"))]
            {
                Source(OwnedSource::empty())
            }
            #[cfg(feature = "std")]
            {
                use crate::std::io;
                Source::new(&io::Error::from(io::ErrorKind::Other))
            }
        };
        #[allow(clippy::excessive_precision)]
        let values: Vec<Box<dyn Value>> = vec![
            Box::new(u8::max_value()),
            Box::new(u16::max_value()),
            Box::new(u32::max_value()),
            Box::new(u64::max_value()),
            Box::new(u128::max_value()),
            Box::new(i8::min_value()),
            Box::new(i16::min_value()),
            Box::new(i32::min_value()),
            Box::new(i64::min_value()),
            Box::new(i128::min_value()),
            Box::new(4.25827473958372f32),
            Box::new(4271.00000000001f64),
            Box::new('山'),
            Box::new("🍔∈🌏"),
            Box::new(Some(1)),
            Box::new(Option::None::<u8>),
            Box::new(vec![1, 2, 3, 4]),
            Box::new({
                let v: Vec<Box<dyn Value>> = vec![Box::new(1), Box::new('a')];
                v
            }),
            Box::new({
                let mut v = BTreeMap::new();
                v.insert(String::from("a"), 1);
                v.insert(String::from("b"), 2);
                v.insert(String::from("c"), 3);
                v.insert(String::from("d"), 4);
                v
            }),
            Box::new({
                let mut v = BTreeMap::new();
                v.insert(1, 1);
                v.insert(2, 2);
                v.insert(3, 3);
                v.insert(4, 4);
                v
            }),
            Box::new({
                let mut v: BTreeMap<String, Box<dyn Value>> = BTreeMap::new();
                v.insert(String::from("a"), Box::new(1));
                v.insert(String::from("b"), Box::new('a'));
                v
            }),
            Box::new({
                let v: Vec<Box<dyn Value>> = vec![
                    Box::new(1),
                    Box::new({
                        let mut v: BTreeMap<String, Box<dyn Value>> = BTreeMap::new();
                        v.insert(String::from("a"), Box::new(1));
                        v.insert(String::from("b"), Box::new('a'));
                        v
                    }),
                ];
                v
            }),
            Box::new(stream::Source::from(&source.0)),
        ];
        macro_rules! check {
            ($build:expr, $value:expr) => {
                let mut s = $build;
                let r = crate::stream_owned(&mut s, &$value);
                if let Err(e) = &r {
                    // We only care about errors from the stream when a method isn't overridden
                    // If the stream intentionally returns unsupported then this condition isn't hit
                    if e.is_default_unsupported() {
                        let tokens = tokens(&$value);
                        panic!("value `{:?}` is unsupported (a method on `Stream` hasn't been overridden)", tokens);
                    }
                }
                check(r.map(|_| s));
            };
        }
        // Check fmt separately for lifetime reasons
        check!(build(), format_args!("A {} value", "🍔∈🌏"));
        for value in values {
            check!(build(), value);
        }
    }
pub fn stream_exhaustive < ' v , S > ( build : impl Fn ( ) -> S , check : impl Fn ( Result < S , crate :: Error > ) ) where S : Stream < ' v > , { use crate :: std :: { boxed :: Box , collections :: BTreeMap , } ; let source = { # [ cfg ( not ( feature " " ) ) ] { Source ( OwnedSource :: empty ( ) ) } # [ cfg ( feature " " ) ] { use crate :: std :: io ; Source :: new ( & io :: Error :: from ( io :: ErrorKind :: Other ) ) } } ; # [ allow ( clippy excessive_precision ) ] let values : Vec < Box < dyn Value > > = vec ! [ Box new ( u8 max_value ( ) ) Box new ( u16 max_value ( ) ) Box new ( u32 max_value ( ) ) Box new ( u64 max_value ( ) ) Box new ( u128 max_value ( ) ) Box new ( i8 min_value ( ) ) Box new ( i16 min_value ( ) ) Box new ( i32 min_value ( ) ) Box new ( i64 min_value ( ) ) Box new ( i128 min_value ( ) ) Box new ( 4.25827473958372f32 ) Box new ( 4271.00000000001f64 ) Box new ( '山'), Box new ( " Box new ( Some ( 1 ) ) Box new ( Option None u8 ) Box new ( vec [ 1 2 3 4 ] ) Box new ( { let v Vec Box dyn Value vec [ Box new ( 1 ) Box new ( 'a' ) ] v } ) Box new ( { let mut v BTreeMap new ( ) v insert ( String from ( " " ) 1 ) v insert ( String from ( " " ) 2 ) v insert ( String from ( " " ) 3 ) v insert ( String from ( " " ) 4 ) v } ) Box new ( { let mut v BTreeMap new ( ) v insert ( 1 1 ) v insert ( 2 2 ) v insert ( 3 3 ) v insert ( 4 4 ) v } ) Box new ( { let mut v BTreeMap String Box dyn Value BTreeMap new ( ) v insert ( String from ( " " ) Box new ( 1 ) ) v insert ( String from ( " " ) Box new ( 'a' ) ) v } ) Box new ( { let v Vec Box dyn Value vec [ Box new ( 1 ) Box new ( { let mut v BTreeMap String Box dyn Value BTreeMap new ( ) v insert ( String from ( " " ) Box new ( 1 ) ) v insert ( String from ( " " ) Box new ( 'a' ) ) v } ) ] v } ) Box new ( stream Source from ( source 0 ) ) ] ; macro_rules! check { ( $build : expr $value : expr ) => { let mut s $build let r crate stream_owned ( mut s $value ) if let Err ( e ) r { // We only care about errors from the stream when a method isn't overridden // If the stream intentionally returns unsupported then this condition isn't hit if e is_default_unsupported ( ) { let tokens tokens ( $value ) panic ( " " tokens ) } } check ( r map ( s ) ) } ; } // Check fmt separately for lifetime reasons check ! ( build ( ) format_args ( " " " for value in values { check ! ( build ( ) value ) ; } }
Ensure a stream is valid for various inputs.
Ensure a stream is valid for various inputs .
build
impl Fn() -> S
check
impl Fn(Result<S, crate::Error>)