/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sval-2.16.0/src/value.rs
Line | Count | Source |
1 | | use crate::{Index, Label, Result, Stream, Tag}; |
2 | | |
3 | | /** |
4 | | A producer of structured data. |
5 | | |
6 | | Each call to [`Value::stream`] is expected to produce a single complete value. |
7 | | */ |
8 | | pub trait Value { |
9 | | /** |
10 | | Stream this value through a [`Stream`]. |
11 | | */ |
12 | | fn stream<'sval, S: Stream<'sval> + ?Sized>(&'sval self, stream: &mut S) -> Result; |
13 | | |
14 | | /** |
15 | | Get the tag of this value, if there is one. |
16 | | */ |
17 | | #[inline] |
18 | 0 | fn tag(&self) -> Option<Tag> { |
19 | 0 | default_value::tag(self) |
20 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::tag Unexecuted instantiation: <char as sval::value::Value>::tag Unexecuted instantiation: <f64 as sval::value::Value>::tag Unexecuted instantiation: <f32 as sval::value::Value>::tag Unexecuted instantiation: <u8 as sval::value::Value>::tag Unexecuted instantiation: <i32 as sval::value::Value>::tag Unexecuted instantiation: <u32 as sval::value::Value>::tag Unexecuted instantiation: <i128 as sval::value::Value>::tag Unexecuted instantiation: <u128 as sval::value::Value>::tag Unexecuted instantiation: <i16 as sval::value::Value>::tag Unexecuted instantiation: <u16 as sval::value::Value>::tag Unexecuted instantiation: <() as sval::value::Value>::tag Unexecuted instantiation: <i64 as sval::value::Value>::tag Unexecuted instantiation: <u64 as sval::value::Value>::tag Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::tag Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::tag Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::tag Unexecuted instantiation: <core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::tag Unexecuted instantiation: <core::option::Option<()> as sval::value::Value>::tag Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::tag Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::tag Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::tag Unexecuted instantiation: <_ as sval::value::Value>::tag |
21 | | |
22 | | /** |
23 | | Try convert this value into a boolean. |
24 | | */ |
25 | | #[inline] |
26 | 0 | fn to_bool(&self) -> Option<bool> { |
27 | 0 | default_value::to_bool(self) |
28 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_bool Unexecuted instantiation: <char as sval::value::Value>::to_bool Unexecuted instantiation: <f64 as sval::value::Value>::to_bool Unexecuted instantiation: <str as sval::value::Value>::to_bool Unexecuted instantiation: <f32 as sval::value::Value>::to_bool Unexecuted instantiation: <u8 as sval::value::Value>::to_bool Unexecuted instantiation: <i32 as sval::value::Value>::to_bool Unexecuted instantiation: <u32 as sval::value::Value>::to_bool Unexecuted instantiation: <i128 as sval::value::Value>::to_bool Unexecuted instantiation: <u128 as sval::value::Value>::to_bool Unexecuted instantiation: <i16 as sval::value::Value>::to_bool Unexecuted instantiation: <u16 as sval::value::Value>::to_bool Unexecuted instantiation: <() as sval::value::Value>::to_bool Unexecuted instantiation: <i64 as sval::value::Value>::to_bool Unexecuted instantiation: <u64 as sval::value::Value>::to_bool Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_bool Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_bool Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_bool Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_bool Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_bool Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_bool Unexecuted instantiation: <_ as sval::value::Value>::to_bool |
29 | | |
30 | | /** |
31 | | Try convert this value into a 32bit binary floating point number. |
32 | | */ |
33 | | #[inline] |
34 | 0 | fn to_f32(&self) -> Option<f32> { |
35 | 0 | default_value::to_f32(self) |
36 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_f32 Unexecuted instantiation: <bool as sval::value::Value>::to_f32 Unexecuted instantiation: <char as sval::value::Value>::to_f32 Unexecuted instantiation: <f64 as sval::value::Value>::to_f32 Unexecuted instantiation: <str as sval::value::Value>::to_f32 Unexecuted instantiation: <u8 as sval::value::Value>::to_f32 Unexecuted instantiation: <i32 as sval::value::Value>::to_f32 Unexecuted instantiation: <u32 as sval::value::Value>::to_f32 Unexecuted instantiation: <i128 as sval::value::Value>::to_f32 Unexecuted instantiation: <u128 as sval::value::Value>::to_f32 Unexecuted instantiation: <i16 as sval::value::Value>::to_f32 Unexecuted instantiation: <u16 as sval::value::Value>::to_f32 Unexecuted instantiation: <() as sval::value::Value>::to_f32 Unexecuted instantiation: <i64 as sval::value::Value>::to_f32 Unexecuted instantiation: <u64 as sval::value::Value>::to_f32 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_f32 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_f32 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_f32 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_f32 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_f32 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_f32 Unexecuted instantiation: <_ as sval::value::Value>::to_f32 |
37 | | |
38 | | /** |
39 | | Try convert this value into a 64bit binary floating point number. |
40 | | */ |
41 | | #[inline] |
42 | 0 | fn to_f64(&self) -> Option<f64> { |
43 | 0 | default_value::to_f64(self) |
44 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_f64 Unexecuted instantiation: <bool as sval::value::Value>::to_f64 Unexecuted instantiation: <char as sval::value::Value>::to_f64 Unexecuted instantiation: <str as sval::value::Value>::to_f64 Unexecuted instantiation: <f32 as sval::value::Value>::to_f64 Unexecuted instantiation: <u8 as sval::value::Value>::to_f64 Unexecuted instantiation: <i32 as sval::value::Value>::to_f64 Unexecuted instantiation: <u32 as sval::value::Value>::to_f64 Unexecuted instantiation: <i128 as sval::value::Value>::to_f64 Unexecuted instantiation: <u128 as sval::value::Value>::to_f64 Unexecuted instantiation: <i16 as sval::value::Value>::to_f64 Unexecuted instantiation: <u16 as sval::value::Value>::to_f64 Unexecuted instantiation: <() as sval::value::Value>::to_f64 Unexecuted instantiation: <i64 as sval::value::Value>::to_f64 Unexecuted instantiation: <u64 as sval::value::Value>::to_f64 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_f64 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_f64 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_f64 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_f64 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_f64 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_f64 Unexecuted instantiation: <_ as sval::value::Value>::to_f64 |
45 | | |
46 | | /** |
47 | | Try convert this value into a signed 8bit integer. |
48 | | */ |
49 | | #[inline] |
50 | 0 | fn to_i8(&self) -> Option<i8> { |
51 | 0 | default_value::to_i8(self) |
52 | 0 | } Unexecuted instantiation: <bool as sval::value::Value>::to_i8 Unexecuted instantiation: <char as sval::value::Value>::to_i8 Unexecuted instantiation: <f64 as sval::value::Value>::to_i8 Unexecuted instantiation: <str as sval::value::Value>::to_i8 Unexecuted instantiation: <f32 as sval::value::Value>::to_i8 Unexecuted instantiation: <u8 as sval::value::Value>::to_i8 Unexecuted instantiation: <i32 as sval::value::Value>::to_i8 Unexecuted instantiation: <u32 as sval::value::Value>::to_i8 Unexecuted instantiation: <i128 as sval::value::Value>::to_i8 Unexecuted instantiation: <u128 as sval::value::Value>::to_i8 Unexecuted instantiation: <i16 as sval::value::Value>::to_i8 Unexecuted instantiation: <u16 as sval::value::Value>::to_i8 Unexecuted instantiation: <() as sval::value::Value>::to_i8 Unexecuted instantiation: <i64 as sval::value::Value>::to_i8 Unexecuted instantiation: <u64 as sval::value::Value>::to_i8 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i8 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i8 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i8 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_i8 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_i8 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_i8 Unexecuted instantiation: <_ as sval::value::Value>::to_i8 |
53 | | |
54 | | /** |
55 | | Try convert this value into a signed 16bit integer. |
56 | | */ |
57 | | #[inline] |
58 | 0 | fn to_i16(&self) -> Option<i16> { |
59 | 0 | default_value::to_i16(self) |
60 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_i16 Unexecuted instantiation: <bool as sval::value::Value>::to_i16 Unexecuted instantiation: <char as sval::value::Value>::to_i16 Unexecuted instantiation: <f64 as sval::value::Value>::to_i16 Unexecuted instantiation: <str as sval::value::Value>::to_i16 Unexecuted instantiation: <f32 as sval::value::Value>::to_i16 Unexecuted instantiation: <u8 as sval::value::Value>::to_i16 Unexecuted instantiation: <i32 as sval::value::Value>::to_i16 Unexecuted instantiation: <u32 as sval::value::Value>::to_i16 Unexecuted instantiation: <i128 as sval::value::Value>::to_i16 Unexecuted instantiation: <u128 as sval::value::Value>::to_i16 Unexecuted instantiation: <u16 as sval::value::Value>::to_i16 Unexecuted instantiation: <() as sval::value::Value>::to_i16 Unexecuted instantiation: <i64 as sval::value::Value>::to_i16 Unexecuted instantiation: <u64 as sval::value::Value>::to_i16 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i16 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i16 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i16 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_i16 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_i16 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_i16 Unexecuted instantiation: <_ as sval::value::Value>::to_i16 |
61 | | |
62 | | /** |
63 | | Try convert this value into a signed 32bit integer. |
64 | | */ |
65 | | #[inline] |
66 | 0 | fn to_i32(&self) -> Option<i32> { |
67 | 0 | default_value::to_i32(self) |
68 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_i32 Unexecuted instantiation: <bool as sval::value::Value>::to_i32 Unexecuted instantiation: <char as sval::value::Value>::to_i32 Unexecuted instantiation: <f64 as sval::value::Value>::to_i32 Unexecuted instantiation: <str as sval::value::Value>::to_i32 Unexecuted instantiation: <f32 as sval::value::Value>::to_i32 Unexecuted instantiation: <u8 as sval::value::Value>::to_i32 Unexecuted instantiation: <u32 as sval::value::Value>::to_i32 Unexecuted instantiation: <i128 as sval::value::Value>::to_i32 Unexecuted instantiation: <u128 as sval::value::Value>::to_i32 Unexecuted instantiation: <i16 as sval::value::Value>::to_i32 Unexecuted instantiation: <u16 as sval::value::Value>::to_i32 Unexecuted instantiation: <() as sval::value::Value>::to_i32 Unexecuted instantiation: <i64 as sval::value::Value>::to_i32 Unexecuted instantiation: <u64 as sval::value::Value>::to_i32 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i32 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i32 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i32 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_i32 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_i32 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_i32 Unexecuted instantiation: <_ as sval::value::Value>::to_i32 |
69 | | |
70 | | /** |
71 | | Try convert this value into a signed 64bit integer. |
72 | | */ |
73 | | #[inline] |
74 | 0 | fn to_i64(&self) -> Option<i64> { |
75 | 0 | default_value::to_i64(self) |
76 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_i64 Unexecuted instantiation: <bool as sval::value::Value>::to_i64 Unexecuted instantiation: <char as sval::value::Value>::to_i64 Unexecuted instantiation: <f64 as sval::value::Value>::to_i64 Unexecuted instantiation: <str as sval::value::Value>::to_i64 Unexecuted instantiation: <f32 as sval::value::Value>::to_i64 Unexecuted instantiation: <u8 as sval::value::Value>::to_i64 Unexecuted instantiation: <i32 as sval::value::Value>::to_i64 Unexecuted instantiation: <u32 as sval::value::Value>::to_i64 Unexecuted instantiation: <i128 as sval::value::Value>::to_i64 Unexecuted instantiation: <u128 as sval::value::Value>::to_i64 Unexecuted instantiation: <i16 as sval::value::Value>::to_i64 Unexecuted instantiation: <u16 as sval::value::Value>::to_i64 Unexecuted instantiation: <() as sval::value::Value>::to_i64 Unexecuted instantiation: <u64 as sval::value::Value>::to_i64 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i64 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i64 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i64 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_i64 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_i64 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_i64 Unexecuted instantiation: <_ as sval::value::Value>::to_i64 |
77 | | |
78 | | /** |
79 | | Try convert this value into a signed 128bit integer. |
80 | | */ |
81 | | #[inline] |
82 | 0 | fn to_i128(&self) -> Option<i128> { |
83 | 0 | default_value::to_i128(self) |
84 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_i128 Unexecuted instantiation: <bool as sval::value::Value>::to_i128 Unexecuted instantiation: <char as sval::value::Value>::to_i128 Unexecuted instantiation: <f64 as sval::value::Value>::to_i128 Unexecuted instantiation: <str as sval::value::Value>::to_i128 Unexecuted instantiation: <f32 as sval::value::Value>::to_i128 Unexecuted instantiation: <u8 as sval::value::Value>::to_i128 Unexecuted instantiation: <i32 as sval::value::Value>::to_i128 Unexecuted instantiation: <u32 as sval::value::Value>::to_i128 Unexecuted instantiation: <u128 as sval::value::Value>::to_i128 Unexecuted instantiation: <i16 as sval::value::Value>::to_i128 Unexecuted instantiation: <u16 as sval::value::Value>::to_i128 Unexecuted instantiation: <() as sval::value::Value>::to_i128 Unexecuted instantiation: <i64 as sval::value::Value>::to_i128 Unexecuted instantiation: <u64 as sval::value::Value>::to_i128 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i128 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i128 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i128 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_i128 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_i128 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_i128 Unexecuted instantiation: <_ as sval::value::Value>::to_i128 |
85 | | |
86 | | /** |
87 | | Try convert this value into an unsigned 8bit integer. |
88 | | */ |
89 | | #[inline] |
90 | 0 | fn to_u8(&self) -> Option<u8> { |
91 | 0 | default_value::to_u8(self) |
92 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_u8 Unexecuted instantiation: <bool as sval::value::Value>::to_u8 Unexecuted instantiation: <char as sval::value::Value>::to_u8 Unexecuted instantiation: <f64 as sval::value::Value>::to_u8 Unexecuted instantiation: <str as sval::value::Value>::to_u8 Unexecuted instantiation: <f32 as sval::value::Value>::to_u8 Unexecuted instantiation: <i32 as sval::value::Value>::to_u8 Unexecuted instantiation: <u32 as sval::value::Value>::to_u8 Unexecuted instantiation: <i128 as sval::value::Value>::to_u8 Unexecuted instantiation: <u128 as sval::value::Value>::to_u8 Unexecuted instantiation: <i16 as sval::value::Value>::to_u8 Unexecuted instantiation: <u16 as sval::value::Value>::to_u8 Unexecuted instantiation: <() as sval::value::Value>::to_u8 Unexecuted instantiation: <i64 as sval::value::Value>::to_u8 Unexecuted instantiation: <u64 as sval::value::Value>::to_u8 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u8 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u8 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u8 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_u8 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_u8 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_u8 Unexecuted instantiation: <_ as sval::value::Value>::to_u8 |
93 | | |
94 | | /** |
95 | | Try convert this value into an unsigned 16bit integer. |
96 | | */ |
97 | | #[inline] |
98 | 0 | fn to_u16(&self) -> Option<u16> { |
99 | 0 | default_value::to_u16(self) |
100 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_u16 Unexecuted instantiation: <bool as sval::value::Value>::to_u16 Unexecuted instantiation: <char as sval::value::Value>::to_u16 Unexecuted instantiation: <f64 as sval::value::Value>::to_u16 Unexecuted instantiation: <str as sval::value::Value>::to_u16 Unexecuted instantiation: <f32 as sval::value::Value>::to_u16 Unexecuted instantiation: <u8 as sval::value::Value>::to_u16 Unexecuted instantiation: <i32 as sval::value::Value>::to_u16 Unexecuted instantiation: <u32 as sval::value::Value>::to_u16 Unexecuted instantiation: <i128 as sval::value::Value>::to_u16 Unexecuted instantiation: <u128 as sval::value::Value>::to_u16 Unexecuted instantiation: <i16 as sval::value::Value>::to_u16 Unexecuted instantiation: <() as sval::value::Value>::to_u16 Unexecuted instantiation: <i64 as sval::value::Value>::to_u16 Unexecuted instantiation: <u64 as sval::value::Value>::to_u16 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u16 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u16 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u16 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_u16 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_u16 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_u16 Unexecuted instantiation: <_ as sval::value::Value>::to_u16 |
101 | | |
102 | | /** |
103 | | Try convert this value into an unsigned 32bit integer. |
104 | | */ |
105 | | #[inline] |
106 | 0 | fn to_u32(&self) -> Option<u32> { |
107 | 0 | default_value::to_u32(self) |
108 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_u32 Unexecuted instantiation: <bool as sval::value::Value>::to_u32 Unexecuted instantiation: <char as sval::value::Value>::to_u32 Unexecuted instantiation: <f64 as sval::value::Value>::to_u32 Unexecuted instantiation: <str as sval::value::Value>::to_u32 Unexecuted instantiation: <f32 as sval::value::Value>::to_u32 Unexecuted instantiation: <u8 as sval::value::Value>::to_u32 Unexecuted instantiation: <i32 as sval::value::Value>::to_u32 Unexecuted instantiation: <i128 as sval::value::Value>::to_u32 Unexecuted instantiation: <u128 as sval::value::Value>::to_u32 Unexecuted instantiation: <i16 as sval::value::Value>::to_u32 Unexecuted instantiation: <u16 as sval::value::Value>::to_u32 Unexecuted instantiation: <() as sval::value::Value>::to_u32 Unexecuted instantiation: <i64 as sval::value::Value>::to_u32 Unexecuted instantiation: <u64 as sval::value::Value>::to_u32 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u32 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u32 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u32 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_u32 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_u32 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_u32 Unexecuted instantiation: <_ as sval::value::Value>::to_u32 |
109 | | |
110 | | /** |
111 | | Try convert this value into an unsigned 64bit integer. |
112 | | */ |
113 | | #[inline] |
114 | 0 | fn to_u64(&self) -> Option<u64> { |
115 | 0 | default_value::to_u64(self) |
116 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_u64 Unexecuted instantiation: <bool as sval::value::Value>::to_u64 Unexecuted instantiation: <char as sval::value::Value>::to_u64 Unexecuted instantiation: <f64 as sval::value::Value>::to_u64 Unexecuted instantiation: <str as sval::value::Value>::to_u64 Unexecuted instantiation: <f32 as sval::value::Value>::to_u64 Unexecuted instantiation: <u8 as sval::value::Value>::to_u64 Unexecuted instantiation: <i32 as sval::value::Value>::to_u64 Unexecuted instantiation: <u32 as sval::value::Value>::to_u64 Unexecuted instantiation: <i128 as sval::value::Value>::to_u64 Unexecuted instantiation: <u128 as sval::value::Value>::to_u64 Unexecuted instantiation: <i16 as sval::value::Value>::to_u64 Unexecuted instantiation: <u16 as sval::value::Value>::to_u64 Unexecuted instantiation: <() as sval::value::Value>::to_u64 Unexecuted instantiation: <i64 as sval::value::Value>::to_u64 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u64 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u64 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u64 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_u64 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_u64 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_u64 Unexecuted instantiation: <_ as sval::value::Value>::to_u64 |
117 | | |
118 | | /** |
119 | | Try convert this value into an unsigned 128bit integer. |
120 | | */ |
121 | | #[inline] |
122 | 0 | fn to_u128(&self) -> Option<u128> { |
123 | 0 | default_value::to_u128(self) |
124 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_u128 Unexecuted instantiation: <bool as sval::value::Value>::to_u128 Unexecuted instantiation: <char as sval::value::Value>::to_u128 Unexecuted instantiation: <f64 as sval::value::Value>::to_u128 Unexecuted instantiation: <str as sval::value::Value>::to_u128 Unexecuted instantiation: <f32 as sval::value::Value>::to_u128 Unexecuted instantiation: <u8 as sval::value::Value>::to_u128 Unexecuted instantiation: <i32 as sval::value::Value>::to_u128 Unexecuted instantiation: <u32 as sval::value::Value>::to_u128 Unexecuted instantiation: <i128 as sval::value::Value>::to_u128 Unexecuted instantiation: <i16 as sval::value::Value>::to_u128 Unexecuted instantiation: <u16 as sval::value::Value>::to_u128 Unexecuted instantiation: <() as sval::value::Value>::to_u128 Unexecuted instantiation: <i64 as sval::value::Value>::to_u128 Unexecuted instantiation: <u64 as sval::value::Value>::to_u128 Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u128 Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u128 Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u128 Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_u128 Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_u128 Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_u128 Unexecuted instantiation: <_ as sval::value::Value>::to_u128 |
125 | | |
126 | | /** |
127 | | Try convert this value into a text string. |
128 | | */ |
129 | | #[inline] |
130 | 0 | fn to_text(&self) -> Option<&str> { |
131 | 0 | default_value::to_text(self) |
132 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_text Unexecuted instantiation: <bool as sval::value::Value>::to_text Unexecuted instantiation: <char as sval::value::Value>::to_text Unexecuted instantiation: <f64 as sval::value::Value>::to_text Unexecuted instantiation: <f32 as sval::value::Value>::to_text Unexecuted instantiation: <u8 as sval::value::Value>::to_text Unexecuted instantiation: <i32 as sval::value::Value>::to_text Unexecuted instantiation: <u32 as sval::value::Value>::to_text Unexecuted instantiation: <i128 as sval::value::Value>::to_text Unexecuted instantiation: <u128 as sval::value::Value>::to_text Unexecuted instantiation: <i16 as sval::value::Value>::to_text Unexecuted instantiation: <u16 as sval::value::Value>::to_text Unexecuted instantiation: <() as sval::value::Value>::to_text Unexecuted instantiation: <i64 as sval::value::Value>::to_text Unexecuted instantiation: <u64 as sval::value::Value>::to_text Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_text Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_text Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_text Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_text Unexecuted instantiation: <sval::data::binary::BinarySlice as sval::value::Value>::to_text Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_text Unexecuted instantiation: <_ as sval::value::Value>::to_text |
133 | | |
134 | | /** |
135 | | Try convert this value into a bitstring. |
136 | | */ |
137 | | #[inline] |
138 | 0 | fn to_binary(&self) -> Option<&[u8]> { |
139 | 0 | default_value::to_binary(self) |
140 | 0 | } Unexecuted instantiation: <i8 as sval::value::Value>::to_binary Unexecuted instantiation: <bool as sval::value::Value>::to_binary Unexecuted instantiation: <char as sval::value::Value>::to_binary Unexecuted instantiation: <f64 as sval::value::Value>::to_binary Unexecuted instantiation: <str as sval::value::Value>::to_binary Unexecuted instantiation: <f32 as sval::value::Value>::to_binary Unexecuted instantiation: <u8 as sval::value::Value>::to_binary Unexecuted instantiation: <i32 as sval::value::Value>::to_binary Unexecuted instantiation: <u32 as sval::value::Value>::to_binary Unexecuted instantiation: <i128 as sval::value::Value>::to_binary Unexecuted instantiation: <u128 as sval::value::Value>::to_binary Unexecuted instantiation: <i16 as sval::value::Value>::to_binary Unexecuted instantiation: <u16 as sval::value::Value>::to_binary Unexecuted instantiation: <() as sval::value::Value>::to_binary Unexecuted instantiation: <i64 as sval::value::Value>::to_binary Unexecuted instantiation: <u64 as sval::value::Value>::to_binary Unexecuted instantiation: <sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_binary Unexecuted instantiation: <sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_binary Unexecuted instantiation: <sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_binary Unexecuted instantiation: <log::kv::value::Value as sval::value::Value>::to_binary Unexecuted instantiation: <sval_buffer::value::Value as sval::value::Value>::to_binary Unexecuted instantiation: <_ as sval::value::Value>::to_binary |
141 | | } |
142 | | |
143 | | macro_rules! impl_value_forward { |
144 | | ({ $($r:tt)* } => $bind:ident => { $($forward:tt)* }) => { |
145 | | $($r)* { |
146 | 0 | fn stream<'sval, S: Stream<'sval> + ?Sized>(&'sval self, stream: &mut S) -> Result { |
147 | 0 | let $bind = self; |
148 | 0 | ($($forward)*).stream(stream) |
149 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&&str as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&i8 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&bool as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&char as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&f64 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&str as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::tag::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_f32::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_f64::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_bool::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_i128::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_text::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_u128::Extract>> Unexecuted instantiation: <&str as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_binary::Extract>> Unexecuted instantiation: <&f32 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&u8 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&i32 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&u32 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&i128 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&u128 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&i16 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&u16 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&() as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&i64 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&u64 as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::tag::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_f32::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_f64::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_bool::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_i128::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_text::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_u128::Extract>> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<sval::stream::Computed<sval::value::default_value::to_binary::Extract>> Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::stream::<dyn sval_dynamic::stream::Stream> Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::stream::<sval::stream::Computed<sval_buffer::value::ValueBuf>> Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::stream::<sval::stream::Computed<value_bag::internal::sval::v2::VisitorStream>> Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::stream::<sval_fmt::writer::Writer<&mut core::fmt::Formatter>> Unexecuted instantiation: <&_ as sval::value::Value>::stream::<_> Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::stream::<_> |
150 | | |
151 | | #[inline] |
152 | 0 | fn tag(&self) -> Option<Tag> { |
153 | 0 | let $bind = self; |
154 | 0 | ($($forward)*).tag() |
155 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::tag Unexecuted instantiation: <&&str as sval::value::Value>::tag Unexecuted instantiation: <&i8 as sval::value::Value>::tag Unexecuted instantiation: <&bool as sval::value::Value>::tag Unexecuted instantiation: <&char as sval::value::Value>::tag Unexecuted instantiation: <&f64 as sval::value::Value>::tag Unexecuted instantiation: <&str as sval::value::Value>::tag Unexecuted instantiation: <&f32 as sval::value::Value>::tag Unexecuted instantiation: <&u8 as sval::value::Value>::tag Unexecuted instantiation: <&i32 as sval::value::Value>::tag Unexecuted instantiation: <&u32 as sval::value::Value>::tag Unexecuted instantiation: <&i128 as sval::value::Value>::tag Unexecuted instantiation: <&u128 as sval::value::Value>::tag Unexecuted instantiation: <&i16 as sval::value::Value>::tag Unexecuted instantiation: <&u16 as sval::value::Value>::tag Unexecuted instantiation: <&() as sval::value::Value>::tag Unexecuted instantiation: <&i64 as sval::value::Value>::tag Unexecuted instantiation: <&u64 as sval::value::Value>::tag Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::tag Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::tag Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::tag Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::tag Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::tag Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::tag Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::tag Unexecuted instantiation: <&_ as sval::value::Value>::tag Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::tag |
156 | | |
157 | | #[inline] |
158 | 0 | fn to_bool(&self) -> Option<bool> { |
159 | 0 | let $bind = self; |
160 | 0 | ($($forward)*).to_bool() |
161 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_bool Unexecuted instantiation: <&&str as sval::value::Value>::to_bool Unexecuted instantiation: <&i8 as sval::value::Value>::to_bool Unexecuted instantiation: <&bool as sval::value::Value>::to_bool Unexecuted instantiation: <&char as sval::value::Value>::to_bool Unexecuted instantiation: <&f64 as sval::value::Value>::to_bool Unexecuted instantiation: <&str as sval::value::Value>::to_bool Unexecuted instantiation: <&f32 as sval::value::Value>::to_bool Unexecuted instantiation: <&u8 as sval::value::Value>::to_bool Unexecuted instantiation: <&i32 as sval::value::Value>::to_bool Unexecuted instantiation: <&u32 as sval::value::Value>::to_bool Unexecuted instantiation: <&i128 as sval::value::Value>::to_bool Unexecuted instantiation: <&u128 as sval::value::Value>::to_bool Unexecuted instantiation: <&i16 as sval::value::Value>::to_bool Unexecuted instantiation: <&u16 as sval::value::Value>::to_bool Unexecuted instantiation: <&() as sval::value::Value>::to_bool Unexecuted instantiation: <&i64 as sval::value::Value>::to_bool Unexecuted instantiation: <&u64 as sval::value::Value>::to_bool Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_bool Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_bool Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_bool Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_bool Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_bool Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_bool Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_bool Unexecuted instantiation: <&_ as sval::value::Value>::to_bool Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_bool |
162 | | |
163 | | #[inline] |
164 | 0 | fn to_f32(&self) -> Option<f32> { |
165 | 0 | let $bind = self; |
166 | 0 | ($($forward)*).to_f32() |
167 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_f32 Unexecuted instantiation: <&&str as sval::value::Value>::to_f32 Unexecuted instantiation: <&i8 as sval::value::Value>::to_f32 Unexecuted instantiation: <&bool as sval::value::Value>::to_f32 Unexecuted instantiation: <&char as sval::value::Value>::to_f32 Unexecuted instantiation: <&f64 as sval::value::Value>::to_f32 Unexecuted instantiation: <&str as sval::value::Value>::to_f32 Unexecuted instantiation: <&f32 as sval::value::Value>::to_f32 Unexecuted instantiation: <&u8 as sval::value::Value>::to_f32 Unexecuted instantiation: <&i32 as sval::value::Value>::to_f32 Unexecuted instantiation: <&u32 as sval::value::Value>::to_f32 Unexecuted instantiation: <&i128 as sval::value::Value>::to_f32 Unexecuted instantiation: <&u128 as sval::value::Value>::to_f32 Unexecuted instantiation: <&i16 as sval::value::Value>::to_f32 Unexecuted instantiation: <&u16 as sval::value::Value>::to_f32 Unexecuted instantiation: <&() as sval::value::Value>::to_f32 Unexecuted instantiation: <&i64 as sval::value::Value>::to_f32 Unexecuted instantiation: <&u64 as sval::value::Value>::to_f32 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_f32 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_f32 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_f32 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_f32 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_f32 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_f32 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_f32 Unexecuted instantiation: <&_ as sval::value::Value>::to_f32 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_f32 |
168 | | |
169 | | #[inline] |
170 | 0 | fn to_f64(&self) -> Option<f64> { |
171 | 0 | let $bind = self; |
172 | 0 | ($($forward)*).to_f64() |
173 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_f64 Unexecuted instantiation: <&&str as sval::value::Value>::to_f64 Unexecuted instantiation: <&i8 as sval::value::Value>::to_f64 Unexecuted instantiation: <&bool as sval::value::Value>::to_f64 Unexecuted instantiation: <&char as sval::value::Value>::to_f64 Unexecuted instantiation: <&f64 as sval::value::Value>::to_f64 Unexecuted instantiation: <&str as sval::value::Value>::to_f64 Unexecuted instantiation: <&f32 as sval::value::Value>::to_f64 Unexecuted instantiation: <&u8 as sval::value::Value>::to_f64 Unexecuted instantiation: <&i32 as sval::value::Value>::to_f64 Unexecuted instantiation: <&u32 as sval::value::Value>::to_f64 Unexecuted instantiation: <&i128 as sval::value::Value>::to_f64 Unexecuted instantiation: <&u128 as sval::value::Value>::to_f64 Unexecuted instantiation: <&i16 as sval::value::Value>::to_f64 Unexecuted instantiation: <&u16 as sval::value::Value>::to_f64 Unexecuted instantiation: <&() as sval::value::Value>::to_f64 Unexecuted instantiation: <&i64 as sval::value::Value>::to_f64 Unexecuted instantiation: <&u64 as sval::value::Value>::to_f64 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_f64 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_f64 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_f64 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_f64 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_f64 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_f64 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_f64 Unexecuted instantiation: <&_ as sval::value::Value>::to_f64 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_f64 |
174 | | |
175 | | #[inline] |
176 | 0 | fn to_i8(&self) -> Option<i8> { |
177 | 0 | let $bind = self; |
178 | 0 | ($($forward)*).to_i8() |
179 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_i8 Unexecuted instantiation: <&&str as sval::value::Value>::to_i8 Unexecuted instantiation: <&i8 as sval::value::Value>::to_i8 Unexecuted instantiation: <&bool as sval::value::Value>::to_i8 Unexecuted instantiation: <&char as sval::value::Value>::to_i8 Unexecuted instantiation: <&f64 as sval::value::Value>::to_i8 Unexecuted instantiation: <&str as sval::value::Value>::to_i8 Unexecuted instantiation: <&f32 as sval::value::Value>::to_i8 Unexecuted instantiation: <&u8 as sval::value::Value>::to_i8 Unexecuted instantiation: <&i32 as sval::value::Value>::to_i8 Unexecuted instantiation: <&u32 as sval::value::Value>::to_i8 Unexecuted instantiation: <&i128 as sval::value::Value>::to_i8 Unexecuted instantiation: <&u128 as sval::value::Value>::to_i8 Unexecuted instantiation: <&i16 as sval::value::Value>::to_i8 Unexecuted instantiation: <&u16 as sval::value::Value>::to_i8 Unexecuted instantiation: <&() as sval::value::Value>::to_i8 Unexecuted instantiation: <&i64 as sval::value::Value>::to_i8 Unexecuted instantiation: <&u64 as sval::value::Value>::to_i8 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i8 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i8 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i8 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_i8 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_i8 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_i8 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_i8 Unexecuted instantiation: <&_ as sval::value::Value>::to_i8 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_i8 |
180 | | |
181 | | #[inline] |
182 | 0 | fn to_i16(&self) -> Option<i16> { |
183 | 0 | let $bind = self; |
184 | 0 | ($($forward)*).to_i16() |
185 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_i16 Unexecuted instantiation: <&&str as sval::value::Value>::to_i16 Unexecuted instantiation: <&i8 as sval::value::Value>::to_i16 Unexecuted instantiation: <&bool as sval::value::Value>::to_i16 Unexecuted instantiation: <&char as sval::value::Value>::to_i16 Unexecuted instantiation: <&f64 as sval::value::Value>::to_i16 Unexecuted instantiation: <&str as sval::value::Value>::to_i16 Unexecuted instantiation: <&f32 as sval::value::Value>::to_i16 Unexecuted instantiation: <&u8 as sval::value::Value>::to_i16 Unexecuted instantiation: <&i32 as sval::value::Value>::to_i16 Unexecuted instantiation: <&u32 as sval::value::Value>::to_i16 Unexecuted instantiation: <&i128 as sval::value::Value>::to_i16 Unexecuted instantiation: <&u128 as sval::value::Value>::to_i16 Unexecuted instantiation: <&i16 as sval::value::Value>::to_i16 Unexecuted instantiation: <&u16 as sval::value::Value>::to_i16 Unexecuted instantiation: <&() as sval::value::Value>::to_i16 Unexecuted instantiation: <&i64 as sval::value::Value>::to_i16 Unexecuted instantiation: <&u64 as sval::value::Value>::to_i16 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i16 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i16 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i16 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_i16 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_i16 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_i16 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_i16 Unexecuted instantiation: <&_ as sval::value::Value>::to_i16 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_i16 |
186 | | |
187 | | #[inline] |
188 | 0 | fn to_i32(&self) -> Option<i32> { |
189 | 0 | let $bind = self; |
190 | 0 | ($($forward)*).to_i32() |
191 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_i32 Unexecuted instantiation: <&&str as sval::value::Value>::to_i32 Unexecuted instantiation: <&i8 as sval::value::Value>::to_i32 Unexecuted instantiation: <&bool as sval::value::Value>::to_i32 Unexecuted instantiation: <&char as sval::value::Value>::to_i32 Unexecuted instantiation: <&f64 as sval::value::Value>::to_i32 Unexecuted instantiation: <&str as sval::value::Value>::to_i32 Unexecuted instantiation: <&f32 as sval::value::Value>::to_i32 Unexecuted instantiation: <&u8 as sval::value::Value>::to_i32 Unexecuted instantiation: <&i32 as sval::value::Value>::to_i32 Unexecuted instantiation: <&u32 as sval::value::Value>::to_i32 Unexecuted instantiation: <&i128 as sval::value::Value>::to_i32 Unexecuted instantiation: <&u128 as sval::value::Value>::to_i32 Unexecuted instantiation: <&i16 as sval::value::Value>::to_i32 Unexecuted instantiation: <&u16 as sval::value::Value>::to_i32 Unexecuted instantiation: <&() as sval::value::Value>::to_i32 Unexecuted instantiation: <&i64 as sval::value::Value>::to_i32 Unexecuted instantiation: <&u64 as sval::value::Value>::to_i32 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i32 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i32 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i32 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_i32 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_i32 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_i32 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_i32 Unexecuted instantiation: <&_ as sval::value::Value>::to_i32 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_i32 |
192 | | |
193 | | #[inline] |
194 | 0 | fn to_i64(&self) -> Option<i64> { |
195 | 0 | let $bind = self; |
196 | 0 | ($($forward)*).to_i64() |
197 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_i64 Unexecuted instantiation: <&&str as sval::value::Value>::to_i64 Unexecuted instantiation: <&i8 as sval::value::Value>::to_i64 Unexecuted instantiation: <&bool as sval::value::Value>::to_i64 Unexecuted instantiation: <&char as sval::value::Value>::to_i64 Unexecuted instantiation: <&f64 as sval::value::Value>::to_i64 Unexecuted instantiation: <&str as sval::value::Value>::to_i64 Unexecuted instantiation: <&f32 as sval::value::Value>::to_i64 Unexecuted instantiation: <&u8 as sval::value::Value>::to_i64 Unexecuted instantiation: <&i32 as sval::value::Value>::to_i64 Unexecuted instantiation: <&u32 as sval::value::Value>::to_i64 Unexecuted instantiation: <&i128 as sval::value::Value>::to_i64 Unexecuted instantiation: <&u128 as sval::value::Value>::to_i64 Unexecuted instantiation: <&i16 as sval::value::Value>::to_i64 Unexecuted instantiation: <&u16 as sval::value::Value>::to_i64 Unexecuted instantiation: <&() as sval::value::Value>::to_i64 Unexecuted instantiation: <&i64 as sval::value::Value>::to_i64 Unexecuted instantiation: <&u64 as sval::value::Value>::to_i64 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i64 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i64 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i64 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_i64 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_i64 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_i64 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_i64 Unexecuted instantiation: <&_ as sval::value::Value>::to_i64 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_i64 |
198 | | |
199 | | #[inline] |
200 | 0 | fn to_i128(&self) -> Option<i128> { |
201 | 0 | let $bind = self; |
202 | 0 | ($($forward)*).to_i128() |
203 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_i128 Unexecuted instantiation: <&&str as sval::value::Value>::to_i128 Unexecuted instantiation: <&i8 as sval::value::Value>::to_i128 Unexecuted instantiation: <&bool as sval::value::Value>::to_i128 Unexecuted instantiation: <&char as sval::value::Value>::to_i128 Unexecuted instantiation: <&f64 as sval::value::Value>::to_i128 Unexecuted instantiation: <&str as sval::value::Value>::to_i128 Unexecuted instantiation: <&f32 as sval::value::Value>::to_i128 Unexecuted instantiation: <&u8 as sval::value::Value>::to_i128 Unexecuted instantiation: <&i32 as sval::value::Value>::to_i128 Unexecuted instantiation: <&u32 as sval::value::Value>::to_i128 Unexecuted instantiation: <&i128 as sval::value::Value>::to_i128 Unexecuted instantiation: <&u128 as sval::value::Value>::to_i128 Unexecuted instantiation: <&i16 as sval::value::Value>::to_i128 Unexecuted instantiation: <&u16 as sval::value::Value>::to_i128 Unexecuted instantiation: <&() as sval::value::Value>::to_i128 Unexecuted instantiation: <&i64 as sval::value::Value>::to_i128 Unexecuted instantiation: <&u64 as sval::value::Value>::to_i128 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_i128 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_i128 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_i128 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_i128 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_i128 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_i128 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_i128 Unexecuted instantiation: <&_ as sval::value::Value>::to_i128 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_i128 |
204 | | |
205 | | #[inline] |
206 | 0 | fn to_u8(&self) -> Option<u8> { |
207 | 0 | let $bind = self; |
208 | 0 | ($($forward)*).to_u8() |
209 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_u8 Unexecuted instantiation: <&&str as sval::value::Value>::to_u8 Unexecuted instantiation: <&i8 as sval::value::Value>::to_u8 Unexecuted instantiation: <&bool as sval::value::Value>::to_u8 Unexecuted instantiation: <&char as sval::value::Value>::to_u8 Unexecuted instantiation: <&f64 as sval::value::Value>::to_u8 Unexecuted instantiation: <&str as sval::value::Value>::to_u8 Unexecuted instantiation: <&f32 as sval::value::Value>::to_u8 Unexecuted instantiation: <&u8 as sval::value::Value>::to_u8 Unexecuted instantiation: <&i32 as sval::value::Value>::to_u8 Unexecuted instantiation: <&u32 as sval::value::Value>::to_u8 Unexecuted instantiation: <&i128 as sval::value::Value>::to_u8 Unexecuted instantiation: <&u128 as sval::value::Value>::to_u8 Unexecuted instantiation: <&i16 as sval::value::Value>::to_u8 Unexecuted instantiation: <&u16 as sval::value::Value>::to_u8 Unexecuted instantiation: <&() as sval::value::Value>::to_u8 Unexecuted instantiation: <&i64 as sval::value::Value>::to_u8 Unexecuted instantiation: <&u64 as sval::value::Value>::to_u8 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u8 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u8 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u8 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_u8 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_u8 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_u8 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_u8 Unexecuted instantiation: <&_ as sval::value::Value>::to_u8 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_u8 |
210 | | |
211 | | #[inline] |
212 | 0 | fn to_u16(&self) -> Option<u16> { |
213 | 0 | let $bind = self; |
214 | 0 | ($($forward)*).to_u16() |
215 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_u16 Unexecuted instantiation: <&&str as sval::value::Value>::to_u16 Unexecuted instantiation: <&i8 as sval::value::Value>::to_u16 Unexecuted instantiation: <&bool as sval::value::Value>::to_u16 Unexecuted instantiation: <&char as sval::value::Value>::to_u16 Unexecuted instantiation: <&f64 as sval::value::Value>::to_u16 Unexecuted instantiation: <&str as sval::value::Value>::to_u16 Unexecuted instantiation: <&f32 as sval::value::Value>::to_u16 Unexecuted instantiation: <&u8 as sval::value::Value>::to_u16 Unexecuted instantiation: <&i32 as sval::value::Value>::to_u16 Unexecuted instantiation: <&u32 as sval::value::Value>::to_u16 Unexecuted instantiation: <&i128 as sval::value::Value>::to_u16 Unexecuted instantiation: <&u128 as sval::value::Value>::to_u16 Unexecuted instantiation: <&i16 as sval::value::Value>::to_u16 Unexecuted instantiation: <&u16 as sval::value::Value>::to_u16 Unexecuted instantiation: <&() as sval::value::Value>::to_u16 Unexecuted instantiation: <&i64 as sval::value::Value>::to_u16 Unexecuted instantiation: <&u64 as sval::value::Value>::to_u16 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u16 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u16 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u16 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_u16 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_u16 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_u16 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_u16 Unexecuted instantiation: <&_ as sval::value::Value>::to_u16 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_u16 |
216 | | |
217 | | #[inline] |
218 | 0 | fn to_u32(&self) -> Option<u32> { |
219 | 0 | let $bind = self; |
220 | 0 | ($($forward)*).to_u32() |
221 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_u32 Unexecuted instantiation: <&&str as sval::value::Value>::to_u32 Unexecuted instantiation: <&i8 as sval::value::Value>::to_u32 Unexecuted instantiation: <&bool as sval::value::Value>::to_u32 Unexecuted instantiation: <&char as sval::value::Value>::to_u32 Unexecuted instantiation: <&f64 as sval::value::Value>::to_u32 Unexecuted instantiation: <&str as sval::value::Value>::to_u32 Unexecuted instantiation: <&f32 as sval::value::Value>::to_u32 Unexecuted instantiation: <&u8 as sval::value::Value>::to_u32 Unexecuted instantiation: <&i32 as sval::value::Value>::to_u32 Unexecuted instantiation: <&u32 as sval::value::Value>::to_u32 Unexecuted instantiation: <&i128 as sval::value::Value>::to_u32 Unexecuted instantiation: <&u128 as sval::value::Value>::to_u32 Unexecuted instantiation: <&i16 as sval::value::Value>::to_u32 Unexecuted instantiation: <&u16 as sval::value::Value>::to_u32 Unexecuted instantiation: <&() as sval::value::Value>::to_u32 Unexecuted instantiation: <&i64 as sval::value::Value>::to_u32 Unexecuted instantiation: <&u64 as sval::value::Value>::to_u32 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u32 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u32 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u32 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_u32 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_u32 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_u32 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_u32 Unexecuted instantiation: <&_ as sval::value::Value>::to_u32 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_u32 |
222 | | |
223 | | #[inline] |
224 | 0 | fn to_u64(&self) -> Option<u64> { |
225 | 0 | let $bind = self; |
226 | 0 | ($($forward)*).to_u64() |
227 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_u64 Unexecuted instantiation: <&&str as sval::value::Value>::to_u64 Unexecuted instantiation: <&i8 as sval::value::Value>::to_u64 Unexecuted instantiation: <&bool as sval::value::Value>::to_u64 Unexecuted instantiation: <&char as sval::value::Value>::to_u64 Unexecuted instantiation: <&f64 as sval::value::Value>::to_u64 Unexecuted instantiation: <&str as sval::value::Value>::to_u64 Unexecuted instantiation: <&f32 as sval::value::Value>::to_u64 Unexecuted instantiation: <&u8 as sval::value::Value>::to_u64 Unexecuted instantiation: <&i32 as sval::value::Value>::to_u64 Unexecuted instantiation: <&u32 as sval::value::Value>::to_u64 Unexecuted instantiation: <&i128 as sval::value::Value>::to_u64 Unexecuted instantiation: <&u128 as sval::value::Value>::to_u64 Unexecuted instantiation: <&i16 as sval::value::Value>::to_u64 Unexecuted instantiation: <&u16 as sval::value::Value>::to_u64 Unexecuted instantiation: <&() as sval::value::Value>::to_u64 Unexecuted instantiation: <&i64 as sval::value::Value>::to_u64 Unexecuted instantiation: <&u64 as sval::value::Value>::to_u64 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u64 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u64 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u64 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_u64 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_u64 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_u64 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_u64 Unexecuted instantiation: <&_ as sval::value::Value>::to_u64 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_u64 |
228 | | |
229 | | #[inline] |
230 | 0 | fn to_u128(&self) -> Option<u128> { |
231 | 0 | let $bind = self; |
232 | 0 | ($($forward)*).to_u128() |
233 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_u128 Unexecuted instantiation: <&&str as sval::value::Value>::to_u128 Unexecuted instantiation: <&i8 as sval::value::Value>::to_u128 Unexecuted instantiation: <&bool as sval::value::Value>::to_u128 Unexecuted instantiation: <&char as sval::value::Value>::to_u128 Unexecuted instantiation: <&f64 as sval::value::Value>::to_u128 Unexecuted instantiation: <&str as sval::value::Value>::to_u128 Unexecuted instantiation: <&f32 as sval::value::Value>::to_u128 Unexecuted instantiation: <&u8 as sval::value::Value>::to_u128 Unexecuted instantiation: <&i32 as sval::value::Value>::to_u128 Unexecuted instantiation: <&u32 as sval::value::Value>::to_u128 Unexecuted instantiation: <&i128 as sval::value::Value>::to_u128 Unexecuted instantiation: <&u128 as sval::value::Value>::to_u128 Unexecuted instantiation: <&i16 as sval::value::Value>::to_u128 Unexecuted instantiation: <&u16 as sval::value::Value>::to_u128 Unexecuted instantiation: <&() as sval::value::Value>::to_u128 Unexecuted instantiation: <&i64 as sval::value::Value>::to_u128 Unexecuted instantiation: <&u64 as sval::value::Value>::to_u128 Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_u128 Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_u128 Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_u128 Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_u128 Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_u128 Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_u128 Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_u128 Unexecuted instantiation: <&_ as sval::value::Value>::to_u128 Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_u128 |
234 | | |
235 | | #[inline] |
236 | 0 | fn to_text(&self) -> Option<&str> { |
237 | 0 | let $bind = self; |
238 | 0 | ($($forward)*).to_text() |
239 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_text Unexecuted instantiation: <&&str as sval::value::Value>::to_text Unexecuted instantiation: <&i8 as sval::value::Value>::to_text Unexecuted instantiation: <&bool as sval::value::Value>::to_text Unexecuted instantiation: <&char as sval::value::Value>::to_text Unexecuted instantiation: <&f64 as sval::value::Value>::to_text Unexecuted instantiation: <&str as sval::value::Value>::to_text Unexecuted instantiation: <&f32 as sval::value::Value>::to_text Unexecuted instantiation: <&u8 as sval::value::Value>::to_text Unexecuted instantiation: <&i32 as sval::value::Value>::to_text Unexecuted instantiation: <&u32 as sval::value::Value>::to_text Unexecuted instantiation: <&i128 as sval::value::Value>::to_text Unexecuted instantiation: <&u128 as sval::value::Value>::to_text Unexecuted instantiation: <&i16 as sval::value::Value>::to_text Unexecuted instantiation: <&u16 as sval::value::Value>::to_text Unexecuted instantiation: <&() as sval::value::Value>::to_text Unexecuted instantiation: <&i64 as sval::value::Value>::to_text Unexecuted instantiation: <&u64 as sval::value::Value>::to_text Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_text Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_text Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_text Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_text Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_text Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_text Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_text Unexecuted instantiation: <&_ as sval::value::Value>::to_text Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_text |
240 | | |
241 | | #[inline] |
242 | 0 | fn to_binary(&self) -> Option<&[u8]> { |
243 | 0 | let $bind = self; |
244 | 0 | ($($forward)*).to_binary() |
245 | 0 | } Unexecuted instantiation: <&dyn sval_dynamic::value::Value as sval::value::Value>::to_binary Unexecuted instantiation: <&&str as sval::value::Value>::to_binary Unexecuted instantiation: <&i8 as sval::value::Value>::to_binary Unexecuted instantiation: <&bool as sval::value::Value>::to_binary Unexecuted instantiation: <&char as sval::value::Value>::to_binary Unexecuted instantiation: <&f64 as sval::value::Value>::to_binary Unexecuted instantiation: <&str as sval::value::Value>::to_binary Unexecuted instantiation: <&f32 as sval::value::Value>::to_binary Unexecuted instantiation: <&u8 as sval::value::Value>::to_binary Unexecuted instantiation: <&i32 as sval::value::Value>::to_binary Unexecuted instantiation: <&u32 as sval::value::Value>::to_binary Unexecuted instantiation: <&i128 as sval::value::Value>::to_binary Unexecuted instantiation: <&u128 as sval::value::Value>::to_binary Unexecuted instantiation: <&i16 as sval::value::Value>::to_binary Unexecuted instantiation: <&u16 as sval::value::Value>::to_binary Unexecuted instantiation: <&() as sval::value::Value>::to_binary Unexecuted instantiation: <&i64 as sval::value::Value>::to_binary Unexecuted instantiation: <&u64 as sval::value::Value>::to_binary Unexecuted instantiation: <&sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize> as sval::value::Value>::to_binary Unexecuted instantiation: <&sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug> as sval::value::Value>::to_binary Unexecuted instantiation: <&sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display> as sval::value::Value>::to_binary Unexecuted instantiation: <&core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> as sval::value::Value>::to_binary Unexecuted instantiation: <&core::option::Option<()> as sval::value::Value>::to_binary Unexecuted instantiation: <&&sval::data::binary::BinarySlice as sval::value::Value>::to_binary Unexecuted instantiation: <&sval::data::binary::BinarySlice as sval::value::Value>::to_binary Unexecuted instantiation: <&_ as sval::value::Value>::to_binary Unexecuted instantiation: <alloc::boxed::Box<_> as sval::value::Value>::to_binary |
246 | | } |
247 | | }; |
248 | | } |
249 | | |
250 | | impl_value_forward!({impl<'a, T: Value + ?Sized> Value for &'a T} => x => { **x }); |
251 | | |
252 | | #[cfg(feature = "alloc")] |
253 | | mod alloc_support { |
254 | | use super::*; |
255 | | |
256 | | use crate::std::boxed::Box; |
257 | | |
258 | | impl_value_forward!({impl<T: Value + ?Sized> Value for Box<T>} => x => { **x }); |
259 | | } |
260 | | |
261 | | pub mod default_value { |
262 | | /*! |
263 | | Default method implementations for [`Value`]s. |
264 | | */ |
265 | | |
266 | | use super::*; |
267 | | |
268 | | /** |
269 | | Get the tag of this value, if there is one. |
270 | | */ |
271 | 0 | pub fn tag(value: &(impl Value + ?Sized)) -> Option<Tag> { |
272 | | struct Extract { |
273 | | value: Option<Tag>, |
274 | | set: bool, |
275 | | } |
276 | | |
277 | | impl Extract { |
278 | 0 | fn set(&mut self, tag: Option<&Tag>) -> Result { |
279 | 0 | if self.set { |
280 | 0 | return crate::error(); |
281 | 0 | } |
282 | | |
283 | 0 | self.set = true; |
284 | 0 | self.value = tag.cloned(); |
285 | | |
286 | 0 | Ok(()) |
287 | 0 | } |
288 | | } |
289 | | |
290 | | impl<'sval> Stream<'sval> for Extract { |
291 | 0 | fn tag(&mut self, tag: Option<&Tag>, _: Option<&Label>, _: Option<&Index>) -> Result { |
292 | 0 | self.set(tag) |
293 | 0 | } |
294 | | |
295 | 0 | fn tagged_begin( |
296 | 0 | &mut self, |
297 | 0 | tag: Option<&Tag>, |
298 | 0 | _: Option<&Label>, |
299 | 0 | _: Option<&Index>, |
300 | 0 | ) -> Result { |
301 | 0 | self.set(tag) |
302 | 0 | } |
303 | | |
304 | 0 | fn enum_begin( |
305 | 0 | &mut self, |
306 | 0 | tag: Option<&Tag>, |
307 | 0 | _: Option<&Label>, |
308 | 0 | _: Option<&Index>, |
309 | 0 | ) -> Result { |
310 | 0 | self.set(tag) |
311 | 0 | } |
312 | | |
313 | 0 | fn record_begin( |
314 | 0 | &mut self, |
315 | 0 | tag: Option<&Tag>, |
316 | 0 | _: Option<&Label>, |
317 | 0 | _: Option<&Index>, |
318 | 0 | _: Option<usize>, |
319 | 0 | ) -> Result { |
320 | 0 | self.set(tag) |
321 | 0 | } |
322 | | |
323 | 0 | fn tuple_begin( |
324 | 0 | &mut self, |
325 | 0 | tag: Option<&Tag>, |
326 | 0 | _: Option<&Label>, |
327 | 0 | _: Option<&Index>, |
328 | 0 | _: Option<usize>, |
329 | 0 | ) -> Result { |
330 | 0 | self.set(tag) |
331 | 0 | } |
332 | | |
333 | 0 | fn bool(&mut self, _: bool) -> Result { |
334 | 0 | crate::error() |
335 | 0 | } |
336 | | |
337 | 0 | fn null(&mut self) -> Result { |
338 | 0 | crate::error() |
339 | 0 | } |
340 | | |
341 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
342 | 0 | crate::error() |
343 | 0 | } |
344 | | |
345 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
346 | 0 | crate::error() |
347 | 0 | } |
348 | | |
349 | 0 | fn text_end(&mut self) -> Result { |
350 | 0 | crate::error() |
351 | 0 | } |
352 | | |
353 | 0 | fn i64(&mut self, _: i64) -> Result { |
354 | 0 | self.set(Some(&crate::tags::NUMBER)) |
355 | 0 | } |
356 | | |
357 | 0 | fn f64(&mut self, _: f64) -> Result { |
358 | 0 | self.set(Some(&crate::tags::NUMBER)) |
359 | 0 | } |
360 | | |
361 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
362 | 0 | crate::error() |
363 | 0 | } |
364 | | |
365 | 0 | fn seq_value_begin(&mut self) -> Result { |
366 | 0 | crate::error() |
367 | 0 | } |
368 | | |
369 | 0 | fn seq_value_end(&mut self) -> Result { |
370 | 0 | crate::error() |
371 | 0 | } |
372 | | |
373 | 0 | fn seq_end(&mut self) -> Result { |
374 | 0 | crate::error() |
375 | 0 | } |
376 | | } |
377 | | |
378 | 0 | let mut extract = Extract { |
379 | 0 | value: None, |
380 | 0 | set: false, |
381 | 0 | }; |
382 | | |
383 | 0 | let _ = value.stream(&mut extract); |
384 | | |
385 | 0 | extract.value |
386 | 0 | } Unexecuted instantiation: sval::value::default_value::tag::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::tag::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::tag::<core::option::Option<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>> Unexecuted instantiation: sval::value::default_value::tag::<core::option::Option<()>> Unexecuted instantiation: sval::value::default_value::tag::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::tag::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::tag::<i8> Unexecuted instantiation: sval::value::default_value::tag::<char> Unexecuted instantiation: sval::value::default_value::tag::<f64> Unexecuted instantiation: sval::value::default_value::tag::<f32> Unexecuted instantiation: sval::value::default_value::tag::<u8> Unexecuted instantiation: sval::value::default_value::tag::<i32> Unexecuted instantiation: sval::value::default_value::tag::<u32> Unexecuted instantiation: sval::value::default_value::tag::<i128> Unexecuted instantiation: sval::value::default_value::tag::<u128> Unexecuted instantiation: sval::value::default_value::tag::<i16> Unexecuted instantiation: sval::value::default_value::tag::<u16> Unexecuted instantiation: sval::value::default_value::tag::<()> Unexecuted instantiation: sval::value::default_value::tag::<i64> Unexecuted instantiation: sval::value::default_value::tag::<u64> Unexecuted instantiation: sval::value::default_value::tag::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::tag::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::tag::<_> |
387 | | |
388 | | /** |
389 | | Try convert this value into a boolean. |
390 | | */ |
391 | 0 | pub fn to_bool(value: &(impl Value + ?Sized)) -> Option<bool> { |
392 | | struct Extract(Option<bool>); |
393 | | |
394 | | impl<'sval> Stream<'sval> for Extract { |
395 | 0 | fn bool(&mut self, value: bool) -> Result { |
396 | 0 | self.0 = Some(value); |
397 | 0 | Ok(()) |
398 | 0 | } |
399 | | |
400 | 0 | fn null(&mut self) -> Result { |
401 | 0 | crate::error() |
402 | 0 | } |
403 | | |
404 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
405 | 0 | crate::error() |
406 | 0 | } |
407 | | |
408 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
409 | 0 | crate::error() |
410 | 0 | } |
411 | | |
412 | 0 | fn text_end(&mut self) -> Result { |
413 | 0 | crate::error() |
414 | 0 | } |
415 | | |
416 | 0 | fn i64(&mut self, _: i64) -> Result { |
417 | 0 | crate::error() |
418 | 0 | } |
419 | | |
420 | 0 | fn f64(&mut self, _: f64) -> Result { |
421 | 0 | crate::error() |
422 | 0 | } |
423 | | |
424 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
425 | 0 | crate::error() |
426 | 0 | } |
427 | | |
428 | 0 | fn seq_value_begin(&mut self) -> Result { |
429 | 0 | crate::error() |
430 | 0 | } |
431 | | |
432 | 0 | fn seq_value_end(&mut self) -> Result { |
433 | 0 | crate::error() |
434 | 0 | } |
435 | | |
436 | 0 | fn seq_end(&mut self) -> Result { |
437 | 0 | crate::error() |
438 | 0 | } |
439 | | } |
440 | | |
441 | 0 | let mut extract = Extract(None); |
442 | 0 | value.stream(&mut extract).ok()?; |
443 | 0 | extract.0 |
444 | 0 | } Unexecuted instantiation: sval::value::default_value::to_bool::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_bool::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_bool::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_bool::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_bool::<i8> Unexecuted instantiation: sval::value::default_value::to_bool::<char> Unexecuted instantiation: sval::value::default_value::to_bool::<f64> Unexecuted instantiation: sval::value::default_value::to_bool::<str> Unexecuted instantiation: sval::value::default_value::to_bool::<f32> Unexecuted instantiation: sval::value::default_value::to_bool::<u8> Unexecuted instantiation: sval::value::default_value::to_bool::<i32> Unexecuted instantiation: sval::value::default_value::to_bool::<u32> Unexecuted instantiation: sval::value::default_value::to_bool::<i128> Unexecuted instantiation: sval::value::default_value::to_bool::<u128> Unexecuted instantiation: sval::value::default_value::to_bool::<i16> Unexecuted instantiation: sval::value::default_value::to_bool::<u16> Unexecuted instantiation: sval::value::default_value::to_bool::<()> Unexecuted instantiation: sval::value::default_value::to_bool::<i64> Unexecuted instantiation: sval::value::default_value::to_bool::<u64> Unexecuted instantiation: sval::value::default_value::to_bool::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_bool::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_bool::<_> |
445 | | |
446 | | /** |
447 | | Try convert this value into a 32bit binary floating point number. |
448 | | */ |
449 | 0 | pub fn to_f32(value: &(impl Value + ?Sized)) -> Option<f32> { |
450 | | struct Extract(Option<f32>); |
451 | | |
452 | | impl<'sval> Stream<'sval> for Extract { |
453 | 0 | fn f32(&mut self, value: f32) -> Result { |
454 | 0 | self.0 = Some(value); |
455 | 0 | Ok(()) |
456 | 0 | } |
457 | | |
458 | 0 | fn null(&mut self) -> Result { |
459 | 0 | crate::error() |
460 | 0 | } |
461 | | |
462 | 0 | fn bool(&mut self, _: bool) -> Result { |
463 | 0 | crate::error() |
464 | 0 | } |
465 | | |
466 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
467 | 0 | crate::error() |
468 | 0 | } |
469 | | |
470 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
471 | 0 | crate::error() |
472 | 0 | } |
473 | | |
474 | 0 | fn text_end(&mut self) -> Result { |
475 | 0 | crate::error() |
476 | 0 | } |
477 | | |
478 | 0 | fn i64(&mut self, _: i64) -> Result { |
479 | 0 | crate::error() |
480 | 0 | } |
481 | | |
482 | 0 | fn f64(&mut self, _: f64) -> Result { |
483 | 0 | crate::error() |
484 | 0 | } |
485 | | |
486 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
487 | 0 | crate::error() |
488 | 0 | } |
489 | | |
490 | 0 | fn seq_value_begin(&mut self) -> Result { |
491 | 0 | crate::error() |
492 | 0 | } |
493 | | |
494 | 0 | fn seq_value_end(&mut self) -> Result { |
495 | 0 | crate::error() |
496 | 0 | } |
497 | | |
498 | 0 | fn seq_end(&mut self) -> Result { |
499 | 0 | crate::error() |
500 | 0 | } |
501 | | } |
502 | | |
503 | 0 | let mut extract = Extract(None); |
504 | 0 | value.stream(&mut extract).ok()?; |
505 | 0 | extract.0 |
506 | 0 | } Unexecuted instantiation: sval::value::default_value::to_f32::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_f32::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_f32::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_f32::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_f32::<i8> Unexecuted instantiation: sval::value::default_value::to_f32::<bool> Unexecuted instantiation: sval::value::default_value::to_f32::<char> Unexecuted instantiation: sval::value::default_value::to_f32::<f64> Unexecuted instantiation: sval::value::default_value::to_f32::<str> Unexecuted instantiation: sval::value::default_value::to_f32::<u8> Unexecuted instantiation: sval::value::default_value::to_f32::<i32> Unexecuted instantiation: sval::value::default_value::to_f32::<u32> Unexecuted instantiation: sval::value::default_value::to_f32::<i128> Unexecuted instantiation: sval::value::default_value::to_f32::<u128> Unexecuted instantiation: sval::value::default_value::to_f32::<i16> Unexecuted instantiation: sval::value::default_value::to_f32::<u16> Unexecuted instantiation: sval::value::default_value::to_f32::<()> Unexecuted instantiation: sval::value::default_value::to_f32::<i64> Unexecuted instantiation: sval::value::default_value::to_f32::<u64> Unexecuted instantiation: sval::value::default_value::to_f32::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_f32::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_f32::<_> |
507 | | |
508 | | /** |
509 | | Try convert this value into a 64bit binary floating point number. |
510 | | */ |
511 | 0 | pub fn to_f64(value: &(impl Value + ?Sized)) -> Option<f64> { |
512 | | struct Extract(Option<f64>); |
513 | | |
514 | | impl<'sval> Stream<'sval> for Extract { |
515 | 0 | fn f64(&mut self, value: f64) -> Result { |
516 | 0 | self.0 = Some(value); |
517 | 0 | Ok(()) |
518 | 0 | } |
519 | | |
520 | 0 | fn null(&mut self) -> Result { |
521 | 0 | crate::error() |
522 | 0 | } |
523 | | |
524 | 0 | fn bool(&mut self, _: bool) -> Result { |
525 | 0 | crate::error() |
526 | 0 | } |
527 | | |
528 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
529 | 0 | crate::error() |
530 | 0 | } |
531 | | |
532 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
533 | 0 | crate::error() |
534 | 0 | } |
535 | | |
536 | 0 | fn text_end(&mut self) -> Result { |
537 | 0 | crate::error() |
538 | 0 | } |
539 | | |
540 | 0 | fn i64(&mut self, _: i64) -> Result { |
541 | 0 | crate::error() |
542 | 0 | } |
543 | | |
544 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
545 | 0 | crate::error() |
546 | 0 | } |
547 | | |
548 | 0 | fn seq_value_begin(&mut self) -> Result { |
549 | 0 | crate::error() |
550 | 0 | } |
551 | | |
552 | 0 | fn seq_value_end(&mut self) -> Result { |
553 | 0 | crate::error() |
554 | 0 | } |
555 | | |
556 | 0 | fn seq_end(&mut self) -> Result { |
557 | 0 | crate::error() |
558 | 0 | } |
559 | | } |
560 | | |
561 | 0 | let mut extract = Extract(None); |
562 | 0 | value.stream(&mut extract).ok()?; |
563 | 0 | extract.0 |
564 | 0 | } Unexecuted instantiation: sval::value::default_value::to_f64::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_f64::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_f64::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_f64::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_f64::<i8> Unexecuted instantiation: sval::value::default_value::to_f64::<bool> Unexecuted instantiation: sval::value::default_value::to_f64::<char> Unexecuted instantiation: sval::value::default_value::to_f64::<str> Unexecuted instantiation: sval::value::default_value::to_f64::<f32> Unexecuted instantiation: sval::value::default_value::to_f64::<u8> Unexecuted instantiation: sval::value::default_value::to_f64::<i32> Unexecuted instantiation: sval::value::default_value::to_f64::<u32> Unexecuted instantiation: sval::value::default_value::to_f64::<i128> Unexecuted instantiation: sval::value::default_value::to_f64::<u128> Unexecuted instantiation: sval::value::default_value::to_f64::<i16> Unexecuted instantiation: sval::value::default_value::to_f64::<u16> Unexecuted instantiation: sval::value::default_value::to_f64::<()> Unexecuted instantiation: sval::value::default_value::to_f64::<i64> Unexecuted instantiation: sval::value::default_value::to_f64::<u64> Unexecuted instantiation: sval::value::default_value::to_f64::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_f64::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_f64::<_> |
565 | | |
566 | | /** |
567 | | Try convert this value into a signed 8bit integer. |
568 | | */ |
569 | 0 | pub fn to_i8(value: &(impl Value + ?Sized)) -> Option<i8> { |
570 | 0 | value.to_i128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_i8::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i8::<_>::{closure#0} |
571 | 0 | } Unexecuted instantiation: sval::value::default_value::to_i8::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_i8::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_i8::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_i8::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_i8::<bool> Unexecuted instantiation: sval::value::default_value::to_i8::<char> Unexecuted instantiation: sval::value::default_value::to_i8::<f64> Unexecuted instantiation: sval::value::default_value::to_i8::<str> Unexecuted instantiation: sval::value::default_value::to_i8::<f32> Unexecuted instantiation: sval::value::default_value::to_i8::<u8> Unexecuted instantiation: sval::value::default_value::to_i8::<i32> Unexecuted instantiation: sval::value::default_value::to_i8::<u32> Unexecuted instantiation: sval::value::default_value::to_i8::<i128> Unexecuted instantiation: sval::value::default_value::to_i8::<u128> Unexecuted instantiation: sval::value::default_value::to_i8::<i16> Unexecuted instantiation: sval::value::default_value::to_i8::<u16> Unexecuted instantiation: sval::value::default_value::to_i8::<()> Unexecuted instantiation: sval::value::default_value::to_i8::<i64> Unexecuted instantiation: sval::value::default_value::to_i8::<u64> Unexecuted instantiation: sval::value::default_value::to_i8::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_i8::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_i8::<_> |
572 | | |
573 | | /** |
574 | | Try convert this value into a signed 16bit integer. |
575 | | */ |
576 | 0 | pub fn to_i16(value: &(impl Value + ?Sized)) -> Option<i16> { |
577 | 0 | value.to_i128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_i16::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i16::<_>::{closure#0} |
578 | 0 | } Unexecuted instantiation: sval::value::default_value::to_i16::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_i16::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_i16::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_i16::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_i16::<i8> Unexecuted instantiation: sval::value::default_value::to_i16::<bool> Unexecuted instantiation: sval::value::default_value::to_i16::<char> Unexecuted instantiation: sval::value::default_value::to_i16::<f64> Unexecuted instantiation: sval::value::default_value::to_i16::<str> Unexecuted instantiation: sval::value::default_value::to_i16::<f32> Unexecuted instantiation: sval::value::default_value::to_i16::<u8> Unexecuted instantiation: sval::value::default_value::to_i16::<i32> Unexecuted instantiation: sval::value::default_value::to_i16::<u32> Unexecuted instantiation: sval::value::default_value::to_i16::<i128> Unexecuted instantiation: sval::value::default_value::to_i16::<u128> Unexecuted instantiation: sval::value::default_value::to_i16::<u16> Unexecuted instantiation: sval::value::default_value::to_i16::<()> Unexecuted instantiation: sval::value::default_value::to_i16::<i64> Unexecuted instantiation: sval::value::default_value::to_i16::<u64> Unexecuted instantiation: sval::value::default_value::to_i16::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_i16::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_i16::<_> |
579 | | |
580 | | /** |
581 | | Try convert this value into a signed 32bit integer. |
582 | | */ |
583 | 0 | pub fn to_i32(value: &(impl Value + ?Sized)) -> Option<i32> { |
584 | 0 | value.to_i128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_i32::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i32::<_>::{closure#0} |
585 | 0 | } Unexecuted instantiation: sval::value::default_value::to_i32::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_i32::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_i32::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_i32::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_i32::<i8> Unexecuted instantiation: sval::value::default_value::to_i32::<bool> Unexecuted instantiation: sval::value::default_value::to_i32::<char> Unexecuted instantiation: sval::value::default_value::to_i32::<f64> Unexecuted instantiation: sval::value::default_value::to_i32::<str> Unexecuted instantiation: sval::value::default_value::to_i32::<f32> Unexecuted instantiation: sval::value::default_value::to_i32::<u8> Unexecuted instantiation: sval::value::default_value::to_i32::<u32> Unexecuted instantiation: sval::value::default_value::to_i32::<i128> Unexecuted instantiation: sval::value::default_value::to_i32::<u128> Unexecuted instantiation: sval::value::default_value::to_i32::<i16> Unexecuted instantiation: sval::value::default_value::to_i32::<u16> Unexecuted instantiation: sval::value::default_value::to_i32::<()> Unexecuted instantiation: sval::value::default_value::to_i32::<i64> Unexecuted instantiation: sval::value::default_value::to_i32::<u64> Unexecuted instantiation: sval::value::default_value::to_i32::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_i32::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_i32::<_> |
586 | | |
587 | | /** |
588 | | Try convert this value into a signed 64bit integer. |
589 | | */ |
590 | 0 | pub fn to_i64(value: &(impl Value + ?Sized)) -> Option<i64> { |
591 | 0 | value.to_i128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_i64::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_i64::<_>::{closure#0} |
592 | 0 | } Unexecuted instantiation: sval::value::default_value::to_i64::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_i64::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_i64::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_i64::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_i64::<i8> Unexecuted instantiation: sval::value::default_value::to_i64::<bool> Unexecuted instantiation: sval::value::default_value::to_i64::<char> Unexecuted instantiation: sval::value::default_value::to_i64::<f64> Unexecuted instantiation: sval::value::default_value::to_i64::<str> Unexecuted instantiation: sval::value::default_value::to_i64::<f32> Unexecuted instantiation: sval::value::default_value::to_i64::<u8> Unexecuted instantiation: sval::value::default_value::to_i64::<i32> Unexecuted instantiation: sval::value::default_value::to_i64::<u32> Unexecuted instantiation: sval::value::default_value::to_i64::<i128> Unexecuted instantiation: sval::value::default_value::to_i64::<u128> Unexecuted instantiation: sval::value::default_value::to_i64::<i16> Unexecuted instantiation: sval::value::default_value::to_i64::<u16> Unexecuted instantiation: sval::value::default_value::to_i64::<()> Unexecuted instantiation: sval::value::default_value::to_i64::<u64> Unexecuted instantiation: sval::value::default_value::to_i64::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_i64::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_i64::<_> |
593 | | |
594 | | /** |
595 | | Try convert this value into a signed 128bit integer. |
596 | | */ |
597 | 0 | pub fn to_i128(value: &(impl Value + ?Sized)) -> Option<i128> { |
598 | | struct Extract(Option<i128>); |
599 | | |
600 | | impl<'sval> Stream<'sval> for Extract { |
601 | 0 | fn i128(&mut self, value: i128) -> Result { |
602 | 0 | self.0 = Some(value); |
603 | 0 | Ok(()) |
604 | 0 | } |
605 | | |
606 | 0 | fn null(&mut self) -> Result { |
607 | 0 | crate::error() |
608 | 0 | } |
609 | | |
610 | 0 | fn bool(&mut self, _: bool) -> Result { |
611 | 0 | crate::error() |
612 | 0 | } |
613 | | |
614 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
615 | 0 | crate::error() |
616 | 0 | } |
617 | | |
618 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
619 | 0 | crate::error() |
620 | 0 | } |
621 | | |
622 | 0 | fn text_end(&mut self) -> Result { |
623 | 0 | crate::error() |
624 | 0 | } |
625 | | |
626 | 0 | fn i64(&mut self, _: i64) -> Result { |
627 | 0 | crate::error() |
628 | 0 | } |
629 | | |
630 | 0 | fn f64(&mut self, _: f64) -> Result { |
631 | 0 | crate::error() |
632 | 0 | } |
633 | | |
634 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
635 | 0 | crate::error() |
636 | 0 | } |
637 | | |
638 | 0 | fn seq_value_begin(&mut self) -> Result { |
639 | 0 | crate::error() |
640 | 0 | } |
641 | | |
642 | 0 | fn seq_value_end(&mut self) -> Result { |
643 | 0 | crate::error() |
644 | 0 | } |
645 | | |
646 | 0 | fn seq_end(&mut self) -> Result { |
647 | 0 | crate::error() |
648 | 0 | } |
649 | | } |
650 | | |
651 | 0 | let mut extract = Extract(None); |
652 | 0 | value.stream(&mut extract).ok()?; |
653 | 0 | extract.0 |
654 | 0 | } Unexecuted instantiation: sval::value::default_value::to_i128::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_i128::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_i128::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_i128::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_i128::<i8> Unexecuted instantiation: sval::value::default_value::to_i128::<bool> Unexecuted instantiation: sval::value::default_value::to_i128::<char> Unexecuted instantiation: sval::value::default_value::to_i128::<f64> Unexecuted instantiation: sval::value::default_value::to_i128::<str> Unexecuted instantiation: sval::value::default_value::to_i128::<f32> Unexecuted instantiation: sval::value::default_value::to_i128::<u8> Unexecuted instantiation: sval::value::default_value::to_i128::<i32> Unexecuted instantiation: sval::value::default_value::to_i128::<u32> Unexecuted instantiation: sval::value::default_value::to_i128::<u128> Unexecuted instantiation: sval::value::default_value::to_i128::<i16> Unexecuted instantiation: sval::value::default_value::to_i128::<u16> Unexecuted instantiation: sval::value::default_value::to_i128::<()> Unexecuted instantiation: sval::value::default_value::to_i128::<i64> Unexecuted instantiation: sval::value::default_value::to_i128::<u64> Unexecuted instantiation: sval::value::default_value::to_i128::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_i128::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_i128::<_> |
655 | | |
656 | | /** |
657 | | Try convert this value into an unsigned 8bit integer. |
658 | | */ |
659 | 0 | pub fn to_u8(value: &(impl Value + ?Sized)) -> Option<u8> { |
660 | 0 | value.to_u128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_u8::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u8::<_>::{closure#0} |
661 | 0 | } Unexecuted instantiation: sval::value::default_value::to_u8::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_u8::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_u8::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_u8::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_u8::<i8> Unexecuted instantiation: sval::value::default_value::to_u8::<bool> Unexecuted instantiation: sval::value::default_value::to_u8::<char> Unexecuted instantiation: sval::value::default_value::to_u8::<f64> Unexecuted instantiation: sval::value::default_value::to_u8::<str> Unexecuted instantiation: sval::value::default_value::to_u8::<f32> Unexecuted instantiation: sval::value::default_value::to_u8::<i32> Unexecuted instantiation: sval::value::default_value::to_u8::<u32> Unexecuted instantiation: sval::value::default_value::to_u8::<i128> Unexecuted instantiation: sval::value::default_value::to_u8::<u128> Unexecuted instantiation: sval::value::default_value::to_u8::<i16> Unexecuted instantiation: sval::value::default_value::to_u8::<u16> Unexecuted instantiation: sval::value::default_value::to_u8::<()> Unexecuted instantiation: sval::value::default_value::to_u8::<i64> Unexecuted instantiation: sval::value::default_value::to_u8::<u64> Unexecuted instantiation: sval::value::default_value::to_u8::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_u8::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_u8::<_> |
662 | | |
663 | | /** |
664 | | Try convert this value into an unsigned 16bit integer. |
665 | | */ |
666 | 0 | pub fn to_u16(value: &(impl Value + ?Sized)) -> Option<u16> { |
667 | 0 | value.to_u128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_u16::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u16::<_>::{closure#0} |
668 | 0 | } Unexecuted instantiation: sval::value::default_value::to_u16::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_u16::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_u16::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_u16::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_u16::<i8> Unexecuted instantiation: sval::value::default_value::to_u16::<bool> Unexecuted instantiation: sval::value::default_value::to_u16::<char> Unexecuted instantiation: sval::value::default_value::to_u16::<f64> Unexecuted instantiation: sval::value::default_value::to_u16::<str> Unexecuted instantiation: sval::value::default_value::to_u16::<f32> Unexecuted instantiation: sval::value::default_value::to_u16::<u8> Unexecuted instantiation: sval::value::default_value::to_u16::<i32> Unexecuted instantiation: sval::value::default_value::to_u16::<u32> Unexecuted instantiation: sval::value::default_value::to_u16::<i128> Unexecuted instantiation: sval::value::default_value::to_u16::<u128> Unexecuted instantiation: sval::value::default_value::to_u16::<i16> Unexecuted instantiation: sval::value::default_value::to_u16::<()> Unexecuted instantiation: sval::value::default_value::to_u16::<i64> Unexecuted instantiation: sval::value::default_value::to_u16::<u64> Unexecuted instantiation: sval::value::default_value::to_u16::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_u16::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_u16::<_> |
669 | | |
670 | | /** |
671 | | Try convert this value into an unsigned 32bit integer. |
672 | | */ |
673 | 0 | pub fn to_u32(value: &(impl Value + ?Sized)) -> Option<u32> { |
674 | 0 | value.to_u128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_u32::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<u64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u32::<_>::{closure#0} |
675 | 0 | } Unexecuted instantiation: sval::value::default_value::to_u32::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_u32::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_u32::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_u32::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_u32::<i8> Unexecuted instantiation: sval::value::default_value::to_u32::<bool> Unexecuted instantiation: sval::value::default_value::to_u32::<char> Unexecuted instantiation: sval::value::default_value::to_u32::<f64> Unexecuted instantiation: sval::value::default_value::to_u32::<str> Unexecuted instantiation: sval::value::default_value::to_u32::<f32> Unexecuted instantiation: sval::value::default_value::to_u32::<u8> Unexecuted instantiation: sval::value::default_value::to_u32::<i32> Unexecuted instantiation: sval::value::default_value::to_u32::<i128> Unexecuted instantiation: sval::value::default_value::to_u32::<u128> Unexecuted instantiation: sval::value::default_value::to_u32::<i16> Unexecuted instantiation: sval::value::default_value::to_u32::<u16> Unexecuted instantiation: sval::value::default_value::to_u32::<()> Unexecuted instantiation: sval::value::default_value::to_u32::<i64> Unexecuted instantiation: sval::value::default_value::to_u32::<u64> Unexecuted instantiation: sval::value::default_value::to_u32::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_u32::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_u32::<_> |
676 | | |
677 | | /** |
678 | | Try convert this value into an unsigned 64bit integer. |
679 | | */ |
680 | 0 | pub fn to_u64(value: &(impl Value + ?Sized)) -> Option<u64> { |
681 | 0 | value.to_u128().and_then(|value| value.try_into().ok()) Unexecuted instantiation: sval::value::default_value::to_u64::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<log::kv::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<i8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<bool>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<char>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<f64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<str>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<f32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<u8>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<i32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<u32>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<i128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<u128>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<i16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<u16>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<()>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<i64>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<sval_buffer::value::Value>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<sval::data::binary::BinarySlice>::{closure#0}Unexecuted instantiation: sval::value::default_value::to_u64::<_>::{closure#0} |
682 | 0 | } Unexecuted instantiation: sval::value::default_value::to_u64::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_u64::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_u64::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_u64::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_u64::<i8> Unexecuted instantiation: sval::value::default_value::to_u64::<bool> Unexecuted instantiation: sval::value::default_value::to_u64::<char> Unexecuted instantiation: sval::value::default_value::to_u64::<f64> Unexecuted instantiation: sval::value::default_value::to_u64::<str> Unexecuted instantiation: sval::value::default_value::to_u64::<f32> Unexecuted instantiation: sval::value::default_value::to_u64::<u8> Unexecuted instantiation: sval::value::default_value::to_u64::<i32> Unexecuted instantiation: sval::value::default_value::to_u64::<u32> Unexecuted instantiation: sval::value::default_value::to_u64::<i128> Unexecuted instantiation: sval::value::default_value::to_u64::<u128> Unexecuted instantiation: sval::value::default_value::to_u64::<i16> Unexecuted instantiation: sval::value::default_value::to_u64::<u16> Unexecuted instantiation: sval::value::default_value::to_u64::<()> Unexecuted instantiation: sval::value::default_value::to_u64::<i64> Unexecuted instantiation: sval::value::default_value::to_u64::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_u64::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_u64::<_> |
683 | | |
684 | | /** |
685 | | Try convert this value into an unsigned 128bit integer. |
686 | | */ |
687 | 0 | pub fn to_u128(value: &(impl Value + ?Sized)) -> Option<u128> { |
688 | | struct Extract(Option<u128>); |
689 | | |
690 | | impl<'sval> Stream<'sval> for Extract { |
691 | 0 | fn u128(&mut self, value: u128) -> Result { |
692 | 0 | self.0 = Some(value); |
693 | 0 | Ok(()) |
694 | 0 | } |
695 | | |
696 | 0 | fn null(&mut self) -> Result { |
697 | 0 | crate::error() |
698 | 0 | } |
699 | | |
700 | 0 | fn bool(&mut self, _: bool) -> Result { |
701 | 0 | crate::error() |
702 | 0 | } |
703 | | |
704 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
705 | 0 | crate::error() |
706 | 0 | } |
707 | | |
708 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
709 | 0 | crate::error() |
710 | 0 | } |
711 | | |
712 | 0 | fn text_end(&mut self) -> Result { |
713 | 0 | crate::error() |
714 | 0 | } |
715 | | |
716 | 0 | fn i64(&mut self, _: i64) -> Result { |
717 | 0 | crate::error() |
718 | 0 | } |
719 | | |
720 | 0 | fn f64(&mut self, _: f64) -> Result { |
721 | 0 | crate::error() |
722 | 0 | } |
723 | | |
724 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
725 | 0 | crate::error() |
726 | 0 | } |
727 | | |
728 | 0 | fn seq_value_begin(&mut self) -> Result { |
729 | 0 | crate::error() |
730 | 0 | } |
731 | | |
732 | 0 | fn seq_value_end(&mut self) -> Result { |
733 | 0 | crate::error() |
734 | 0 | } |
735 | | |
736 | 0 | fn seq_end(&mut self) -> Result { |
737 | 0 | crate::error() |
738 | 0 | } |
739 | | } |
740 | | |
741 | 0 | let mut extract = Extract(None); |
742 | 0 | value.stream(&mut extract).ok()?; |
743 | 0 | extract.0 |
744 | 0 | } Unexecuted instantiation: sval::value::default_value::to_u128::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_u128::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_u128::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_u128::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_u128::<i8> Unexecuted instantiation: sval::value::default_value::to_u128::<bool> Unexecuted instantiation: sval::value::default_value::to_u128::<char> Unexecuted instantiation: sval::value::default_value::to_u128::<f64> Unexecuted instantiation: sval::value::default_value::to_u128::<str> Unexecuted instantiation: sval::value::default_value::to_u128::<f32> Unexecuted instantiation: sval::value::default_value::to_u128::<u8> Unexecuted instantiation: sval::value::default_value::to_u128::<i32> Unexecuted instantiation: sval::value::default_value::to_u128::<u32> Unexecuted instantiation: sval::value::default_value::to_u128::<i128> Unexecuted instantiation: sval::value::default_value::to_u128::<i16> Unexecuted instantiation: sval::value::default_value::to_u128::<u16> Unexecuted instantiation: sval::value::default_value::to_u128::<()> Unexecuted instantiation: sval::value::default_value::to_u128::<i64> Unexecuted instantiation: sval::value::default_value::to_u128::<u64> Unexecuted instantiation: sval::value::default_value::to_u128::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_u128::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_u128::<_> |
745 | | |
746 | | /** |
747 | | Try convert this value into a text string. |
748 | | */ |
749 | 0 | pub fn to_text(value: &(impl Value + ?Sized)) -> Option<&str> { |
750 | | struct Extract<'sval> { |
751 | | extracted: Option<&'sval str>, |
752 | | seen_fragment: bool, |
753 | | } |
754 | | |
755 | | impl<'sval> Stream<'sval> for Extract<'sval> { |
756 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
757 | 0 | Ok(()) |
758 | 0 | } |
759 | | |
760 | 0 | fn text_fragment(&mut self, fragment: &'sval str) -> Result { |
761 | | // Allow either independent strings, or fragments of a single borrowed string |
762 | 0 | if !self.seen_fragment { |
763 | 0 | self.extracted = Some(fragment); |
764 | 0 | self.seen_fragment = true; |
765 | 0 | } else { |
766 | 0 | self.extracted = None; |
767 | 0 | } |
768 | | |
769 | 0 | Ok(()) |
770 | 0 | } |
771 | | |
772 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
773 | 0 | self.extracted = None; |
774 | 0 | self.seen_fragment = true; |
775 | | |
776 | 0 | crate::error() |
777 | 0 | } |
778 | | |
779 | 0 | fn text_end(&mut self) -> Result { |
780 | 0 | Ok(()) |
781 | 0 | } |
782 | | |
783 | 0 | fn null(&mut self) -> Result { |
784 | 0 | crate::error() |
785 | 0 | } |
786 | | |
787 | 0 | fn bool(&mut self, _: bool) -> Result { |
788 | 0 | crate::error() |
789 | 0 | } |
790 | | |
791 | 0 | fn i64(&mut self, _: i64) -> Result { |
792 | 0 | crate::error() |
793 | 0 | } |
794 | | |
795 | 0 | fn f64(&mut self, _: f64) -> Result { |
796 | 0 | crate::error() |
797 | 0 | } |
798 | | |
799 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
800 | 0 | crate::error() |
801 | 0 | } |
802 | | |
803 | 0 | fn seq_value_begin(&mut self) -> Result { |
804 | 0 | crate::error() |
805 | 0 | } |
806 | | |
807 | 0 | fn seq_value_end(&mut self) -> Result { |
808 | 0 | crate::error() |
809 | 0 | } |
810 | | |
811 | 0 | fn seq_end(&mut self) -> Result { |
812 | 0 | crate::error() |
813 | 0 | } |
814 | | } |
815 | | |
816 | 0 | let mut extract = Extract { |
817 | 0 | extracted: None, |
818 | 0 | seen_fragment: false, |
819 | 0 | }; |
820 | | |
821 | 0 | value.stream(&mut extract).ok()?; |
822 | 0 | extract.extracted |
823 | 0 | } Unexecuted instantiation: sval::value::default_value::to_text::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_text::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_text::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_text::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_text::<i8> Unexecuted instantiation: sval::value::default_value::to_text::<bool> Unexecuted instantiation: sval::value::default_value::to_text::<char> Unexecuted instantiation: sval::value::default_value::to_text::<f64> Unexecuted instantiation: sval::value::default_value::to_text::<f32> Unexecuted instantiation: sval::value::default_value::to_text::<u8> Unexecuted instantiation: sval::value::default_value::to_text::<i32> Unexecuted instantiation: sval::value::default_value::to_text::<u32> Unexecuted instantiation: sval::value::default_value::to_text::<i128> Unexecuted instantiation: sval::value::default_value::to_text::<u128> Unexecuted instantiation: sval::value::default_value::to_text::<i16> Unexecuted instantiation: sval::value::default_value::to_text::<u16> Unexecuted instantiation: sval::value::default_value::to_text::<()> Unexecuted instantiation: sval::value::default_value::to_text::<i64> Unexecuted instantiation: sval::value::default_value::to_text::<u64> Unexecuted instantiation: sval::value::default_value::to_text::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_text::<sval::data::binary::BinarySlice> Unexecuted instantiation: sval::value::default_value::to_text::<_> |
824 | | |
825 | | /** |
826 | | Try convert this value into a bitstring. |
827 | | */ |
828 | 0 | pub fn to_binary(value: &(impl Value + ?Sized)) -> Option<&[u8]> { |
829 | | struct Extract<'sval> { |
830 | | extracted: Option<&'sval [u8]>, |
831 | | seen_fragment: bool, |
832 | | } |
833 | | |
834 | | impl<'sval> Stream<'sval> for Extract<'sval> { |
835 | 0 | fn binary_begin(&mut self, _: Option<usize>) -> Result { |
836 | 0 | Ok(()) |
837 | 0 | } |
838 | | |
839 | 0 | fn binary_fragment(&mut self, fragment: &'sval [u8]) -> Result { |
840 | | // Allow either independent bytes, or fragments of a single borrowed byte stream |
841 | 0 | if !self.seen_fragment { |
842 | 0 | self.extracted = Some(fragment); |
843 | 0 | self.seen_fragment = true; |
844 | 0 | } else { |
845 | 0 | self.extracted = None; |
846 | 0 | } |
847 | | |
848 | 0 | Ok(()) |
849 | 0 | } |
850 | | |
851 | 0 | fn binary_fragment_computed(&mut self, _: &[u8]) -> Result { |
852 | 0 | self.extracted = None; |
853 | 0 | self.seen_fragment = true; |
854 | | |
855 | 0 | crate::error() |
856 | 0 | } |
857 | | |
858 | 0 | fn binary_end(&mut self) -> Result { |
859 | 0 | Ok(()) |
860 | 0 | } |
861 | | |
862 | 0 | fn null(&mut self) -> Result { |
863 | 0 | crate::error() |
864 | 0 | } |
865 | | |
866 | 0 | fn bool(&mut self, _: bool) -> Result { |
867 | 0 | crate::error() |
868 | 0 | } |
869 | | |
870 | 0 | fn text_begin(&mut self, _: Option<usize>) -> Result { |
871 | 0 | crate::error() |
872 | 0 | } |
873 | | |
874 | 0 | fn text_fragment_computed(&mut self, _: &str) -> Result { |
875 | 0 | crate::error() |
876 | 0 | } |
877 | | |
878 | 0 | fn text_end(&mut self) -> Result { |
879 | 0 | crate::error() |
880 | 0 | } |
881 | | |
882 | 0 | fn i64(&mut self, _: i64) -> Result { |
883 | 0 | crate::error() |
884 | 0 | } |
885 | | |
886 | 0 | fn f64(&mut self, _: f64) -> Result { |
887 | 0 | crate::error() |
888 | 0 | } |
889 | | |
890 | 0 | fn seq_begin(&mut self, _: Option<usize>) -> Result { |
891 | 0 | crate::error() |
892 | 0 | } |
893 | | |
894 | 0 | fn seq_value_begin(&mut self) -> Result { |
895 | 0 | crate::error() |
896 | 0 | } |
897 | | |
898 | 0 | fn seq_value_end(&mut self) -> Result { |
899 | 0 | crate::error() |
900 | 0 | } |
901 | | |
902 | 0 | fn seq_end(&mut self) -> Result { |
903 | 0 | crate::error() |
904 | 0 | } |
905 | | } |
906 | | |
907 | 0 | let mut extract = Extract { |
908 | 0 | extracted: None, |
909 | 0 | seen_fragment: false, |
910 | 0 | }; |
911 | | |
912 | 0 | value.stream(&mut extract).ok()?; |
913 | 0 | extract.extracted |
914 | 0 | } Unexecuted instantiation: sval::value::default_value::to_binary::<sval_fmt::to_value::DebugToValue<&dyn core::fmt::Debug>> Unexecuted instantiation: sval::value::default_value::to_binary::<sval_fmt::to_value::DisplayToValue<&dyn core::fmt::Display>> Unexecuted instantiation: sval::value::default_value::to_binary::<sval_serde::to_value::ToValue<&dyn erased_serde::ser::Serialize>> Unexecuted instantiation: sval::value::default_value::to_binary::<log::kv::value::Value> Unexecuted instantiation: sval::value::default_value::to_binary::<i8> Unexecuted instantiation: sval::value::default_value::to_binary::<bool> Unexecuted instantiation: sval::value::default_value::to_binary::<char> Unexecuted instantiation: sval::value::default_value::to_binary::<f64> Unexecuted instantiation: sval::value::default_value::to_binary::<str> Unexecuted instantiation: sval::value::default_value::to_binary::<f32> Unexecuted instantiation: sval::value::default_value::to_binary::<u8> Unexecuted instantiation: sval::value::default_value::to_binary::<i32> Unexecuted instantiation: sval::value::default_value::to_binary::<u32> Unexecuted instantiation: sval::value::default_value::to_binary::<i128> Unexecuted instantiation: sval::value::default_value::to_binary::<u128> Unexecuted instantiation: sval::value::default_value::to_binary::<i16> Unexecuted instantiation: sval::value::default_value::to_binary::<u16> Unexecuted instantiation: sval::value::default_value::to_binary::<()> Unexecuted instantiation: sval::value::default_value::to_binary::<i64> Unexecuted instantiation: sval::value::default_value::to_binary::<u64> Unexecuted instantiation: sval::value::default_value::to_binary::<sval_buffer::value::Value> Unexecuted instantiation: sval::value::default_value::to_binary::<_> |
915 | | } |