-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serialize::per_type, ffi::yyjson and other reorganization
- Loading branch information
Showing
30 changed files
with
192 additions
and
152 deletions.
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
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 was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
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,23 +1,9 @@ | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
mod dataclass; | ||
mod datetime; | ||
#[macro_use] | ||
mod datetimelike; | ||
mod default; | ||
mod dict; | ||
mod error; | ||
mod float; | ||
mod fragment; | ||
mod int; | ||
mod json; | ||
mod list; | ||
mod numpy; | ||
mod pyenum; | ||
mod per_type; | ||
mod serializer; | ||
mod str; | ||
mod tuple; | ||
mod uuid; | ||
mod writer; | ||
|
||
pub use serializer::serialize; |
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
src/serialize/datetime.rs → src/serialize/per_type/datetime.rs
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
mod dataclass; | ||
mod datetime; | ||
mod pybool; | ||
#[macro_use] | ||
mod datetimelike; | ||
mod default; | ||
mod dict; | ||
mod float; | ||
mod fragment; | ||
mod int; | ||
mod list; | ||
mod none; | ||
mod numpy; | ||
mod pyenum; | ||
mod tuple; | ||
mod unicode; | ||
mod uuid; | ||
|
||
pub use dataclass::DataclassGenericSerializer; | ||
pub use datetime::{Date, DateTime, Time}; | ||
pub use default::DefaultSerializer; | ||
pub use dict::DictGenericSerializer; | ||
pub use float::FloatSerializer; | ||
pub use fragment::FragmentSerializer; | ||
pub use int::{Int53Serializer, IntSerializer}; | ||
pub use list::ListSerializer; | ||
pub use none::NoneSerializer; | ||
pub use numpy::{is_numpy_array, is_numpy_scalar, NumpyScalar, NumpySerializer}; | ||
pub use pybool::BoolSerializer; | ||
pub use pyenum::EnumSerializer; | ||
pub use tuple::TupleSerializer; | ||
pub use unicode::{StrSerializer, StrSubclassSerializer}; | ||
pub use uuid::UUID; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
use serde::ser::{Serialize, Serializer}; | ||
|
||
pub struct NoneSerializer; | ||
|
||
impl NoneSerializer { | ||
pub fn new() -> Self { | ||
NoneSerializer {} | ||
} | ||
} | ||
|
||
impl Serialize for NoneSerializer { | ||
#[inline] | ||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
serializer.serialize_unit() | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
use serde::ser::{Serialize, Serializer}; | ||
|
||
#[repr(transparent)] | ||
pub struct BoolSerializer { | ||
ptr: *mut pyo3_ffi::PyObject, | ||
} | ||
|
||
impl BoolSerializer { | ||
pub fn new(ptr: *mut pyo3_ffi::PyObject) -> Self { | ||
BoolSerializer { ptr: ptr } | ||
} | ||
} | ||
|
||
impl Serialize for BoolSerializer { | ||
#[inline] | ||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
serializer.serialize_bool(unsafe { self.ptr == crate::typeref::TRUE }) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.