juniper/juniper/struct.Registry.html
Juniper Documentation Builder ce3b848fd1 Update documentation for Juniper
2016-09-20 20:39:01 +00:00

162 lines
No EOL
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Registry` struct in crate `juniper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Registry">
<title>juniper::Registry - Rust</title>
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='index.html'>juniper</a></p><script>window.sidebarCurrent = {name: 'Registry', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content struct">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>juniper</a>::<wbr><a class='struct' href=''>Registry</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a id='src-5598' class='srclink' href='../src/juniper/src/executor.rs.html#21-25' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Registry&lt;CtxT&gt; {
pub types: <a class='struct' href='https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html' title='std::collections::hash::map::HashMap'>HashMap</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>,&nbsp;<a class='enum' href='../juniper/meta/enum.MetaType.html' title='juniper::meta::MetaType'>MetaType</a>&gt;,
// some fields omitted
}</pre><div class='docblock'><p>A type registry used to build schemas</p>
<p>The registry gathers metadata for all types in a schema. It provides
convenience methods to convert types implementing the <code>GraphQLType</code> trait
into <code>Type</code> instances and automatically registers them.</p>
</div><h2 class='fields'>Fields</h2><span id='structfield.types' class='structfield'><code>types: <a class='struct' href='https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html' title='std::collections::hash::map::HashMap'>HashMap</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>,&nbsp;<a class='enum' href='../juniper/meta/enum.MetaType.html' title='juniper::meta::MetaType'>MetaType</a>&gt;</code>
</span><span class='stab '></span><div class='docblock'><p>Currently registered types</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl&lt;CtxT&gt; <a class='struct' href='../juniper/struct.Registry.html' title='juniper::Registry'>Registry</a>&lt;CtxT&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a id='src-5814' class='srclink' href='../src/juniper/src/executor.rs.html#258-421' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(types: <a class='struct' href='https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html' title='std::collections::hash::map::HashMap'>HashMap</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>,&nbsp;<a class='enum' href='../juniper/meta/enum.MetaType.html' title='juniper::meta::MetaType'>MetaType</a>&gt;) -&gt; <a class='struct' href='../juniper/struct.Registry.html' title='juniper::Registry'>Registry</a>&lt;CtxT&gt;</code></h4>
<div class='docblock'><p>Construct a new registry</p>
</div><h4 id='method.get_type' class='method'><code>fn <a href='#method.get_type' class='fnname'>get_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='enum' href='../juniper/enum.Type.html' title='juniper::Type'>Type</a> <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Get the <code>Type</code> instance for a given GraphQL type</p>
<p>If the registry hasn&#39;t seen a type with this name before, it will
construct its metadata and store it.</p>
</div><h4 id='method.field' class='method'><code>fn <a href='#method.field' class='fnname'>field</a>&lt;T&gt;(&amp;mut self, name: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../juniper/meta/struct.Field.html' title='juniper::meta::Field'>Field</a> <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create a field with the provided name</p>
</div><h4 id='method.arg' class='method'><code>fn <a href='#method.arg' class='fnname'>arg</a>&lt;T&gt;(&amp;mut self, name: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../juniper/meta/struct.Argument.html' title='juniper::meta::Argument'>Argument</a> <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt; + <a class='trait' href='../juniper/trait.FromInputValue.html' title='juniper::FromInputValue'>FromInputValue</a></span></code></h4>
<div class='docblock'><p>Create an argument with the provided name</p>
</div><h4 id='method.arg_with_default' class='method'><code>fn <a href='#method.arg_with_default' class='fnname'>arg_with_default</a>&lt;T&gt;(&amp;mut self, name: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, value: &amp;T) -&gt; <a class='struct' href='../juniper/meta/struct.Argument.html' title='juniper::meta::Argument'>Argument</a> <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt; + <a class='trait' href='../juniper/trait.ToInputValue.html' title='juniper::ToInputValue'>ToInputValue</a> + <a class='trait' href='../juniper/trait.FromInputValue.html' title='juniper::FromInputValue'>FromInputValue</a></span></code></h4>
<div class='docblock'><p>Create an argument with a default value</p>
<p>When called with type <code>T</code>, the actual argument will be given the type
<code>Option&lt;T&gt;</code>.</p>
</div><h4 id='method.build_scalar_type' class='method'><code>fn <a href='#method.build_scalar_type' class='fnname'>build_scalar_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='struct' href='../juniper/meta/struct.ScalarMeta.html' title='juniper::meta::ScalarMeta'>ScalarMeta</a> <span class='where'>where T: <a class='trait' href='../juniper/trait.FromInputValue.html' title='juniper::FromInputValue'>FromInputValue</a> + <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create a scalar meta type</p>
<p>This expects the type to implement <code>FromInputValue</code>.</p>
</div><h4 id='method.build_list_type' class='method'><code>fn <a href='#method.build_list_type' class='fnname'>build_list_type</a>&lt;T:&nbsp;<a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;&gt;(&amp;mut self) -&gt; <a class='struct' href='../juniper/meta/struct.ListMeta.html' title='juniper::meta::ListMeta'>ListMeta</a></code></h4>
<div class='docblock'><p>Create a list meta type</p>
</div><h4 id='method.build_nullable_type' class='method'><code>fn <a href='#method.build_nullable_type' class='fnname'>build_nullable_type</a>&lt;T:&nbsp;<a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;&gt;(&amp;mut self) -&gt; <a class='struct' href='../juniper/meta/struct.NullableMeta.html' title='juniper::meta::NullableMeta'>NullableMeta</a></code></h4>
<div class='docblock'><p>Create a nullable meta type</p>
</div><h4 id='method.build_object_type' class='method'><code>fn <a href='#method.build_object_type' class='fnname'>build_object_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&amp;[</a><a class='struct' href='../juniper/meta/struct.Field.html' title='juniper::meta::Field'>Field</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>) -&gt; <a class='struct' href='../juniper/meta/struct.ObjectMeta.html' title='juniper::meta::ObjectMeta'>ObjectMeta</a>&gt; <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create an object meta type builder</p>
<p>To prevent infinite recursion by enforcing ordering, this returns a
function that needs to be called with the list of fields on the object.</p>
</div><h4 id='method.build_enum_type' class='method'><code>fn <a href='#method.build_enum_type' class='fnname'>build_enum_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&amp;[</a><a class='struct' href='../juniper/meta/struct.EnumValue.html' title='juniper::meta::EnumValue'>EnumValue</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>) -&gt; <a class='struct' href='../juniper/meta/struct.EnumMeta.html' title='juniper::meta::EnumMeta'>EnumMeta</a>&gt; <span class='where'>where T: <a class='trait' href='../juniper/trait.FromInputValue.html' title='juniper::FromInputValue'>FromInputValue</a> + <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create an enum meta type</p>
</div><h4 id='method.build_interface_type' class='method'><code>fn <a href='#method.build_interface_type' class='fnname'>build_interface_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&amp;[</a><a class='struct' href='../juniper/meta/struct.Field.html' title='juniper::meta::Field'>Field</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>) -&gt; <a class='struct' href='../juniper/meta/struct.InterfaceMeta.html' title='juniper::meta::InterfaceMeta'>InterfaceMeta</a>&gt; <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create an interface meta type builder</p>
</div><h4 id='method.build_union_type' class='method'><code>fn <a href='#method.build_union_type' class='fnname'>build_union_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&amp;[</a><a class='enum' href='../juniper/enum.Type.html' title='juniper::Type'>Type</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>) -&gt; <a class='struct' href='../juniper/meta/struct.UnionMeta.html' title='juniper::meta::UnionMeta'>UnionMeta</a>&gt; <span class='where'>where T: <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create a union meta type builder</p>
</div><h4 id='method.build_input_object_type' class='method'><code>fn <a href='#method.build_input_object_type' class='fnname'>build_input_object_type</a>&lt;T&gt;(&amp;mut self) -&gt; <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&amp;[</a><a class='struct' href='../juniper/meta/struct.Argument.html' title='juniper::meta::Argument'>Argument</a><a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>) -&gt; <a class='struct' href='../juniper/meta/struct.InputObjectMeta.html' title='juniper::meta::InputObjectMeta'>InputObjectMeta</a>&gt; <span class='where'>where T: <a class='trait' href='../juniper/trait.FromInputValue.html' title='juniper::FromInputValue'>FromInputValue</a> + <a class='trait' href='../juniper/trait.GraphQLType.html' title='juniper::GraphQLType'>GraphQLType</a>&lt;CtxT&gt;</span></code></h4>
<div class='docblock'><p>Create an input object meta type builder</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "juniper";
window.playgroundUrl = "";
</script>
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>