| 1 | //! The internal `Value` serialization API. |
| 2 | //! |
| 3 | //! This implementation isn't intended to be public. It may need to change |
| 4 | //! for optimizations or to support new external serialization frameworks. |
| 5 | |
| 6 | use crate::{fill::Fill, Error, ValueBag}; |
| 7 | |
| 8 | pub(crate) mod cast; |
| 9 | #[cfg (feature = "error" )] |
| 10 | pub(crate) mod error; |
| 11 | pub(crate) mod fmt; |
| 12 | #[cfg (feature = "seq" )] |
| 13 | pub(crate) mod seq; |
| 14 | #[cfg (feature = "serde1" )] |
| 15 | pub(crate) mod serde; |
| 16 | #[cfg (feature = "sval2" )] |
| 17 | pub(crate) mod sval; |
| 18 | |
| 19 | #[cfg (feature = "owned" )] |
| 20 | pub(crate) mod owned; |
| 21 | |
| 22 | #[cfg (feature = "owned" )] |
| 23 | use crate::std::sync::Arc; |
| 24 | |
| 25 | // NOTE: It takes less space to have separate variants for the presence |
| 26 | // of a `TypeId` instead of using `Option<T>`, because `TypeId` doesn't |
| 27 | // have a niche value |
| 28 | /// A container for a structured value for a specific kind of visitor. |
| 29 | #[derive (Clone)] |
| 30 | pub(crate) enum Internal<'v> { |
| 31 | // Primitive values |
| 32 | Signed(i64), |
| 33 | Unsigned(u64), |
| 34 | #[cfg (not(feature = "inline-i128" ))] |
| 35 | BigSigned(&'v i128), |
| 36 | #[cfg (feature = "inline-i128" )] |
| 37 | BigSigned(i128), |
| 38 | #[cfg (not(feature = "inline-i128" ))] |
| 39 | BigUnsigned(&'v u128), |
| 40 | #[cfg (feature = "inline-i128" )] |
| 41 | BigUnsigned(u128), |
| 42 | Float(f64), |
| 43 | Bool(bool), |
| 44 | Char(char), |
| 45 | Str(&'v str), |
| 46 | None, |
| 47 | |
| 48 | // Captured values |
| 49 | Fill(&'v dyn Fill), |
| 50 | Debug(&'v dyn fmt::DowncastDebug), |
| 51 | Display(&'v dyn fmt::DowncastDisplay), |
| 52 | #[cfg (feature = "error" )] |
| 53 | Error(&'v dyn error::DowncastError), |
| 54 | #[cfg (feature = "sval2" )] |
| 55 | Sval2(&'v dyn sval::v2::DowncastValue), |
| 56 | #[cfg (feature = "serde1" )] |
| 57 | Serde1(&'v dyn serde::v1::DowncastSerialize), |
| 58 | |
| 59 | // Anonymous values |
| 60 | AnonDebug(&'v dyn fmt::Debug), |
| 61 | AnonDisplay(&'v dyn fmt::Display), |
| 62 | #[cfg (feature = "error" )] |
| 63 | AnonError(&'v (dyn error::Error + 'static)), |
| 64 | #[cfg (feature = "sval2" )] |
| 65 | AnonSval2(&'v dyn sval::v2::Value), |
| 66 | #[cfg (feature = "serde1" )] |
| 67 | AnonSerde1(&'v dyn serde::v1::Serialize), |
| 68 | #[cfg (feature = "seq" )] |
| 69 | AnonSeq(&'v dyn seq::Seq), |
| 70 | |
| 71 | // Shared values |
| 72 | #[cfg (feature = "owned" )] |
| 73 | SharedDebug(Arc<dyn fmt::DowncastDebug + Send + Sync>), |
| 74 | #[cfg (feature = "owned" )] |
| 75 | SharedDisplay(Arc<dyn fmt::DowncastDisplay + Send + Sync>), |
| 76 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 77 | SharedError(Arc<dyn error::DowncastError + Send + Sync>), |
| 78 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 79 | SharedSerde1(Arc<dyn serde::v1::DowncastSerialize + Send + Sync>), |
| 80 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 81 | SharedSval2(Arc<dyn sval::v2::DowncastValue + Send + Sync>), |
| 82 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 83 | SharedSeq(Arc<dyn seq::DowncastSeq + Send + Sync>), |
| 84 | |
| 85 | // NOTE: These variants exist because we can't clone an `Arc` in `const` fns |
| 86 | // (plus we may not want to anyways) |
| 87 | #[cfg (feature = "owned" )] |
| 88 | SharedRefDebug(&'v Arc<dyn fmt::DowncastDebug + Send + Sync>), |
| 89 | #[cfg (feature = "owned" )] |
| 90 | SharedRefDisplay(&'v Arc<dyn fmt::DowncastDisplay + Send + Sync>), |
| 91 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 92 | SharedRefError(&'v Arc<dyn error::DowncastError + Send + Sync>), |
| 93 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 94 | SharedRefSerde1(&'v Arc<dyn serde::v1::DowncastSerialize + Send + Sync>), |
| 95 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 96 | SharedRefSval2(&'v Arc<dyn sval::v2::DowncastValue + Send + Sync>), |
| 97 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 98 | SharedRefSeq(&'v Arc<dyn seq::DowncastSeq + Send + Sync>), |
| 99 | |
| 100 | // Poisoned value |
| 101 | #[cfg_attr (not(feature = "owned" ), allow(dead_code))] |
| 102 | Poisoned(&'static str), |
| 103 | } |
| 104 | |
| 105 | /// The internal serialization contract. |
| 106 | pub(crate) trait InternalVisitor<'v> { |
| 107 | fn fill(&mut self, v: &dyn Fill) -> Result<(), Error>; |
| 108 | |
| 109 | fn debug(&mut self, v: &dyn fmt::Debug) -> Result<(), Error>; |
| 110 | fn borrowed_debug(&mut self, v: &'v dyn fmt::Debug) -> Result<(), Error> { |
| 111 | self.debug(v) |
| 112 | } |
| 113 | #[cfg (feature = "owned" )] |
| 114 | fn shared_debug(&mut self, v: &Arc<dyn fmt::DowncastDebug + Send + Sync>) -> Result<(), Error> { |
| 115 | self.debug(v) |
| 116 | } |
| 117 | fn display(&mut self, v: &dyn fmt::Display) -> Result<(), Error>; |
| 118 | fn borrowed_display(&mut self, v: &'v dyn fmt::Display) -> Result<(), Error> { |
| 119 | self.display(v) |
| 120 | } |
| 121 | #[cfg (feature = "owned" )] |
| 122 | fn shared_display( |
| 123 | &mut self, |
| 124 | v: &Arc<dyn fmt::DowncastDisplay + Send + Sync>, |
| 125 | ) -> Result<(), Error> { |
| 126 | self.display(v) |
| 127 | } |
| 128 | |
| 129 | fn u64(&mut self, v: u64) -> Result<(), Error>; |
| 130 | fn i64(&mut self, v: i64) -> Result<(), Error>; |
| 131 | fn u128(&mut self, v: &u128) -> Result<(), Error>; |
| 132 | #[cfg (not(feature = "inline-i128" ))] |
| 133 | fn borrowed_u128(&mut self, v: &'v u128) -> Result<(), Error> { |
| 134 | self.u128(v) |
| 135 | } |
| 136 | fn i128(&mut self, v: &i128) -> Result<(), Error>; |
| 137 | #[cfg (not(feature = "inline-i128" ))] |
| 138 | fn borrowed_i128(&mut self, v: &'v i128) -> Result<(), Error> { |
| 139 | self.i128(v) |
| 140 | } |
| 141 | fn f64(&mut self, v: f64) -> Result<(), Error>; |
| 142 | fn bool(&mut self, v: bool) -> Result<(), Error>; |
| 143 | fn char(&mut self, v: char) -> Result<(), Error>; |
| 144 | |
| 145 | fn str(&mut self, v: &str) -> Result<(), Error>; |
| 146 | fn borrowed_str(&mut self, v: &'v str) -> Result<(), Error> { |
| 147 | self.str(v) |
| 148 | } |
| 149 | |
| 150 | fn none(&mut self) -> Result<(), Error>; |
| 151 | |
| 152 | #[cfg (feature = "error" )] |
| 153 | fn error(&mut self, v: &(dyn error::Error + 'static)) -> Result<(), Error>; |
| 154 | #[cfg (feature = "error" )] |
| 155 | fn borrowed_error(&mut self, v: &'v (dyn error::Error + 'static)) -> Result<(), Error> { |
| 156 | self.error(v) |
| 157 | } |
| 158 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 159 | fn shared_error( |
| 160 | &mut self, |
| 161 | v: &Arc<dyn error::DowncastError + Send + Sync>, |
| 162 | ) -> Result<(), Error> { |
| 163 | self.error(v.as_super()) |
| 164 | } |
| 165 | |
| 166 | #[cfg (feature = "sval2" )] |
| 167 | fn sval2(&mut self, v: &dyn sval::v2::Value) -> Result<(), Error>; |
| 168 | #[cfg (feature = "sval2" )] |
| 169 | fn borrowed_sval2(&mut self, v: &'v dyn sval::v2::Value) -> Result<(), Error> { |
| 170 | self.sval2(v) |
| 171 | } |
| 172 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 173 | fn shared_sval2( |
| 174 | &mut self, |
| 175 | v: &Arc<dyn sval::v2::DowncastValue + Send + Sync>, |
| 176 | ) -> Result<(), Error> { |
| 177 | self.sval2(v.as_super()) |
| 178 | } |
| 179 | |
| 180 | #[cfg (feature = "serde1" )] |
| 181 | fn serde1(&mut self, v: &dyn serde::v1::Serialize) -> Result<(), Error>; |
| 182 | #[cfg (feature = "serde1" )] |
| 183 | fn borrowed_serde1(&mut self, v: &'v dyn serde::v1::Serialize) -> Result<(), Error> { |
| 184 | self.serde1(v) |
| 185 | } |
| 186 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 187 | fn shared_serde1( |
| 188 | &mut self, |
| 189 | v: &Arc<dyn serde::v1::DowncastSerialize + Send + Sync>, |
| 190 | ) -> Result<(), Error> { |
| 191 | self.serde1(v.as_super()) |
| 192 | } |
| 193 | |
| 194 | #[cfg (feature = "seq" )] |
| 195 | fn seq(&mut self, v: &dyn seq::Seq) -> Result<(), Error>; |
| 196 | |
| 197 | #[cfg (feature = "seq" )] |
| 198 | fn borrowed_seq(&mut self, v: &'v dyn seq::Seq) -> Result<(), Error> { |
| 199 | self.seq(v) |
| 200 | } |
| 201 | |
| 202 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 203 | fn shared_seq(&mut self, v: &Arc<dyn seq::DowncastSeq + Send + Sync>) -> Result<(), Error> { |
| 204 | self.seq(v.as_super()) |
| 205 | } |
| 206 | |
| 207 | fn poisoned(&mut self, msg: &'static str) -> Result<(), Error>; |
| 208 | } |
| 209 | |
| 210 | impl<'a, 'v, V: InternalVisitor<'v> + ?Sized> InternalVisitor<'v> for &'a mut V { |
| 211 | fn fill(&mut self, v: &dyn Fill) -> Result<(), Error> { |
| 212 | (**self).fill(v) |
| 213 | } |
| 214 | |
| 215 | fn debug(&mut self, v: &dyn fmt::Debug) -> Result<(), Error> { |
| 216 | (**self).debug(v) |
| 217 | } |
| 218 | |
| 219 | fn borrowed_debug(&mut self, v: &'v dyn fmt::Debug) -> Result<(), Error> { |
| 220 | (**self).borrowed_debug(v) |
| 221 | } |
| 222 | |
| 223 | #[cfg (feature = "owned" )] |
| 224 | fn shared_debug(&mut self, v: &Arc<dyn fmt::DowncastDebug + Send + Sync>) -> Result<(), Error> { |
| 225 | (**self).shared_debug(v) |
| 226 | } |
| 227 | |
| 228 | fn display(&mut self, v: &dyn fmt::Display) -> Result<(), Error> { |
| 229 | (**self).display(v) |
| 230 | } |
| 231 | |
| 232 | fn borrowed_display(&mut self, v: &'v dyn fmt::Display) -> Result<(), Error> { |
| 233 | (**self).borrowed_display(v) |
| 234 | } |
| 235 | |
| 236 | #[cfg (feature = "owned" )] |
| 237 | fn shared_display( |
| 238 | &mut self, |
| 239 | v: &Arc<dyn fmt::DowncastDisplay + Send + Sync>, |
| 240 | ) -> Result<(), Error> { |
| 241 | (**self).shared_display(v) |
| 242 | } |
| 243 | |
| 244 | fn u64(&mut self, v: u64) -> Result<(), Error> { |
| 245 | (**self).u64(v) |
| 246 | } |
| 247 | |
| 248 | fn i64(&mut self, v: i64) -> Result<(), Error> { |
| 249 | (**self).i64(v) |
| 250 | } |
| 251 | |
| 252 | fn u128(&mut self, v: &u128) -> Result<(), Error> { |
| 253 | (**self).u128(v) |
| 254 | } |
| 255 | |
| 256 | #[cfg (not(feature = "inline-i128" ))] |
| 257 | fn borrowed_u128(&mut self, v: &'v u128) -> Result<(), Error> { |
| 258 | (**self).borrowed_u128(v) |
| 259 | } |
| 260 | |
| 261 | fn i128(&mut self, v: &i128) -> Result<(), Error> { |
| 262 | (**self).i128(v) |
| 263 | } |
| 264 | |
| 265 | #[cfg (not(feature = "inline-i128" ))] |
| 266 | fn borrowed_i128(&mut self, v: &'v i128) -> Result<(), Error> { |
| 267 | (**self).borrowed_i128(v) |
| 268 | } |
| 269 | |
| 270 | fn f64(&mut self, v: f64) -> Result<(), Error> { |
| 271 | (**self).f64(v) |
| 272 | } |
| 273 | |
| 274 | fn bool(&mut self, v: bool) -> Result<(), Error> { |
| 275 | (**self).bool(v) |
| 276 | } |
| 277 | |
| 278 | fn char(&mut self, v: char) -> Result<(), Error> { |
| 279 | (**self).char(v) |
| 280 | } |
| 281 | |
| 282 | fn str(&mut self, v: &str) -> Result<(), Error> { |
| 283 | (**self).str(v) |
| 284 | } |
| 285 | |
| 286 | fn borrowed_str(&mut self, v: &'v str) -> Result<(), Error> { |
| 287 | (**self).borrowed_str(v) |
| 288 | } |
| 289 | |
| 290 | fn none(&mut self) -> Result<(), Error> { |
| 291 | (**self).none() |
| 292 | } |
| 293 | |
| 294 | #[cfg (feature = "error" )] |
| 295 | fn error(&mut self, v: &(dyn error::Error + 'static)) -> Result<(), Error> { |
| 296 | (**self).error(v) |
| 297 | } |
| 298 | |
| 299 | #[cfg (feature = "error" )] |
| 300 | fn borrowed_error(&mut self, v: &'v (dyn error::Error + 'static)) -> Result<(), Error> { |
| 301 | (**self).borrowed_error(v) |
| 302 | } |
| 303 | |
| 304 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 305 | fn shared_error( |
| 306 | &mut self, |
| 307 | v: &Arc<dyn error::DowncastError + Send + Sync>, |
| 308 | ) -> Result<(), Error> { |
| 309 | (**self).shared_error(v) |
| 310 | } |
| 311 | |
| 312 | #[cfg (feature = "sval2" )] |
| 313 | fn sval2(&mut self, v: &dyn sval::v2::Value) -> Result<(), Error> { |
| 314 | (**self).sval2(v) |
| 315 | } |
| 316 | |
| 317 | #[cfg (feature = "sval2" )] |
| 318 | fn borrowed_sval2(&mut self, v: &'v dyn sval::v2::Value) -> Result<(), Error> { |
| 319 | (**self).borrowed_sval2(v) |
| 320 | } |
| 321 | |
| 322 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 323 | fn shared_sval2( |
| 324 | &mut self, |
| 325 | v: &Arc<dyn sval::v2::DowncastValue + Send + Sync>, |
| 326 | ) -> Result<(), Error> { |
| 327 | (**self).shared_sval2(v) |
| 328 | } |
| 329 | |
| 330 | #[cfg (feature = "serde1" )] |
| 331 | fn serde1(&mut self, v: &dyn serde::v1::Serialize) -> Result<(), Error> { |
| 332 | (**self).serde1(v) |
| 333 | } |
| 334 | |
| 335 | #[cfg (feature = "serde1" )] |
| 336 | fn borrowed_serde1(&mut self, v: &'v dyn serde::v1::Serialize) -> Result<(), Error> { |
| 337 | (**self).borrowed_serde1(v) |
| 338 | } |
| 339 | |
| 340 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 341 | fn shared_serde1( |
| 342 | &mut self, |
| 343 | v: &Arc<dyn serde::v1::DowncastSerialize + Send + Sync>, |
| 344 | ) -> Result<(), Error> { |
| 345 | (**self).shared_serde1(v) |
| 346 | } |
| 347 | |
| 348 | #[cfg (feature = "seq" )] |
| 349 | fn seq(&mut self, seq: &dyn seq::Seq) -> Result<(), Error> { |
| 350 | (**self).seq(seq) |
| 351 | } |
| 352 | |
| 353 | #[cfg (feature = "seq" )] |
| 354 | fn borrowed_seq(&mut self, seq: &'v dyn seq::Seq) -> Result<(), Error> { |
| 355 | (**self).borrowed_seq(seq) |
| 356 | } |
| 357 | |
| 358 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 359 | fn shared_seq(&mut self, seq: &Arc<dyn seq::DowncastSeq + Send + Sync>) -> Result<(), Error> { |
| 360 | (**self).shared_seq(seq) |
| 361 | } |
| 362 | |
| 363 | fn poisoned(&mut self, msg: &'static str) -> Result<(), Error> { |
| 364 | (**self).poisoned(msg) |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | impl<'v> ValueBag<'v> { |
| 369 | /// Visit the value using an internal visitor. |
| 370 | #[inline ] |
| 371 | pub(crate) fn internal_visit(&self, visitor: impl InternalVisitor<'v>) -> Result<(), Error> { |
| 372 | self.inner.internal_visit(visitor) |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | impl<'v> Internal<'v> { |
| 377 | #[inline ] |
| 378 | pub(crate) const fn by_ref(&self) -> Internal<'_> { |
| 379 | match self { |
| 380 | Internal::Signed(value) => Internal::Signed(*value), |
| 381 | Internal::Unsigned(value) => Internal::Unsigned(*value), |
| 382 | Internal::BigSigned(value) => Internal::BigSigned(*value), |
| 383 | Internal::BigUnsigned(value) => Internal::BigUnsigned(*value), |
| 384 | Internal::Float(value) => Internal::Float(*value), |
| 385 | Internal::Bool(value) => Internal::Bool(*value), |
| 386 | Internal::Char(value) => Internal::Char(*value), |
| 387 | Internal::Str(value) => Internal::Str(value), |
| 388 | Internal::None => Internal::None, |
| 389 | |
| 390 | Internal::Fill(value) => Internal::Fill(*value), |
| 391 | |
| 392 | Internal::AnonDebug(value) => Internal::AnonDebug(*value), |
| 393 | Internal::Debug(value) => Internal::Debug(*value), |
| 394 | |
| 395 | Internal::AnonDisplay(value) => Internal::AnonDisplay(*value), |
| 396 | Internal::Display(value) => Internal::Display(*value), |
| 397 | |
| 398 | #[cfg (feature = "error" )] |
| 399 | Internal::AnonError(value) => Internal::AnonError(*value), |
| 400 | #[cfg (feature = "error" )] |
| 401 | Internal::Error(value) => Internal::Error(*value), |
| 402 | |
| 403 | #[cfg (feature = "sval2" )] |
| 404 | Internal::AnonSval2(value) => Internal::AnonSval2(*value), |
| 405 | #[cfg (feature = "sval2" )] |
| 406 | Internal::Sval2(value) => Internal::Sval2(*value), |
| 407 | |
| 408 | #[cfg (feature = "serde1" )] |
| 409 | Internal::AnonSerde1(value) => Internal::AnonSerde1(*value), |
| 410 | #[cfg (feature = "serde1" )] |
| 411 | Internal::Serde1(value) => Internal::Serde1(*value), |
| 412 | |
| 413 | #[cfg (feature = "seq" )] |
| 414 | Internal::AnonSeq(value) => Internal::AnonSeq(*value), |
| 415 | |
| 416 | #[cfg (feature = "owned" )] |
| 417 | Internal::SharedDebug(ref value) => Internal::SharedRefDebug(value), |
| 418 | #[cfg (feature = "owned" )] |
| 419 | Internal::SharedDisplay(ref value) => Internal::SharedRefDisplay(value), |
| 420 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 421 | Internal::SharedError(ref value) => Internal::SharedRefError(value), |
| 422 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 423 | Internal::SharedSerde1(ref value) => Internal::SharedRefSerde1(value), |
| 424 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 425 | Internal::SharedSval2(ref value) => Internal::SharedRefSval2(value), |
| 426 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 427 | Internal::SharedSeq(ref value) => Internal::SharedRefSeq(value), |
| 428 | |
| 429 | #[cfg (feature = "owned" )] |
| 430 | Internal::SharedRefDebug(value) => Internal::SharedRefDebug(*value), |
| 431 | #[cfg (feature = "owned" )] |
| 432 | Internal::SharedRefDisplay(value) => Internal::SharedRefDisplay(*value), |
| 433 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 434 | Internal::SharedRefError(value) => Internal::SharedRefError(*value), |
| 435 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 436 | Internal::SharedRefSerde1(value) => Internal::SharedRefSerde1(*value), |
| 437 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 438 | Internal::SharedRefSval2(value) => Internal::SharedRefSval2(*value), |
| 439 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 440 | Internal::SharedRefSeq(value) => Internal::SharedRefSeq(*value), |
| 441 | |
| 442 | Internal::Poisoned(msg) => Internal::Poisoned(msg), |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | #[inline ] |
| 447 | pub(crate) fn internal_visit( |
| 448 | &self, |
| 449 | mut visitor: impl InternalVisitor<'v>, |
| 450 | ) -> Result<(), Error> { |
| 451 | match self { |
| 452 | Internal::Signed(value) => visitor.i64(*value), |
| 453 | Internal::Unsigned(value) => visitor.u64(*value), |
| 454 | #[cfg (feature = "inline-i128" )] |
| 455 | Internal::BigSigned(value) => visitor.i128(value), |
| 456 | #[cfg (feature = "inline-i128" )] |
| 457 | Internal::BigUnsigned(value) => visitor.u128(value), |
| 458 | #[cfg (not(feature = "inline-i128" ))] |
| 459 | Internal::BigSigned(value) => visitor.borrowed_i128(value), |
| 460 | #[cfg (not(feature = "inline-i128" ))] |
| 461 | Internal::BigUnsigned(value) => visitor.borrowed_u128(value), |
| 462 | Internal::Float(value) => visitor.f64(*value), |
| 463 | Internal::Bool(value) => visitor.bool(*value), |
| 464 | Internal::Char(value) => visitor.char(*value), |
| 465 | Internal::Str(value) => visitor.borrowed_str(value), |
| 466 | Internal::None => visitor.none(), |
| 467 | |
| 468 | Internal::Fill(value) => visitor.fill(*value), |
| 469 | |
| 470 | Internal::AnonDebug(value) => visitor.borrowed_debug(*value), |
| 471 | Internal::Debug(value) => visitor.borrowed_debug(value.as_super()), |
| 472 | |
| 473 | Internal::AnonDisplay(value) => visitor.borrowed_display(*value), |
| 474 | Internal::Display(value) => visitor.borrowed_display(value.as_super()), |
| 475 | |
| 476 | #[cfg (feature = "error" )] |
| 477 | Internal::AnonError(value) => visitor.borrowed_error(*value), |
| 478 | #[cfg (feature = "error" )] |
| 479 | Internal::Error(value) => visitor.borrowed_error(value.as_super()), |
| 480 | |
| 481 | #[cfg (feature = "sval2" )] |
| 482 | Internal::AnonSval2(value) => visitor.borrowed_sval2(*value), |
| 483 | #[cfg (feature = "sval2" )] |
| 484 | Internal::Sval2(value) => visitor.borrowed_sval2(value.as_super()), |
| 485 | |
| 486 | #[cfg (feature = "serde1" )] |
| 487 | Internal::AnonSerde1(value) => visitor.borrowed_serde1(*value), |
| 488 | #[cfg (feature = "serde1" )] |
| 489 | Internal::Serde1(value) => visitor.borrowed_serde1(value.as_super()), |
| 490 | |
| 491 | #[cfg (feature = "seq" )] |
| 492 | Internal::AnonSeq(value) => visitor.borrowed_seq(*value), |
| 493 | |
| 494 | #[cfg (feature = "owned" )] |
| 495 | Internal::SharedDebug(ref value) => visitor.shared_debug(value), |
| 496 | #[cfg (feature = "owned" )] |
| 497 | Internal::SharedDisplay(ref value) => visitor.shared_display(value), |
| 498 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 499 | Internal::SharedError(ref value) => visitor.shared_error(value), |
| 500 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 501 | Internal::SharedSerde1(ref value) => visitor.shared_serde1(value), |
| 502 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 503 | Internal::SharedSval2(ref value) => visitor.shared_sval2(value), |
| 504 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 505 | Internal::SharedSeq(value) => visitor.shared_seq(value), |
| 506 | |
| 507 | #[cfg (feature = "owned" )] |
| 508 | Internal::SharedRefDebug(value) => visitor.shared_debug(value), |
| 509 | #[cfg (feature = "owned" )] |
| 510 | Internal::SharedRefDisplay(value) => visitor.shared_display(value), |
| 511 | #[cfg (all(feature = "error" , feature = "owned" ))] |
| 512 | Internal::SharedRefError(value) => visitor.shared_error(value), |
| 513 | #[cfg (all(feature = "serde1" , feature = "owned" ))] |
| 514 | Internal::SharedRefSerde1(value) => visitor.shared_serde1(value), |
| 515 | #[cfg (all(feature = "sval2" , feature = "owned" ))] |
| 516 | Internal::SharedRefSval2(value) => visitor.shared_sval2(value), |
| 517 | #[cfg (all(feature = "seq" , feature = "owned" ))] |
| 518 | Internal::SharedRefSeq(value) => visitor.shared_seq(value), |
| 519 | |
| 520 | Internal::Poisoned(msg) => visitor.poisoned(msg), |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | |