-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move json_type_def to separate module
- Loading branch information
Semyon Uchvatov
committed
Dec 13, 2024
1 parent
2f37d18
commit dd269f4
Showing
6 changed files
with
84 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::prelude::{Collection, TypeDef}; | ||
use crate::value::Kind; | ||
|
||
pub(crate) fn json_inner_kind() -> Kind { | ||
Kind::null() | ||
| Kind::bytes() | ||
| Kind::integer() | ||
| Kind::float() | ||
| Kind::boolean() | ||
| Kind::array(Collection::any()) | ||
| Kind::object(Collection::any()) | ||
} | ||
|
||
pub(crate) fn json_type_def() -> TypeDef { | ||
TypeDef::bytes() | ||
.fallible() | ||
.or_boolean() | ||
.or_integer() | ||
.or_float() | ||
.add_null() | ||
.or_null() | ||
.or_array(Collection::from_unknown(json_inner_kind())) | ||
.or_object(Collection::from_unknown(json_inner_kind())) | ||
} |
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 @@ | ||
pub(crate) mod json_type_def; |
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