Bootstrap, vol.1
This commit is contained in:
parent
30d80dff12
commit
56a68a9e24
4 changed files with 51 additions and 4 deletions
1
juniper/src/graphql/mod.rs
Normal file
1
juniper/src/graphql/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod resolve;
|
33
juniper/src/graphql/resolve.rs
Normal file
33
juniper/src/graphql/resolve.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use crate::{executor::Registry, resolve, schema::meta::MetaType, DefaultScalarValue};
|
||||
|
||||
pub trait TypeName {
|
||||
fn type_name<Info: ?Sized>(info: &Info) -> &str
|
||||
where
|
||||
Self: resolve::TypeName<Info>;
|
||||
}
|
||||
|
||||
impl<T: ?Sized> TypeName for T {
|
||||
fn type_name<Info: ?Sized>(info: &Info) -> &str
|
||||
where
|
||||
Self: resolve::TypeName<Info>,
|
||||
{
|
||||
<Self as resolve::TypeName<Info>>::type_name(info)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Type<S = DefaultScalarValue> {
|
||||
fn meta<'r, Info: ?Sized>(info: &Info, registry: &mut Registry<'r, S>) -> MetaType<'r, S>
|
||||
where
|
||||
S: 'r,
|
||||
Self: resolve::Type<Info, S>;
|
||||
}
|
||||
|
||||
impl<T: ?Sized, S> Type<S> for T {
|
||||
fn meta<'r, Info: ?Sized>(info: &Info, registry: &mut Registry<'r, S>) -> MetaType<'r, S>
|
||||
where
|
||||
S: 'r,
|
||||
Self: resolve::Type<Info, S>,
|
||||
{
|
||||
<Self as resolve::Type<Info, S>>::meta(info, registry)
|
||||
}
|
||||
}
|
|
@ -28,19 +28,20 @@ pub use juniper_codegen::{
|
|||
#[doc(hidden)]
|
||||
#[macro_use]
|
||||
pub mod macros;
|
||||
|
||||
mod ast;
|
||||
pub mod executor;
|
||||
pub mod graphql;
|
||||
pub mod http;
|
||||
pub mod integrations;
|
||||
mod introspection;
|
||||
pub mod parser;
|
||||
pub mod resolve;
|
||||
pub(crate) mod schema;
|
||||
mod types;
|
||||
mod util;
|
||||
pub mod validation;
|
||||
mod value;
|
||||
// This needs to be public until docs have support for private modules:
|
||||
// https://github.com/rust-lang/cargo/issues/1520
|
||||
pub mod http;
|
||||
pub mod integrations;
|
||||
|
||||
#[cfg(all(test, not(feature = "expose-test-schema")))]
|
||||
mod tests;
|
||||
|
|
12
juniper/src/resolve/mod.rs
Normal file
12
juniper/src/resolve/mod.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use crate::{executor::Registry, schema::meta::MetaType, DefaultScalarValue, ScalarValue};
|
||||
|
||||
pub trait TypeName<Info: ?Sized> {
|
||||
fn type_name(info: &Info) -> &str;
|
||||
}
|
||||
|
||||
pub trait Type<Info: ?Sized, S = DefaultScalarValue> {
|
||||
fn meta<'r>(info: &Info, registry: &mut Registry<'r, S>) -> MetaType<'r, S>
|
||||
where
|
||||
S: 'r;
|
||||
}
|
||||
|
Loading…
Reference in a new issue