| 1 | use craterust-analyzer cargo schemars 1.2.2 crate/::preluderust-analyzer cargo schemars 1.2.2 prelude/::*; |
| 2 | use arrayvec07rust-analyzer cargo arrayvec 0.7.8 crate/::{ArrayStringrust-analyzer cargo arrayvec 0.7.8 array_string/ArrayString#, ArrayVecrust-analyzer cargo arrayvec 0.7.8 arrayvec/ArrayVec#}; |
| 3 | |
| 4 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 5 | fn arrayvec07rust-analyzer cargo schemars 1.2.2 arrayvec/arrayvec07().() { |
| 6 | testrust-analyzer cargo schemars 1.2.2 test!!(ArrayVecrust-analyzer cargo arrayvec 0.7.8 arrayvec/ArrayVec#<i32, 8>) |
| 7 | .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().() |
| 8 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([ |
| 9 | ArrayVecrust-analyzer cargo arrayvec 0.7.8 arrayvec/ArrayVec#::from_iterrust-analyzer cargo arrayvec 0.7.8 arrayvec/impl#[`ArrayVec<T, CAP>`][`FromIterator<T>`]from_iter().([]), |
| 10 | ArrayVecrust-analyzer cargo arrayvec 0.7.8 arrayvec/ArrayVec#::from_iterrust-analyzer cargo arrayvec 0.7.8 arrayvec/impl#[`ArrayVec<T, CAP>`][`FromIterator<T>`]from_iter().([1, 2, 3, 4, 5, 6, 7, 8]), |
| 11 | ]) |
| 12 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().( |
| 13 | (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#16).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|len| Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.151 value/Value#Array#((0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#len).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::fromrust-analyzer cargo serde_json 1.0.151 value/from/impl#[Value][`From<i32>`]from().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().())), |
| 14 | ) |
| 15 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 16 | is_array_of_u64rust-analyzer cargo schemars 1.2.2 arrayvec/is_array_of_u64()., |
| 17 | "FIXME schema allows out-of-range positive integers", |
| 18 | )); |
| 19 | } |
| 20 | |
| 21 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 22 | fn arrayvec07_arraystringrust-analyzer cargo schemars 1.2.2 arrayvec/arrayvec07_arraystring().() { |
| 23 | testrust-analyzer cargo schemars 1.2.2 test!!(ArrayStringrust-analyzer cargo arrayvec 0.7.8 array_string/ArrayString#<8>) |
| 24 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>() |
| 25 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(["".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), "12345678".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()]) |
| 26 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 27 | Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::is_stringrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]is_string()., |
| 28 | "There's not a good way to express UTF-8 byte length in JSON schema, so schema ignores the ArrayString's capacity.", |
| 29 | )); |
| 30 | } |
| 31 | |
| 32 | fn is_array_of_u64rust-analyzer cargo schemars 1.2.2 arrayvec/is_array_of_u64().(value: &Valuerust-analyzer cargo serde_json 1.0.151 value/Value#) -> bool { |
| 33 | value |
| 34 | .as_arrayrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]as_array().() |
| 35 | .is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|a| a.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]all().(Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::is_u64rust-analyzer cargo serde_json 1.0.151 value/impl#[Value]is_u64().)) |
| 36 | } |