|
1 | | -use std::convert::TryInto; |
2 | 1 | use std::fmt; |
3 | | -use std::fmt::Formatter; |
4 | 2 | use std::marker::PhantomData; |
5 | 3 |
|
6 | 4 | use bytes::{Buf, BufMut}; |
| 5 | +#[cfg(feature = "serde")] |
7 | 6 | use serde::de::{Error, Visitor}; |
8 | 7 |
|
9 | 8 | use crate::wire_format::WireFormat; |
@@ -84,7 +83,7 @@ impl<'de, E> serde::Deserialize<'de> for SbpString<Vec<u8>, E> { |
84 | 83 | impl<'de, E> Visitor<'de> for SbpStringVisitor<E> { |
85 | 84 | type Value = SbpString<Vec<u8>, E>; |
86 | 85 |
|
87 | | - fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { |
| 86 | + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
88 | 87 | formatter.write_str("string") |
89 | 88 | } |
90 | 89 |
|
@@ -126,12 +125,14 @@ impl<'de, E, const LEN: usize> serde::Deserialize<'de> for SbpString<[u8; LEN], |
126 | 125 | where |
127 | 126 | D: serde::Deserializer<'de>, |
128 | 127 | { |
| 128 | + use std::convert::TryInto; |
| 129 | + |
129 | 130 | struct SbpStringVisitor<E, const LEN: usize>(PhantomData<SbpString<[u8; LEN], E>>); |
130 | 131 |
|
131 | 132 | impl<'de, E, const LEN: usize> Visitor<'de> for SbpStringVisitor<E, LEN> { |
132 | 133 | type Value = SbpString<[u8; LEN], E>; |
133 | 134 |
|
134 | | - fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { |
| 135 | + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
135 | 136 | formatter.write_str("string") |
136 | 137 | } |
137 | 138 |
|
|
0 commit comments