mirror of
https://github.com/serde-rs/json.git
synced 2025-10-02 23:35:59 +00:00
Fix json! invocations when std prelude is not in scope
This commit is contained in:
parent
611b2a4fb6
commit
6827c7b3c5
@ -373,6 +373,12 @@ extern crate alloc;
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
extern crate std;
|
extern crate std;
|
||||||
|
|
||||||
|
// Not public API. Used from macro-generated code.
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub mod __private {
|
||||||
|
pub use alloc::vec;
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
|
@ -77,12 +77,12 @@ macro_rules! json_internal {
|
|||||||
|
|
||||||
// Done with trailing comma.
|
// Done with trailing comma.
|
||||||
(@array [$($elems:expr,)*]) => {
|
(@array [$($elems:expr,)*]) => {
|
||||||
vec![$($elems,)*]
|
$crate::__private::vec![$($elems,)*]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Done without trailing comma.
|
// Done without trailing comma.
|
||||||
(@array [$($elems:expr),*]) => {
|
(@array [$($elems:expr),*]) => {
|
||||||
vec![$($elems),*]
|
$crate::__private::vec![$($elems),*]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Next element is `null`.
|
// Next element is `null`.
|
||||||
@ -254,7 +254,7 @@ macro_rules! json_internal {
|
|||||||
};
|
};
|
||||||
|
|
||||||
([]) => {
|
([]) => {
|
||||||
$crate::Value::Array(vec![])
|
$crate::Value::Array($crate::__private::vec![])
|
||||||
};
|
};
|
||||||
|
|
||||||
([ $($tt:tt)+ ]) => {
|
([ $($tt:tt)+ ]) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user