v0.8.0-alpha-3

This commit is contained in:
Graham Esau 2020-06-12 20:43:16 +01:00
parent 260cd99293
commit ca7c66eb08
4 changed files with 15 additions and 6 deletions

View file

@ -3,7 +3,7 @@ name = "schemars"
description = "Generate JSON Schemas from Rust code"
homepage = "https://graham.cool/schemars/"
repository = "https://github.com/GREsau/schemars"
version = "0.8.0-alpha-2"
version = "0.8.0-alpha-3"
authors = ["Graham Esau <gesau@hotmail.co.uk>"]
edition = "2018"
license = "MIT"
@ -13,7 +13,7 @@ categories = ["encoding"]
build = "build.rs"
[dependencies]
schemars_derive = { version = "=0.8.0-alpha-2", optional = true, path = "../schemars_derive" }
schemars_derive = { version = "=0.8.0-alpha-3", optional = true, path = "../schemars_derive" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
dyn-clone = "1.0"

View file

@ -212,12 +212,18 @@ impl SchemaGenerator {
&self.definitions
}
/// Consumes `self` and returns the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated.
/// Returns the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated,
/// leaving an empty map in its place.
///
/// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// themselves.
pub fn into_definitions(self) -> Map<String, Schema> {
self.definitions
pub fn take_definitions(&mut self) -> Map<String, Schema> {
std::mem::replace(&mut self.definitions, Map::default())
}
/// Returns an iterator over the [visitors](SchemaSettings::visitors) being used by this `SchemaGenerator`.
pub fn visitors_mut(&mut self) -> impl Iterator<Item = &mut dyn Visitor2> {
self.settings.visitors.iter_mut().map(|v| v.as_mut())
}
/// Generates a root JSON Schema for the type `T`.