| 1 | //! Value module. |
| 2 | |
| 3 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, boxedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/::Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#, formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!, stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#}; |
| 4 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq#, hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#}; |
| 5 | |
| 6 | use serderust-analyzer cargo serde 1.0.228 crate/::{ |
| 7 | derust-analyzer cargo serde_core 1.0.228 de/::{DeserializeOwnedrust-analyzer cargo serde_core 1.0.228 de/DeserializeOwned#, DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#, Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#, MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#, SeqAccessrust-analyzer cargo serde_core 1.0.228 de/SeqAccess#, Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#}, |
| 8 | forward_to_deserialize_anyrust-analyzer cargo serde_core 1.0.228 macros/forward_to_deserialize_any!, |
| 9 | }; |
| 10 | |
| 11 | use craterust-analyzer cargo ron 0.12.0 crate/::{derust-analyzer cargo ron 0.12.0 de/::Errorrust-analyzer cargo ron 0.12.0 error/Error#, errorrust-analyzer cargo ron 0.12.0 error/::Resultrust-analyzer cargo ron 0.12.0 error/Result#}; |
| 12 | |
| 13 | mod maprust-analyzer cargo ron 0.12.0 value/map/; |
| 14 | mod numberrust-analyzer cargo ron 0.12.0 value/number/; |
| 15 | pub(craterust-analyzer cargo ron 0.12.0 crate/) mod rawrust-analyzer cargo ron 0.12.0 value/raw/; |
| 16 | |
| 17 | pub use maprust-analyzer cargo ron 0.12.0 value/map/::Maprust-analyzer cargo ron 0.12.0 value/map/Map#; |
| 18 | pub use numberrust-analyzer cargo ron 0.12.0 value/number/::{Numberrust-analyzer cargo ron 0.12.0 value/number/Number#, F32rust-analyzer cargo ron 0.12.0 value/number/F32#, F64rust-analyzer cargo ron 0.12.0 value/number/F64#}; |
| 19 | #[allow(clippy::useless_attribute, clippy::module_name_repetitions)] |
| 20 | pub use rawrust-analyzer cargo ron 0.12.0 value/raw/::RawValuerust-analyzer cargo ron 0.12.0 value/raw/RawValue#; |
| 21 | |
| 22 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:)] |
| 23 | pub enum Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 24 | Boolrust-analyzer cargo ron 0.12.0 value/Value#Bool#(bool), |
| 25 | Charrust-analyzer cargo ron 0.12.0 value/Value#Char#(char), |
| 26 | Maprust-analyzer cargo ron 0.12.0 value/Value#Map#(Maprust-analyzer cargo ron 0.12.0 value/map/Map#), |
| 27 | Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#), |
| 28 | Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>>), |
| 29 | Stringrust-analyzer cargo ron 0.12.0 value/Value#String#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 30 | Bytesrust-analyzer cargo ron 0.12.0 value/Value#Bytes#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>), |
| 31 | Seqrust-analyzer cargo ron 0.12.0 value/Value#Seq#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>), |
| 32 | Unitrust-analyzer cargo ron 0.12.0 value/Value#Unit#, |
| 33 | } |
| 34 | |
| 35 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<bool> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 36 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<bool>`]from().(value: bool) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<bool>`] { |
| 37 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<bool>`]::Boolrust-analyzer cargo ron 0.12.0 value/Value#Bool#(value) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<char> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 42 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<char>`]from().(value: char) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<char>`] { |
| 43 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<char>`]::Charrust-analyzer cargo ron 0.12.0 value/Value#Char#(value) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | impl<K: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>, V: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>> FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<(K, V)> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 48 | fn from_iterrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<(K, V)>`]from_iter().<T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (K, V)>>(iter: T) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<(K, V)>`] { |
| 49 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<(K, V)>`]::Maprust-analyzer cargo ron 0.12.0 value/Value#Map#(iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Maprust-analyzer cargo ron 0.12.0 value/map/Map#> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 54 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Map>`]from().(value: Maprust-analyzer cargo ron 0.12.0 value/map/Map#) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Map>`] { |
| 55 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Map>`]::Maprust-analyzer cargo ron 0.12.0 value/Value#Map#(value) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | impl<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Numberrust-analyzer cargo ron 0.12.0 value/number/Number#>> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<T> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 60 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(value: T) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`] { |
| 61 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | impl<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T>> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 66 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Option<T>>`]from().(value: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T>) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Option<T>>`] { |
| 67 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Option<T>>`]::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(value.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().)) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | impl<'a> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'a str> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 72 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().(value: &'a str) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`] { |
| 73 | Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(value).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | impl<'a> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str>> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 78 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Cow<'a, str>>`]from().(value: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str>) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Cow<'a, str>>`] { |
| 79 | Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<Cow<'a, str>>`]from().(value).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 84 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<String>`]from().(value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<String>`] { |
| 85 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<String>`]::Stringrust-analyzer cargo ron 0.12.0 value/Value#String#(value) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /// Special case to allow `Value::from(b"byte string")` |
| 90 | impl<const N: usize> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'static [u8; N]> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 91 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'static [u8; N]>`]from().(value: &'static [u8; N]) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'static [u8; N]>`] { |
| 92 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'static [u8; N]>`]::Bytesrust-analyzer cargo ron 0.12.0 value/Value#Bytes#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][`From<[T; N]>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value)) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | impl<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>> FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<T> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 97 | fn from_iterrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<T>`]from_iter().<I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = T>>(iter: I) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<T>`] { |
| 98 | Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<T>`]::Seqrust-analyzer cargo ron 0.12.0 value/Value#Seq#(iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | impl<'a, T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'a [T]> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 103 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a [T]>`]from().(value: &'a [T]) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a [T]>`] { |
| 104 | value.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#::clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | impl<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 109 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Vec<T>>`]from().(value: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Vec<T>>`] { |
| 110 | value.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<()> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 115 | fn fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<()>`]from().(_value: ()) -> Selfrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<()>`] { |
| 116 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Unitrust-analyzer cargo ron 0.12.0 value/Value#Unit# |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | impl Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 121 | /// Tries to deserialize this [`Value`] into `T`. |
| 122 | pub fn into_rustrust-analyzer cargo ron 0.12.0 value/impl#[Value]into_rust().<T>(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<T> |
| 123 | where |
| 124 | T: DeserializeOwnedrust-analyzer cargo serde_core 1.0.228 de/DeserializeOwned#, |
| 125 | { |
| 126 | T::deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#deserialize().(self) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /// Deserializer implementation for RON [`Value`]. |
| 131 | /// This does not support enums (because [`Value`] does not store them). |
| 132 | impl<'de> Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de> for Valuerust-analyzer cargo ron 0.12.0 value/Value# { |
| 133 | type Errorrust-analyzer cargo ron 0.12.0 value/impl#[Value][`Deserializer<'de>`]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 134 | |
| 135 | forward_to_deserialize_anyrust-analyzer cargo serde_core 1.0.228 macros/forward_to_deserialize_any!! { |
| 136 | bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes |
| 137 | byte_buf option unit unit_struct newtype_struct seq tuple |
| 138 | tuple_struct map struct enum identifier ignored_any |
| 139 | } |
| 140 | |
| 141 | #[cfg(feature = "integer128")] |
| 142 | forward_to_deserialize_anyrust-analyzer cargo serde_core 1.0.228 macros/forward_to_deserialize_any!! { |
| 143 | i128 u128 |
| 144 | } |
| 145 | |
| 146 | fn deserialize_anyrust-analyzer cargo ron 0.12.0 value/impl#[Value][`Deserializer<'de>`]deserialize_any().<V>(self, visitor: V) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 147 | where |
| 148 | V: Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 149 | { |
| 150 | match self { |
| 151 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Boolrust-analyzer cargo ron 0.12.0 value/Value#Bool#(b) => visitor.visit_boolrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_bool().(b), |
| 152 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Charrust-analyzer cargo ron 0.12.0 value/Value#Char#(c) => visitor.visit_charrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_char().(c), |
| 153 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Maprust-analyzer cargo ron 0.12.0 value/Value#Map#(m) => { |
| 154 | let old_len = m.lenrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]len().(); |
| 155 | |
| 156 | let mut items: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Valuerust-analyzer cargo ron 0.12.0 value/Value#, Valuerust-analyzer cargo ron 0.12.0 value/Value#)> = m.into_iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][IntoIterator]into_iter().().collectrust-analyzer cargo indexmap 2.5.0 map/iter/impl#[`IntoIter<K, V>`][Iterator]collect().(); |
| 157 | items.reverserust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]reverse().(); |
| 158 | |
| 159 | let value = visitor.visit_maprust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_map().(MapAccessorrust-analyzer cargo ron 0.12.0 value/MapAccessor# { |
| 160 | itemsrust-analyzer cargo ron 0.12.0 value/MapAccessor#items.: &mut items, |
| 161 | valuerust-analyzer cargo ron 0.12.0 value/MapAccessor#value.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 162 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 163 | |
| 164 | if items.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 165 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value) |
| 166 | } else { |
| 167 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedDifferentLengthrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentLength# { |
| 168 | expectedrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentLength#expected.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("a map of length {}", old_len -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). items.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()), |
| 169 | foundrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentLength#found.: old_len, |
| 170 | }) |
| 171 | } |
| 172 | } |
| 173 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(number) => number.visitrust-analyzer cargo ron 0.12.0 value/number/impl#[Number]visit().(visitor), |
| 174 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(o)) => visitor.visit_somerust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_some().(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().o), |
| 175 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => visitor.visit_nonerust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_none().(), |
| 176 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Stringrust-analyzer cargo ron 0.12.0 value/Value#String#(s) => visitor.visit_stringrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_string().(s), |
| 177 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Bytesrust-analyzer cargo ron 0.12.0 value/Value#Bytes#(b) => visitor.visit_byte_bufrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_byte_buf().(b), |
| 178 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Seqrust-analyzer cargo ron 0.12.0 value/Value#Seq#(mut seq) => { |
| 179 | let old_len = seq.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 180 | |
| 181 | seq.reverserust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]reverse().(); |
| 182 | let value = visitor.visit_seqrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_seq().(SeqAccessorrust-analyzer cargo ron 0.12.0 value/SeqAccessor# { seqrust-analyzer cargo ron 0.12.0 value/SeqAccessor#seq.: &mut seq })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 183 | |
| 184 | if seq.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 185 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value) |
| 186 | } else { |
| 187 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedDifferentLengthrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentLength# { |
| 188 | expectedrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentLength#expected.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("a sequence of length {}", old_len -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). seq.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()), |
| 189 | foundrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentLength#found.: old_len, |
| 190 | }) |
| 191 | } |
| 192 | } |
| 193 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Unitrust-analyzer cargo ron 0.12.0 value/Value#Unit# => visitor.visit_unitrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_unit().(), |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | struct SeqAccessorrust-analyzer cargo ron 0.12.0 value/SeqAccessor#<'a> { |
| 199 | seqrust-analyzer cargo ron 0.12.0 value/SeqAccessor#seq.: &'a mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>, |
| 200 | } |
| 201 | |
| 202 | impl<'a, 'de> SeqAccessrust-analyzer cargo serde_core 1.0.228 de/SeqAccess#<'de> for SeqAccessorrust-analyzer cargo ron 0.12.0 value/SeqAccessor#<'a> { |
| 203 | type Errorrust-analyzer cargo ron 0.12.0 value/impl#[`SeqAccessor<'a>`][`SeqAccess<'de>`]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 204 | |
| 205 | fn next_element_seedrust-analyzer cargo ron 0.12.0 value/impl#[`SeqAccessor<'a>`][`SeqAccess<'de>`]next_element_seed().<T>(&mut self, seed: T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 206 | where |
| 207 | T: DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 208 | { |
| 209 | // The `Vec` is reversed, so we can pop to get the originally first element |
| 210 | self.seqrust-analyzer cargo ron 0.12.0 value/SeqAccessor#seq. |
| 211 | .poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().() |
| 212 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |v| seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(v).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#)) |
| 213 | } |
| 214 | |
| 215 | fn size_hintrust-analyzer cargo ron 0.12.0 value/impl#[`SeqAccessor<'a>`][`SeqAccess<'de>`]size_hint().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> { |
| 216 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.seqrust-analyzer cargo ron 0.12.0 value/SeqAccessor#seq..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()) |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | struct MapAccessorrust-analyzer cargo ron 0.12.0 value/MapAccessor#<'a> { |
| 221 | itemsrust-analyzer cargo ron 0.12.0 value/MapAccessor#items.: &'a mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Valuerust-analyzer cargo ron 0.12.0 value/Value#, Valuerust-analyzer cargo ron 0.12.0 value/Value#)>, |
| 222 | valuerust-analyzer cargo ron 0.12.0 value/MapAccessor#value.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>, |
| 223 | } |
| 224 | |
| 225 | impl<'a, 'de> MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#<'de> for MapAccessorrust-analyzer cargo ron 0.12.0 value/MapAccessor#<'a> { |
| 226 | type Errorrust-analyzer cargo ron 0.12.0 value/impl#[`MapAccessor<'a>`][`MapAccess<'de>`]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 227 | |
| 228 | fn next_key_seedrust-analyzer cargo ron 0.12.0 value/impl#[`MapAccessor<'a>`][`MapAccess<'de>`]next_key_seed().<K>(&mut self, seed: K) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<K::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 229 | where |
| 230 | K: DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 231 | { |
| 232 | // The `Vec` is reversed, so we can pop to get the originally first element |
| 233 | match self.itemsrust-analyzer cargo ron 0.12.0 value/MapAccessor#items..poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().() { |
| 234 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((key, value)) => { |
| 235 | self.valuerust-analyzer cargo ron 0.12.0 value/MapAccessor#value. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value); |
| 236 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(key).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#) |
| 237 | } |
| 238 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | #[allow(clippy::panic)] |
| 243 | fn next_value_seedrust-analyzer cargo ron 0.12.0 value/impl#[`MapAccessor<'a>`][`MapAccess<'de>`]next_value_seed().<V>(&mut self, seed: V) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#> |
| 244 | where |
| 245 | V: DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 246 | { |
| 247 | match self.valuerust-analyzer cargo ron 0.12.0 value/MapAccessor#value..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() { |
| 248 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value) => seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(value), |
| 249 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => panicrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/panic!!("Contract violation: value before key"), |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | fn size_hintrust-analyzer cargo ron 0.12.0 value/impl#[`MapAccessor<'a>`][`MapAccess<'de>`]size_hint().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> { |
| 254 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.itemsrust-analyzer cargo ron 0.12.0 value/MapAccessor#items..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | #[cfg(test)] |
| 259 | mod testsrust-analyzer cargo ron 0.12.0 value/tests/ { |
| 260 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/}; |
| 261 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#; |
| 262 | |
| 263 | use serderust-analyzer cargo serde 1.0.228 crate/::Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#; |
| 264 | |
| 265 | use superrust-analyzer cargo ron 0.12.0 value/::*; |
| 266 | |
| 267 | fn assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().<'de, T>(s: &'de str) |
| 268 | where |
| 269 | T: Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'de> + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#, |
| 270 | { |
| 271 | use craterust-analyzer cargo ron 0.12.0 crate/::derust-analyzer cargo ron 0.12.0 de/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().; |
| 272 | |
| 273 | let direct: T = from_strrust-analyzer cargo ron 0.12.0 de/from_str().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 274 | let value: Valuerust-analyzer cargo ron 0.12.0 value/Value# = from_strrust-analyzer cargo ron 0.12.0 de/from_str().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 275 | let de = T::deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#deserialize().(value.clonerust-analyzer cargo ron 0.12.0 value/impl#[Value][Clone]clone().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 276 | |
| 277 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(direct, de, "Deserialization for {:?} is not the same", s); |
| 278 | |
| 279 | let value_roundtrip = Valuerust-analyzer cargo ron 0.12.0 value/Value#::deserializerust-analyzer cargo ron 0.12.0 de/value/impl#[Value][`Deserialize<'de>`]deserialize().(value.clonerust-analyzer cargo ron 0.12.0 value/impl#[Value][Clone]clone().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 280 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(value_roundtrip, value); |
| 281 | } |
| 282 | |
| 283 | fn assert_same_bytesrust-analyzer cargo ron 0.12.0 value/tests/assert_same_bytes().<'de, T>(s: &'de [u8]) |
| 284 | where |
| 285 | T: Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'de> + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#, |
| 286 | { |
| 287 | use craterust-analyzer cargo ron 0.12.0 crate/::derust-analyzer cargo ron 0.12.0 de/::from_bytesrust-analyzer cargo ron 0.12.0 de/from_bytes().; |
| 288 | |
| 289 | let direct: T = from_bytesrust-analyzer cargo ron 0.12.0 de/from_bytes().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 290 | let value: Valuerust-analyzer cargo ron 0.12.0 value/Value# = from_bytesrust-analyzer cargo ron 0.12.0 de/from_bytes().(s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 291 | let de = T::deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#deserialize().(value.clonerust-analyzer cargo ron 0.12.0 value/impl#[Value][Clone]clone().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 292 | |
| 293 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(direct, de, "Deserialization for {:?} is not the same", s); |
| 294 | |
| 295 | let value_roundtrip = Valuerust-analyzer cargo ron 0.12.0 value/Value#::deserializerust-analyzer cargo ron 0.12.0 de/value/impl#[Value][`Deserialize<'de>`]deserialize().(value.clonerust-analyzer cargo ron 0.12.0 value/impl#[Value][Clone]clone().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 296 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(value_roundtrip, value); |
| 297 | } |
| 298 | |
| 299 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 300 | fn booleanrust-analyzer cargo ron 0.12.0 value/tests/boolean().() { |
| 301 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<bool>("true"); |
| 302 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<bool>("false"); |
| 303 | |
| 304 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<bool>`]from().(true), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Boolrust-analyzer cargo ron 0.12.0 value/Value#Bool#(true)); |
| 305 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<bool>`]from().(false), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Boolrust-analyzer cargo ron 0.12.0 value/Value#Bool#(false)); |
| 306 | } |
| 307 | |
| 308 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 309 | fn floatrust-analyzer cargo ron 0.12.0 value/tests/float().() { |
| 310 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<f64>("0.123"); |
| 311 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<f64>("-4.19"); |
| 312 | |
| 313 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 314 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42_f32), |
| 315 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F32rust-analyzer cargo ron 0.12.0 value/number/Number#F32#(42_f32.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 316 | ); |
| 317 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 318 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42_f64), |
| 319 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F64rust-analyzer cargo ron 0.12.0 value/number/Number#F64#(42_f64.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 320 | ); |
| 321 | } |
| 322 | |
| 323 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 324 | fn intrust-analyzer cargo ron 0.12.0 value/tests/int().() { |
| 325 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<u32>("626"); |
| 326 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<i32>("-50"); |
| 327 | |
| 328 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_i8), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I8rust-analyzer cargo ron 0.12.0 value/number/Number#I8#(0))); |
| 329 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_i16), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I16rust-analyzer cargo ron 0.12.0 value/number/Number#I16#(0))); |
| 330 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_i32), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I32rust-analyzer cargo ron 0.12.0 value/number/Number#I32#(0))); |
| 331 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_i64), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I64rust-analyzer cargo ron 0.12.0 value/number/Number#I64#(0))); |
| 332 | #[cfg(feature = "integer128")] |
| 333 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_i128), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I128rust-analyzer cargo ron 0.12.0 value/number/Number#I128#(0))); |
| 334 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_u8), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U8rust-analyzer cargo ron 0.12.0 value/number/Number#U8#(0))); |
| 335 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_u16), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U16rust-analyzer cargo ron 0.12.0 value/number/Number#U16#(0))); |
| 336 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_u32), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U32rust-analyzer cargo ron 0.12.0 value/number/Number#U32#(0))); |
| 337 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_u64), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U64rust-analyzer cargo ron 0.12.0 value/number/Number#U64#(0))); |
| 338 | #[cfg(feature = "integer128")] |
| 339 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(0_u128), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U128rust-analyzer cargo ron 0.12.0 value/number/Number#U128#(0))); |
| 340 | } |
| 341 | |
| 342 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 343 | fn charrust-analyzer cargo ron 0.12.0 value/tests/char().() { |
| 344 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<char>("'4'"); |
| 345 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<char>("'c'"); |
| 346 | |
| 347 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<char>`]from().('🦀'), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Charrust-analyzer cargo ron 0.12.0 value/Value#Char#('🦀')); |
| 348 | } |
| 349 | |
| 350 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 351 | fn stringrust-analyzer cargo ron 0.12.0 value/tests/string().() { |
| 352 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(r#""hello world""#); |
| 353 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(r#""this is a Rusty 🦀 string""#); |
| 354 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(r#""this is now valid UTF-8 \xf0\x9f\xa6\x80""#); |
| 355 | |
| 356 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("slice"), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Stringrust-analyzer cargo ron 0.12.0 value/Value#String#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("slice"))); |
| 357 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 358 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<String>`]from().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("string")), |
| 359 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Stringrust-analyzer cargo ron 0.12.0 value/Value#String#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("string")) |
| 360 | ); |
| 361 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 362 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Cow<'a, str>>`]from().(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#("cow")), |
| 363 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Stringrust-analyzer cargo ron 0.12.0 value/Value#String#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("cow")) |
| 364 | ); |
| 365 | } |
| 366 | |
| 367 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 368 | fn bytesrust-analyzer cargo ron 0.12.0 value/tests/bytes().() { |
| 369 | assert_same_bytesrust-analyzer cargo ron 0.12.0 value/tests/assert_same_bytes().::<serde_bytesrust-analyzer cargo serde_bytes 0.11.16 crate/::ByteBufrust-analyzer cargo serde_bytes 0.11.16 bytebuf/ByteBuf#>(br#"b"hello world""#); |
| 370 | assert_same_bytesrust-analyzer cargo ron 0.12.0 value/tests/assert_same_bytes().::<serde_bytesrust-analyzer cargo serde_bytes 0.11.16 crate/::ByteBufrust-analyzer cargo serde_bytes 0.11.16 bytebuf/ByteBuf#>( |
| 371 | br#"b"this is not valid UTF-8 \xf8\xa1\xa1\xa1\xa1""#, |
| 372 | ); |
| 373 | |
| 374 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'static [u8; N]>`]from().(b"bytes"), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Bytesrust-analyzer cargo ron 0.12.0 value/Value#Bytes#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][`From<[T; N]>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b"bytes"))); |
| 375 | } |
| 376 | |
| 377 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 378 | fn maprust-analyzer cargo ron 0.12.0 value/tests/map().() { |
| 379 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<char, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>( |
| 380 | "{ |
| 381 | 'a': \"Hello\", |
| 382 | 'b': \"Bye\", |
| 383 | }", |
| 384 | ); |
| 385 | |
| 386 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Map>`]from().(Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().()), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Maprust-analyzer cargo ron 0.12.0 value/Value#Map#(Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().())); |
| 387 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 388 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::from_iterrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<(K, V)>`]from_iter().([("a", 42)]), |
| 389 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Maprust-analyzer cargo ron 0.12.0 value/Value#Map#({ |
| 390 | let mut map = Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().(); |
| 391 | map.insertrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]insert().(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a"), Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42)); |
| 392 | map |
| 393 | }) |
| 394 | ); |
| 395 | } |
| 396 | |
| 397 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 398 | fn optionrust-analyzer cargo ron 0.12.0 value/tests/option().() { |
| 399 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char>>("Some('a')"); |
| 400 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char>>("None"); |
| 401 | |
| 402 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Option<T>>`]from().(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#::<bool>::Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)); |
| 403 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 404 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Option<T>>`]from().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)), |
| 405 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(Valuerust-analyzer cargo ron 0.12.0 value/Value#::Boolrust-analyzer cargo ron 0.12.0 value/Value#Bool#(false)))) |
| 406 | ); |
| 407 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 408 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Option<T>>`]from().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#::<bool>::Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)), |
| 409 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(Valuerust-analyzer cargo ron 0.12.0 value/Value#::Optionrust-analyzer cargo ron 0.12.0 value/Value#Option#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)))) |
| 410 | ); |
| 411 | } |
| 412 | |
| 413 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 414 | fn seqrust-analyzer cargo ron 0.12.0 value/tests/seq().() { |
| 415 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<f64>>("[1.0, 2.0, 3.0, 4.0]"); |
| 416 | |
| 417 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 418 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a [T]>`]from().([-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3].as_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]as_slice().()), |
| 419 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Seqrust-analyzer cargo ron 0.12.0 value/Value#Seq#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 420 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8), |
| 421 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(2_i8), |
| 422 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3_i8) |
| 423 | ]) |
| 424 | ); |
| 425 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 426 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<Vec<T>>`]from().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3]), |
| 427 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Seqrust-analyzer cargo ron 0.12.0 value/Value#Seq#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 428 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8), |
| 429 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(2_i8), |
| 430 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3_i8) |
| 431 | ]) |
| 432 | ); |
| 433 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 434 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::from_iterrust-analyzer cargo ron 0.12.0 value/impl#[Value][`FromIterator<T>`]from_iter().([-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8, 2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3]), |
| 435 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::Seqrust-analyzer cargo ron 0.12.0 value/Value#Seq#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 436 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1_i8), |
| 437 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(2_i8), |
| 438 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3_i8) |
| 439 | ]) |
| 440 | ); |
| 441 | } |
| 442 | |
| 443 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 444 | fn unitrust-analyzer cargo ron 0.12.0 value/tests/unit().() { |
| 445 | assert_samerust-analyzer cargo ron 0.12.0 value/tests/assert_same().::<()>("()"); |
| 446 | |
| 447 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<()>`]from().(()), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Unitrust-analyzer cargo ron 0.12.0 value/Value#Unit#); |
| 448 | } |
| 449 | |
| 450 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 451 | #[should_panic(expected = "Contract violation: value before key")] |
| 452 | fn map_access_contract_violationrust-analyzer cargo ron 0.12.0 value/tests/map_access_contract_violation().() { |
| 453 | struct BadVisitorrust-analyzer cargo ron 0.12.0 value/tests/BadVisitor#; |
| 454 | |
| 455 | impl<'de> Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de> for BadVisitorrust-analyzer cargo ron 0.12.0 value/tests/BadVisitor# { |
| 456 | type Valuerust-analyzer cargo ron 0.12.0 value/tests/impl#[BadVisitor][`Visitor<'de>`]Value# = (); |
| 457 | |
| 458 | // GRCOV_EXCL_START |
| 459 | fn expectingrust-analyzer cargo ron 0.12.0 value/tests/impl#[BadVisitor][`Visitor<'de>`]expecting().(&self, fmt: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 460 | fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("a map") |
| 461 | } |
| 462 | // GRCOV_EXCL_STOP |
| 463 | |
| 464 | fn visit_maprust-analyzer cargo ron 0.12.0 value/tests/impl#[BadVisitor][`Visitor<'de>`]visit_map().<A: serderust-analyzer cargo serde 1.0.228 crate/::derust-analyzer cargo serde_core 1.0.228 de/::MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#<'de>>( |
| 465 | self, |
| 466 | mut map: A, |
| 467 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 value/tests/impl#[BadVisitor][`Visitor<'de>`]::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#, A::Errorrust-analyzer cargo serde_core 1.0.228 de/MapAccess#Error#> { |
| 468 | map.next_valuerust-analyzer cargo serde_core 1.0.228 de/MapAccess#next_value().::<()>() |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | let value = Valuerust-analyzer cargo ron 0.12.0 value/Value#::Maprust-analyzer cargo ron 0.12.0 value/Value#Map#([("a", 42)].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()); |
| 473 | let _ = value.deserialize_maprust-analyzer cargo ron 0.12.0 value/impl#[Value][`Deserializer<'de>`]deserialize_map().(BadVisitorrust-analyzer cargo ron 0.12.0 value/tests/BadVisitor#); |
| 474 | } |
| 475 | |
| 476 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 477 | fn transparent_value_newtyperust-analyzer cargo ron 0.12.0 value/tests/transparent_value_newtype().() { |
| 478 | struct NewtypeDeserializerrust-analyzer cargo ron 0.12.0 value/tests/NewtypeDeserializer#; |
| 479 | |
| 480 | impl<'de> Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de> for NewtypeDeserializerrust-analyzer cargo ron 0.12.0 value/tests/NewtypeDeserializer# { |
| 481 | type Errorrust-analyzer cargo ron 0.12.0 value/tests/impl#[NewtypeDeserializer][`Deserializer<'de>`]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 482 | |
| 483 | fn deserialize_anyrust-analyzer cargo ron 0.12.0 value/tests/impl#[NewtypeDeserializer][`Deserializer<'de>`]deserialize_any().<V: Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>>(self, visitor: V) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#, Selfrust-analyzer cargo ron 0.12.0 value/tests/impl#[NewtypeDeserializer][`Deserializer<'de>`]::Errorrust-analyzer cargo serde_core 1.0.228 de/Deserializer#Error#> { |
| 484 | visitor.visit_newtype_structrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_newtype_struct().(serderust-analyzer cargo serde 1.0.228 crate/::derust-analyzer cargo serde_core 1.0.228 de/::valuerust-analyzer cargo serde_core 1.0.228 de/value/::CharDeserializerrust-analyzer cargo serde_core 1.0.228 de/value/CharDeserializer#::newrust-analyzer cargo serde_core 1.0.228 de/value/impl#[`CharDeserializer<E>`]new().('🦀')) |
| 485 | } |
| 486 | |
| 487 | // GRCOV_EXCL_START |
| 488 | forward_to_deserialize_anyrust-analyzer cargo serde_core 1.0.228 macros/forward_to_deserialize_any!! { |
| 489 | bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string |
| 490 | bytes byte_buf option unit unit_struct newtype_struct seq tuple |
| 491 | tuple_struct map struct enum identifier ignored_any |
| 492 | } |
| 493 | |
| 494 | #[cfg(feature = "integer128")] |
| 495 | forward_to_deserialize_anyrust-analyzer cargo serde_core 1.0.228 macros/forward_to_deserialize_any!! { i128 u128 } |
| 496 | // GRCOV_EXCL_STOP |
| 497 | } |
| 498 | |
| 499 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 500 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::deserializerust-analyzer cargo ron 0.12.0 de/value/impl#[Value][`Deserialize<'de>`]deserialize().(NewtypeDeserializerrust-analyzer cargo ron 0.12.0 value/tests/NewtypeDeserializer#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 501 | Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<char>`]from().('🦀') |
| 502 | ); |
| 503 | } |
| 504 | } |