-
-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Extract serde_core out of serde crate #2608
Open
osiewicz
wants to merge
4
commits into
serde-rs:master
Choose a base branch
from
osiewicz:extract_serde_core
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"serde", | ||
"serde_core", | ||
"serde_derive", | ||
"serde_derive_internals", | ||
"test_suite", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,8 +92,6 @@ | |
//! [Hjson]: https://github.com/Canop/deser-hjson | ||
//! [CSV]: https://docs.rs/csv | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
// Serde types in rustdoc of other crates get linked to here. | ||
#![doc(html_root_url = "https://docs.rs/serde/1.0.204")] | ||
// Support using Serde without the standard library! | ||
|
@@ -157,13 +155,27 @@ | |
#![deny(missing_docs, unused_imports)] | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
#[doc(inline)] | ||
pub use serde_core::*; | ||
// Used by generated code and doc tests. Not public API. | ||
#[doc(hidden)] | ||
#[path = "private/mod.rs"] | ||
pub mod __private; | ||
|
||
// Re-export #[derive(Serialize, Deserialize)]. | ||
// | ||
// The reason re-exporting is not enabled by default is that disabling it would | ||
// be annoying for crates that provide handwritten impls or data formats. They | ||
// would need to disable default features and then explicitly re-enable std. | ||
#[cfg(feature = "serde_derive")] | ||
extern crate serde_derive; | ||
|
||
/// Derive macro available if serde is built with `features = ["derive"]`. | ||
#[cfg(feature = "serde_derive")] | ||
#[cfg_attr(docsrs, doc(cfg(feature = "derive")))] | ||
pub use serde_derive::{Deserialize, Serialize}; | ||
#[cfg(feature = "alloc")] | ||
extern crate alloc; | ||
|
||
/// A facade around all the types we need from the `std`, `core`, and `alloc` | ||
/// crates. This avoids elaborate import wrangling having to happen in every | ||
/// module. | ||
mod lib { | ||
mod core { | ||
#[cfg(not(feature = "std"))] | ||
|
@@ -173,30 +185,25 @@ mod lib { | |
} | ||
|
||
pub use self::core::{f32, f64}; | ||
pub use self::core::{i16, i32, i64, i8, isize}; | ||
pub use self::core::{iter, num, ptr, str}; | ||
pub use self::core::{i16, i32, i64, i8}; | ||
pub use self::core::{ptr, str}; | ||
pub use self::core::{u16, u32, u64, u8, usize}; | ||
|
||
#[cfg(any(feature = "std", feature = "alloc"))] | ||
pub use self::core::{cmp, mem, slice}; | ||
pub use self::core::slice; | ||
|
||
pub use self::core::cell::{Cell, RefCell}; | ||
pub use self::core::clone; | ||
pub use self::core::cmp::Reverse; | ||
pub use self::core::convert; | ||
pub use self::core::default; | ||
pub use self::core::fmt::{self, Debug, Display, Write as FmtWrite}; | ||
pub use self::core::marker::{self, PhantomData}; | ||
pub use self::core::num::Wrapping; | ||
pub use self::core::ops::{Bound, Range, RangeFrom, RangeInclusive, RangeTo}; | ||
pub use self::core::option; | ||
pub use self::core::result; | ||
pub use self::core::time::Duration; | ||
|
||
#[cfg(all(feature = "alloc", not(feature = "std")))] | ||
pub use alloc::borrow::{Cow, ToOwned}; | ||
#[cfg(feature = "std")] | ||
pub use std::borrow::{Cow, ToOwned}; | ||
pub use std::borrow::Cow; | ||
|
||
#[cfg(all(feature = "alloc", not(feature = "std")))] | ||
pub use alloc::string::{String, ToString}; | ||
|
@@ -213,48 +220,11 @@ mod lib { | |
#[cfg(feature = "std")] | ||
pub use std::boxed::Box; | ||
|
||
#[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))] | ||
pub use alloc::rc::{Rc, Weak as RcWeak}; | ||
#[cfg(all(feature = "rc", feature = "std"))] | ||
pub use std::rc::{Rc, Weak as RcWeak}; | ||
|
||
#[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))] | ||
pub use alloc::sync::{Arc, Weak as ArcWeak}; | ||
#[cfg(all(feature = "rc", feature = "std"))] | ||
pub use std::sync::{Arc, Weak as ArcWeak}; | ||
|
||
#[cfg(all(feature = "alloc", not(feature = "std")))] | ||
pub use alloc::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque}; | ||
#[cfg(feature = "std")] | ||
pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque}; | ||
|
||
#[cfg(all(not(no_core_cstr), not(feature = "std")))] | ||
pub use self::core::ffi::CStr; | ||
#[cfg(feature = "std")] | ||
pub use std::ffi::CStr; | ||
|
||
#[cfg(all(not(no_core_cstr), feature = "alloc", not(feature = "std")))] | ||
pub use alloc::ffi::CString; | ||
#[cfg(feature = "std")] | ||
pub use std::ffi::CString; | ||
pub use std::error; | ||
|
||
#[cfg(feature = "std")] | ||
pub use std::{error, net}; | ||
|
||
#[cfg(feature = "std")] | ||
pub use std::collections::{HashMap, HashSet}; | ||
#[cfg(feature = "std")] | ||
pub use std::ffi::{OsStr, OsString}; | ||
#[cfg(feature = "std")] | ||
pub use std::hash::{BuildHasher, Hash}; | ||
#[cfg(feature = "std")] | ||
pub use std::io::Write; | ||
#[cfg(feature = "std")] | ||
pub use std::path::{Path, PathBuf}; | ||
#[cfg(feature = "std")] | ||
pub use std::sync::{Mutex, RwLock}; | ||
#[cfg(feature = "std")] | ||
pub use std::time::{SystemTime, UNIX_EPOCH}; | ||
|
||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))] | ||
pub use std::sync::atomic::{ | ||
|
@@ -263,28 +233,14 @@ mod lib { | |
}; | ||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these imports still here, but not the ones with some of the cfgs disabled? |
||
pub use std::sync::atomic::{AtomicI64, AtomicU64}; | ||
|
||
#[cfg(all(feature = "std", not(no_target_has_atomic)))] | ||
pub use std::sync::atomic::Ordering; | ||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "8"))] | ||
pub use std::sync::atomic::{AtomicBool, AtomicI8, AtomicU8}; | ||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "16"))] | ||
pub use std::sync::atomic::{AtomicI16, AtomicU16}; | ||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "32"))] | ||
pub use std::sync::atomic::{AtomicI32, AtomicU32}; | ||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "64"))] | ||
pub use std::sync::atomic::{AtomicI64, AtomicU64}; | ||
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "ptr"))] | ||
pub use std::sync::atomic::{AtomicIsize, AtomicUsize}; | ||
|
||
#[cfg(not(no_core_num_saturating))] | ||
pub use self::core::num::Saturating; | ||
} | ||
|
||
// None of this crate's error handling needs the `From::from` error conversion | ||
// performed implicitly by the `?` operator or the standard library's `try!` | ||
// macro. This simplified macro gives a 5.5% improvement in compile time | ||
// compared to standard `try!`, and 9% improvement compared to `?`. | ||
#[doc(hidden)] | ||
#[macro_export] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this exported? |
||
macro_rules! tri { | ||
($expr:expr) => { | ||
match $expr { | ||
|
@@ -293,48 +249,3 @@ macro_rules! tri { | |
} | ||
}; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#[macro_use] | ||
mod macros; | ||
|
||
#[macro_use] | ||
mod integer128; | ||
|
||
pub mod de; | ||
pub mod ser; | ||
|
||
#[doc(inline)] | ||
pub use crate::de::{Deserialize, Deserializer}; | ||
#[doc(inline)] | ||
pub use crate::ser::{Serialize, Serializer}; | ||
|
||
// Used by generated code and doc tests. Not public API. | ||
#[doc(hidden)] | ||
#[path = "private/mod.rs"] | ||
pub mod __private; | ||
|
||
#[path = "de/seed.rs"] | ||
mod seed; | ||
|
||
#[cfg(not(any(feature = "std", feature = "unstable")))] | ||
mod std_error; | ||
|
||
// Re-export #[derive(Serialize, Deserialize)]. | ||
// | ||
// The reason re-exporting is not enabled by default is that disabling it would | ||
// be annoying for crates that provide handwritten impls or data formats. They | ||
// would need to disable default features and then explicitly re-enable std. | ||
#[cfg(feature = "serde_derive")] | ||
extern crate serde_derive; | ||
|
||
/// Derive macro available if serde is built with `features = ["derive"]`. | ||
#[cfg(feature = "serde_derive")] | ||
#[cfg_attr(docsrs, doc(cfg(feature = "derive")))] | ||
pub use serde_derive::{Deserialize, Serialize}; | ||
|
||
#[cfg(all(not(no_serde_derive), any(feature = "std", feature = "alloc")))] | ||
mod actually_private { | ||
pub struct T; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a rebase artifact? I think we switched to
docsrs
, so we don't need to explicitly set this anymore (same for serde_core)