Slightly abstract away map/set types

This commit is contained in:
Graham Esau 2019-08-08 18:43:15 +01:00
parent 998e6c9f0f
commit 8afce08c54
5 changed files with 10 additions and 12 deletions

View file

@ -1,7 +1,6 @@
use crate::make_schema::MakeSchema;
use crate::schema::*;
use crate::{MakeSchemaError, Result};
use std::collections::BTreeMap as Map;
use crate::{MakeSchemaError, Map, Result};
#[derive(Debug, PartialEq, Clone)]
pub struct SchemaSettings {

View file

@ -1,13 +1,15 @@
pub type Map<K, V> = std::collections::BTreeMap<K, V>;
pub type Set<T> = std::collections::BTreeSet<T>;
pub mod gen;
pub mod make_schema;
pub mod schema;
mod error;
mod make_schema;
#[macro_use]
mod macros;
pub use error::*;
pub use make_schema::MakeSchema;
pub use schemars_derive::*;

View file

@ -1,8 +1,7 @@
use crate::gen::{BoolSchemas, SchemaGenerator};
use crate::schema::*;
use crate::Result;
use crate::{Map, Result};
use serde_json::json;
use std::collections::BTreeMap as Map;
pub trait MakeSchema {
fn is_referenceable() -> bool {

View file

@ -1,9 +1,7 @@
use crate as schemars;
use crate::{MakeSchema, MakeSchemaError, Result};
use crate::{MakeSchema, MakeSchemaError, Map, Result, Set};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::BTreeMap as Map;
use std::collections::BTreeSet as Set;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, MakeSchema)]
#[serde(untagged)]