909 Commits

Author SHA1 Message Date
Igor Matuszewski
b855996096
Correct no-std support in README.md 2020-01-23 00:29:16 +01:00
David Tolnay
4bcc3625c3
Adopt dyn syntax for trait objects 2020-01-22 14:07:17 -08:00
David Tolnay
50faa3c000
Adopt inclusive range syntax 2020-01-22 14:06:03 -08:00
David Tolnay
17824dc1ea
Remove error variants that are never constructed 2020-01-22 14:04:18 -08:00
David Tolnay
7cf0156d47
Switch to tool attrs 2020-01-22 14:03:12 -08:00
David Tolnay
97f87f2587
Adopt pub(crate) 2020-01-22 13:59:08 -08:00
David Tolnay
17d9a5ea9b
Organize imports 2020-01-22 13:53:35 -08:00
David Tolnay
3040daa1c6
Update tests to 2018 edition 2020-01-22 13:45:47 -08:00
David Tolnay
c19f26a518
Update serde_json_test to 2018 edition 2020-01-22 13:43:34 -08:00
David Tolnay
d095bab515
Remove ```edition2018 from doc tests after edition update 2020-01-22 13:42:51 -08:00
David Tolnay
70b64fd657
Update to 2018 edition 2020-01-22 13:41:21 -08:00
David Tolnay
873a7e9574
Rename try! macro to avoid 2018 edition keyword 2020-01-22 13:34:37 -08:00
David Tolnay
a79024468c
Raise minimum supported rustc to 1.31 2020-01-22 13:02:04 -08:00
David Tolnay
f20ca3b054
Really disable serde std feature in CI
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.
2020-01-22 12:59:10 -08:00
David Tolnay
ab4ca99fcb
Omit to_writer and Serializer in no_std mode
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.
2020-01-22 12:59:10 -08:00
David Tolnay
0de7b516f5
Remove Read and Bytes
These are unused in no-std mode; the Read trait had no implementations.
2020-01-22 12:59:10 -08:00
David Tolnay
1f616f081a
Omit from_reader in no_std mode 2020-01-22 12:59:10 -08:00
David Tolnay
7b0b96e6ab
Remove more of core io error 2020-01-22 12:59:09 -08:00
David Tolnay
7f41cbe201
Remove unneeded Debug impl on io error
Io errors can never occur in no_std mode.
2020-01-22 12:59:09 -08:00
David Tolnay
7051b992e0
Remove WriteZero error kind 2020-01-22 12:59:09 -08:00
David Tolnay
def04dedc1
Remove source method in no_std mode
An io error can never occur in no_std mode so the source method is never
applicable.
2020-01-22 12:59:09 -08:00
David Tolnay
cf3beee3d2
Remove unneeded itoa std feature
This feature is not used by serde_json even in std mode.
2020-01-22 12:59:09 -08:00
David Tolnay
67857df516
Remove unnecessary box trait object from io error repr 2020-01-22 12:59:09 -08:00
David Tolnay
e83673adea
Remove unnecessary From<Error> for io::Error in no_std mode 2020-01-22 12:59:09 -08:00
David Tolnay
85008aa29c
Preserve underlying Debug representation for io error 2020-01-22 12:59:09 -08:00
David Tolnay
ab661bb29c
Remove unused ErrorKind from io error repr 2020-01-22 12:59:08 -08:00
David Tolnay
5741cfb44a
Remove unused Simple io error variant 2020-01-22 12:59:08 -08:00
David Tolnay
f063631c0a
Remove reliance on serde StdError for io error repr
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`
2020-01-22 12:59:08 -08:00
David Tolnay
541d8a1de7
De Morgan the features check 2020-01-22 12:59:08 -08:00
David Tolnay
d57dffb3e8
Remove a layer of reexports from io facade 2020-01-22 12:59:08 -08:00
David Tolnay
ea39ccb88a
Mirror serde_json features to serde_json_test crate 2020-01-22 12:59:08 -08:00
David Tolnay
83e35ec22a
Tweak feature check message 2020-01-22 12:59:08 -08:00
David Tolnay
91f791bd1c
Merge pull request #606 from Xanewok/no-std-patch
Add a no_std/alloc feature
2020-01-22 12:58:53 -08:00
Igor Matuszewski
8e8058a491 Move the core::io implementation to separate module 2020-01-21 21:43:46 +01:00
Igor Matuszewski
3b03040cf0 Make io a subset of std::io
So that when implementing a no-`std` logic we don't break the build when
some other dependency opts into `std` (causing API mismatch).
2020-01-21 21:43:46 +01:00
Igor Matuszewski
bac77ed0ff Imply using alloc crate when std is not enabled 2020-01-21 21:43:46 +01:00
Igor Matuszewski
7852d2f1e6 Add user-friendly error when no alloc or std feature are enabled 2020-01-21 21:43:46 +01:00
Igor Matuszewski
176ff712f8 Inline the itoa::write calls
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.
2020-01-21 21:43:46 +01:00
Igor Matuszewski
d7f7a51c72 travis: Test no_std/alloc on 1.36.0 2020-01-21 21:43:46 +01:00
Igor Matuszewski
b47d2d1aec Mention availability of alloc feature 2020-01-21 21:43:46 +01:00
Igor Matuszewski
15bfaf6a07 Reorganize std::io facade 2020-01-21 21:43:46 +01:00
Igor Matuszewski
9ecf91504a Add facade around std/alloc/core like serde does 2020-01-21 21:43:38 +01:00
Tom Dohrmann
65336702c3 Fix std feature dependency for itoa 2020-01-21 15:52:16 +01:00
freax13
4600a9af7f add alloc/no_std support 2020-01-21 15:52:16 +01:00
David Tolnay
88ee1a69da
Ignore transmute_ptr_to_ptr lint
`mem::transmute::<&str, &RawValue>(json)` is more readable and safer
than Clippy's suggestion of `&*(json as *const str as *const RawValue)`.
2020-01-20 21:03:51 -08:00
David Tolnay
57bc9ae77b
Resolve redundant_static_lifetimes lint
This has been supported in rustc since 1.17.
https://blog.rust-lang.org/2017/04/27/Rust-1.17.html
2020-01-20 20:43:47 -08:00
David Tolnay
b6119e4c1e
Merge pull request #600 from deankarn/master
Add append to Map
2020-01-20 20:28:09 -08:00
David Tolnay
6434761d77
Merge pull request #605 from Xanewok/patch-1
Update MSRV to 1.30 in README.md
2020-01-20 14:30:26 -08:00
Igor Matuszewski
bbfdaf04cf
Update MSRV to 1.30 in README.md
As it seems to be the case as of latest commit (4b8380261b)
2020-01-20 20:12:04 +01:00
Dean Karn
5930359ec1 Make compatible with older veersions of rust
reworked to use std::mem::replace instead of std::mem::take which was
introduced in v1.40.0 which is just a wrapper for replace.
2020-01-07 09:00:14 -08:00