When building the crate root, serde/std gets enabled transitively
through our dev-dependency on trybuild. This is a Cargo bug but for now
work around it.
These rely on the caller to pass in a Write impl; the impls provided in
serde_json are only for Vec<u8> and I don't want to be in the business
of copying many more Write impls from std into serde_json.
There is no impl Into<Box<dyn serde:🇩🇪:StdError + Send + Sync>> for
&str in no_std mode, which was expected by code elsewhere in the crate.
error[E0277]: the trait bound `alloc::boxed::Box<(dyn serde:🇩🇪:StdError + core::marker::Send + core::marker::Sync + 'static)>: core::convert::From<&str>` is not satisfied
--> src/value/mod.rs:199:13
|
199 | io::Error::new(io::ErrorKind::Other, "fmt error")
| ^^^^^^^^^^^^^^ the trait `core::convert::From<&str>` is not implemented for `alloc::boxed::Box<(dyn serde:🇩🇪:StdError + core::marker::Send + core::marker::Sync + 'static)>`
|
::: src/io/core.rs:62:12
|
62 | pub fn new<E>(kind: ErrorKind, error: E) -> Error
| ---
63 | where
64 | E: Into<Box<dyn serde:🇩🇪:StdError + Send + Sync>>,
| ------------------------------------------------ required by this bound in `io:👿:Error::new`
|
= help: the following implementations were found:
<alloc::boxed::Box<T> as core::convert::From<T>>
<alloc::boxed::Box<[T]> as core::convert::From<&[T]>>
<alloc::boxed::Box<[T]> as core::convert::From<serde::export::Vec<T>>>
<alloc::boxed::Box<[u8]> as core::convert::From<alloc::boxed::Box<str>>>
and 2 others
= note: required because of the requirements on the impl of `core::convert::Into<alloc::boxed::Box<(dyn serde:🇩🇪:StdError + core::marker::Send + core::marker::Sync + 'static)>>` for `&str`
Inlining this simple, already `core`-compatible function is better than
noisily repeating the same definition that does exactly the same, albeit
hidden behind a fn call.