Skip to content

Commit

Permalink
chore: update documentation of DynType
Browse files Browse the repository at this point in the history
  • Loading branch information
audunhalland committed Mar 15, 2024
1 parent d685014 commit 61417ed
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions juniper/src/schema/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ pub enum DirectiveLocation {

/// Allows seeing [Type] with different name/string representations
/// as the same type without allocating.
///
/// TODO: Ideally this type should not exist, but the reason it currently does
/// is that [Type] is fully recursive, but recursive type references cannot really exist in GraphQL.
/// (only one level of list-wrapping is allowed).
/// If [Type] got properly "flattened" it would be easy to cheaply project a [Type<ArcStr>] as a [Type<&str>].
//
// TODO: Ideally this type should not exist, but the reason it currently does
// is that [Type] has a recursive design to allow arbitrary number of list wrappings.
// The list layout could instead be modelled as a modifier so that type becomes a tuple of (name, modifier).
//
// If [Type] is modelled like this it becomes easier to project it as a borrowed version of itself,
// i.e. [Type<ArcStr>] vs [Type<&str>].
#[derive(Clone, Copy, Debug)]
pub enum DynType<'a> {
Named(&'a str),
Expand Down

0 comments on commit 61417ed

Please sign in to comment.