ingraph_codegen/interface/queries.rs
1//! The interface's ROOT CITIZENSHIP: `<I>Queries`, the unit a graph's root folds, and the
2//! [`Graphql`](../../../ingraph/trait.Graphql.html) binding that seats it.
3//!
4//! ```text
5//! type Query { # the graph root's fold, one level up
6//! media(orderBy: […], first: Int, …, where: MediaFilter): MediaConnection!
7//! # the LIST — MediaQueries::__media_list
8//! }
9//! ```
10//!
11//! # It is the RECORD's unit, at an interface
12//!
13//! The B-27 ruling: *the interface emits an `<I>Queries` unit, same shape as a record's, folded by
14//! the SAME MergedObject assembly*. So there is no second mounting mechanism and no second
15//! vocabulary — the type is a `Default` unit, its face is one `#[Object]`, and the root that mounts
16//! it names `Graphql::Query` exactly as it names a record's.
17//!
18//! # ONE LEG, and the absent one is a RULING rather than a gap
19//!
20//! A record's unit carries three legs; this carries the LIST alone. The by-id leg is refused by
21//! D-4 — *no interface get leg; the model's own id law decides it* — and the wall is real rather
22//! than stylistic: an interface's address is `<I>Id`, a SUM over the members' own ids, and a client
23//! sending one would have to say which member it meant, which is the member's own root field
24//! spelled twice. A caller learns WHICH concrete get to use from `__typename`, which the wire face
25//! beside this pins per arm.
26//!
27//! The LINEAGE leg is absent for a plainer reason: an interface declares no lineage, having no
28//! table for an ancestry to be a path through.
29//!
30//! # The BINDING is one projection SHORTER than a record's, and that is forced
31//!
32//! A record's root fields are reached as `<<R as Transformer>::Graphql as Graphql>::Query`. An
33//! interface implements no `Transformer`: that trait's supertrait is `Identifiable`, whose `id_ref`
34//! hands back a `&Self::Id` — and an interface's id is a sum a member's VALUE holds no instance of,
35//! so there is no borrow to return. That is the ruling's *an interface-owned id is unspellable*, met
36//! at the one place it decides something.
37//!
38//! So the interface implements [`Graphql`] DIRECTLY and the root projects `<I as Graphql>::Query`.
39//! The SEAT is the same seat; only the road to it is shorter.
40//!
41//! # What each of the three members binds
42//!
43//! | member | bound to | why |
44//! |---|---|---|
45//! | `Input` | `<I>GraphqlInput` | the arguments object, whose own impl names the filter and the order |
46//! | `Output` | `<I>GraphqlOutput` | the sum a page's rows hydrate into — the wire face's subject |
47//! | `Query` | `<I>Queries`, or `()` | the unit, where this interface can answer a page at all |
48//!
49//! `GraphqlOutput::Key` binds `()`, and it is an ANSWER rather than a placeholder: that member is
50//! *the address a search or knn HIT renders into*, and an interface's engine faces are the fusion
51//! seam's future — `<I>Key` exists in Rust and has no wire projection because nothing hands one
52//! back yet. The empty product is what the framework's own absent forms are spelled with.
53//!
54//! # The whole binding rides `projects()`
55//!
56//! An interface about no SQL database, or one promising no stored column, has no filter, no order
57//! and no page — so it has no argument object to bind either, and the honest emission is NONE. A
58//! graph that mounts such an interface is `E0277` at the projection carrying [`Graphql`]'s own
59//! sentence, which is the same answer a record with no `graphql(…)` block gives.
60
61use quote::quote;
62
63use crate::{
64 interface::InterfaceModel,
65 model::{DatabaseKind, default_queries_name},
66};
67
68#[cfg(test)]
69mod tests;
70#[cfg(test)]
71mod tower_tests;
72
73impl InterfaceModel {
74 /// The word this interface's LIST FIELD and its two page types are all built from — the declared
75 /// plural, or the pluraliser's answer over the interface's own name.
76 ///
77 /// # The tower is the RECORD's, applied uniformly — which is D-6
78 ///
79 /// | tier | the word | who writes it |
80 /// |---|---|---|
81 /// | base | the derived plural — `Reel` ⇒ `reels` / `ReelsConnection` | the pluraliser |
82 /// | over it | `graphql(plural = "media")` | the declaration, ONCE |
83 /// | on top | `graphql(connection(rename = "MediaPage"))` | the declaration, per name |
84 ///
85 /// One word moves three names, which is the user's *一起跟*: the field, the connection and the
86 /// edge all read this, resolved in one place, so a declaration that corrects English once is not
87 /// asked to correct it again.
88 ///
89 /// # And the DEGENERATE refusal does NOT fire here
90 ///
91 /// A record whose derived plural equals its singular is refused BY NAME, because its two root
92 /// fields would collide — the single is `<camel>` and the page would be the same word, and
93 /// async-graphql builds such a schema silently wrong. That rationale DIED with the get leg: D-4
94 /// gives an interface no by-id field, so there is nothing for a page's name to collide with, and
95 /// `Media` ⇒ `media` is a working list field rather than a silence.
96 ///
97 /// So the refusal is ABSENT rather than relaxed by a flag, and its absence is stated here so a
98 /// later round does not restore it by symmetry with the record.
99 #[must_use]
100 pub fn published_plural(&self) -> String {
101 self
102 .plural
103 .clone()
104 .unwrap_or_else(|| crate::plural::of(&self.name.to_string()))
105 }
106
107 /// The database this interface's ROOT FIELDS are served from, and `None` where it has none.
108 ///
109 /// The FIRST of its SQL databases, and the choice is the schema's own law read one declaration
110 /// over from [`RecordModel::wire_query_row`](crate::model::RecordModel): a client must never see a
111 /// field that varies with a deployment's storage choice, so an interface whose members are stored
112 /// in two databases answers its root fields from one — the one its declaration named first.
113 ///
114 /// Gated on [`projects`](Self::projects), which is where the page's whole vocabulary is gated: the
115 /// row, the cursor, the predicate and the order are each emitted under it, and a leg naming them
116 /// cannot stand where they do not.
117 pub(crate) fn wire_query_database(&self) -> Option<DatabaseKind> {
118 if !self.projects() {
119 return None;
120 }
121 self.sql_databases().first().copied()
122 }
123
124 /// The unit's DECLARATION — outside the binding gate, like every other emitted wire type.
125 ///
126 /// It has to be: [`Graphql::Query`](../../../ingraph/trait.Graphql.html) is bound in an UNGATED
127 /// impl, so a type that existed only where async-graphql does would leave that binding naming
128 /// nothing in every other build. The FACE — the `#[Object]` impl — is what rides the gate.
129 ///
130 /// `Default` because the ROOT is built from one: an emitted `<Root>Query` derives its own over a
131 /// tuple of units, which is what makes `Schema::build(<Root>Query::default(), …)` the whole of an
132 /// application's construction.
133 fn queries_type(&self) -> proc_macro2::TokenStream {
134 if self.wire_query_database().is_none() {
135 return quote!();
136 }
137 let vis = &self.vis;
138 let interface = &self.name;
139 let name = default_queries_name(interface);
140 let doc = crate::emit::leading(&format!(
141 "The root fields a [`{interface}`] answers — a page of them, across every member the contract \
142 declares.\n\nMounted by folding it into a graph's root query; it holds nothing and reads its \
143 store through the door the schema was built with. There is no by-id field here and that is a \
144 ruling rather than a gap: an interface's address is a SUM over its members' ids, so a row is \
145 fetched from the MEMBER's own root and `__typename` is what says which member to ask."
146 ));
147 quote! {
148 #[doc = #doc]
149 #[derive(::core::fmt::Debug, ::core::clone::Clone, ::core::marker::Copy, ::core::default::Default)]
150 #vis struct #name;
151 }
152 }
153
154 /// The interface's WIRE BINDING: the two face halves, and [`Graphql`] over them.
155 ///
156 /// Ungated, as a record's is and for its reason: a root's fold names `Graphql::Query` through a
157 /// projection, and a projection into an impl that exists only under a feature is a projection that
158 /// fails to resolve everywhere else.
159 fn wire_binding(&self) -> proc_macro2::TokenStream {
160 if !self.projects() {
161 return quote!();
162 }
163 let interface = &self.name;
164 let input = super::default_input_name(interface);
165 let output = super::default_output_name(interface);
166 let filter = super::default_filter_name(interface);
167 let order_by = super::default_order_by_name(interface);
168 let face = self.framework(&["transform"], "Graphql");
169 let input_face = self.framework(&["transform"], "GraphqlInput");
170 let output_face = self.framework(&["transform"], "GraphqlOutput");
171 // The UNIT where this interface has root fields, and `()` where it has none — the shape a
172 // record's own binding takes at the same member, and the same kind of statement: the empty
173 // product is what a fold measures its membership against.
174 let queries = match self.wire_query_database() {
175 Some(_) => {
176 let name = default_queries_name(interface);
177 quote!(#name)
178 }
179 None => quote!(()),
180 };
181 quote! {
182 #[automatically_derived]
183 impl #input_face for #input {
184 type Filter = #filter;
185 type OrderBy = #order_by;
186 }
187
188 #[automatically_derived]
189 impl #output_face for #output {
190 type Key = ();
191 }
192
193 #[automatically_derived]
194 impl #face for #interface {
195 type Input = #input;
196 type Output = #output;
197 type Query = #queries;
198 }
199 }
200 }
201
202 /// The Rust markers this interface's two SDL page names are spelled through —
203 /// `<I>ConnectionName` and `<I>EdgeName` — private to the face's own `const`.
204 ///
205 /// The record's own arrangement, and for its reasons: the library's
206 /// `DefaultConnectionName` renders `<Node>Connection` over the NODE's singular type name, which
207 /// the ruled base is not, so there is no declaration this emitter can leave to the library. The
208 /// only things that ever name one are the paged leg's return type, in the same const, so they are
209 /// not vocabulary a declaring crate can see and need no entry in
210 /// [`emitted_types`](Self::emitted_types).
211 fn page_names(&self) -> proc_macro2::TokenStream {
212 let ag = self.framework(&[], "async_graphql");
213 let interface = &self.name;
214 // THE TOWER'S BASE, resolved once for both names: the list field's own plural with its initial
215 // raised. Asking `published_plural` here rather than re-pluralising is what makes one
216 // `plural = "…"` move the field, the page and the edge together.
217 let base = crate::emit::raise_initial(&self.published_plural());
218 let marker = |declared: Option<&String>, suffix: &str, hook: &str, what: &str| {
219 let word = declared.map_or_else(|| format!("{base}{suffix}"), ToOwned::to_owned);
220 let name = quote::format_ident!("{interface}{suffix}Name");
221 let hook = self.framework(&["graphql"], hook);
222 let doc = crate::emit::leading(&format!(
223 "What the schema calls {what} of [`{interface}`]s — `{word}`.\n\nThe naming tower's word, \
224 resolved in one place: the base is this interface's PLURAL, `graphql(plural = \"…\")` \
225 covers it, and `graphql({suffix_word}(rename = \"…\"))` covers that. Tooling that finds a \
226 page by the NODE's stem rather than by its fields sees a name it does not recognise, which \
227 is the trade the plural base makes once for every declaration that has a page.",
228 suffix_word = suffix.to_lowercase(),
229 ));
230 quote! {
231 #[doc = #doc]
232 struct #name;
233
234 impl #hook for #name {
235 fn type_name<__IngraphNode: #ag::OutputType>() -> ::std::string::String {
236 ::std::borrow::ToOwned::to_owned(#word)
237 }
238 }
239 }
240 };
241 let connection = marker(
242 self.connection.as_ref(),
243 "Connection",
244 "ConnectionNameType",
245 "a page",
246 );
247 let edge = marker(self.edge.as_ref(), "Edge", "EdgeNameType", "one edge");
248 quote!(#connection #edge)
249 }
250
251 /// **THE LIST LEG** — `<plural>(orderBy:, first:, last:, after:, before:, where:)`, the union over
252 /// every declared member, paged and hydrated.
253 ///
254 /// # The RESULT SET is DECLARATION-DRIVEN, which is D-2's first companion law
255 ///
256 /// *`media(…)` runs I-2's union over ALL declared members, mounted or not; the mount word only
257 /// decides which ROOT FIELDS exist.* Nothing here reads a mount: the union's arms are
258 /// `SqlInterface::ARMS`, minted from the declaration's own member list, so a member whose record
259 /// nobody mounted still answers this page. What the graph root's `query` word decides is whether
260 /// this field is published at all.
261 ///
262 /// # TWO READS, and the second is a WALL rather than a choice
263 ///
264 /// A page of an interface is two moments — the union, then one gather per member keyed on the
265 /// addresses it returned — and one transaction across both is what the framework's own
266 /// `BeginRead` passthrough exists for. **A resolver cannot open one.** `emit::queries`'s module
267 /// note measured the wall to its floor and it is the same wall here: async-graphql demands `Send`
268 /// of every resolver future, sqlx implements `Acquire<'c>` for a borrowed connection or
269 /// transaction at ONE lifetime, and a `Send`-bounded future asks for it at two — so a resolver
270 /// holding anything narrower than `&Pool` is *implementation of `sqlx::Acquire` is not general
271 /// enough*, at any database, behind any number of helpers. Measured again at this leg, with the
272 /// dialect's own `BEGIN` in hand.
273 ///
274 /// So each call opens its own read. What that costs is stated rather than hidden: a row deleted
275 /// BETWEEN the union and the gather is a row the gather cannot find, and the hydration answers
276 /// that with its coherence refusal — `HydrationError::Missing`, which crosses as
277 /// `UNREADABLE_ROW`. A page that silently lost the row would be a page whose `hasNextPage` is a
278 /// lie, which is the judgement that refusal was written on. A caller that needs the two moments
279 /// bracketed has the typed door for it — `<I>::find_<db>` and `<I>::hydrate_<db>` both pass a
280 /// caller's own `&mut Transaction` through — and that door is Rust-side, where the `Send` bound
281 /// is not in the way.
282 ///
283 /// # The HYDRATION is per member, and the page's ORDER is what puts it back
284 ///
285 /// The gather answers one member at a time; the page is ordered across all of them. So each
286 /// member's addresses are collected WITH the positions they were asked at, and the answers are
287 /// scattered back into those slots — the same discipline the hydration itself uses one layer down,
288 /// where a row is asked for its own address to be put back in the caller's order.
289 fn list_leg(&self, kind: DatabaseKind) -> proc_macro2::TokenStream {
290 let interface = &self.name;
291 let ag = self.framework(&[], "async_graphql");
292 let door = self.framework(&["graphql"], "SqlDoor");
293 let orderings = self.framework(&["graphql"], "Orderings");
294 let connection = self.framework(&["graphql"], "Connection");
295 let page_request = self.framework(&["graphql"], "PageRequest");
296 let refused = self.framework(&["graphql"], "refused");
297 let refused_filter = self.framework(&["graphql"], "refused_filter");
298 let refused_row = self.framework(&["graphql"], "refused_row");
299 let try_from_filter = self.framework(&["comparison"], "TryFromFilter");
300 let capability = self.framework(&["interface"], "InterfaceKind");
301 let page_ty = self.framework(&["query"], "Page");
302 let edge_ty = self.framework(&["query"], "Edge");
303
304 let vocabulary = super::default_kind_name(interface);
305 let address = super::default_id_name(interface);
306 let output = super::default_output_name(interface);
307 let row = super::default_row_name(interface, kind);
308 let cursor = self.cursor_name(kind);
309 let comparison = self.comparison_name(kind);
310 let filter = super::default_filter_name(interface);
311 let order_by = super::default_order_by_name(interface);
312 let (module, item) = kind.backend();
313 let backend = self.framework(module, item);
314 let hydrate = quote::format_ident!("hydrate_{}", kind.as_str());
315 // The EMITTED entry point rather than `InterfaceFind::new` directly, which is the record leg's
316 // own arrangement: a declaration has one typed door per database, and a resolver that opened the
317 // builder itself would be a second one to keep in step with it.
318 let finder = kind.finder();
319
320 let field = crate::emit::lower_initial(&self.published_plural());
321 let method = crate::method::wire_method("e::format_ident!(
322 "{}_list",
323 crate::emit::snake(&interface.to_string())
324 ));
325 let ctx = crate::method::wire_method("e::format_ident!("ctx"));
326 let (order, first, last, after, before) = (
327 crate::method::wire_method("e::format_ident!("order_by")),
328 crate::method::wire_method("e::format_ident!("first")),
329 crate::method::wire_method("e::format_ident!("last")),
330 crate::method::wire_method("e::format_ident!("after")),
331 crate::method::wire_method("e::format_ident!("before")),
332 );
333 // `where` is a Rust KEYWORD and `Ident::new` takes one, so the base is the plain ident and the
334 // `__` prefix is what makes it spellable — the RAW spelling panics inside `format_ident!`, which
335 // the record's own leg measured.
336 let predicate = crate::method::wire_method("e::format_ident!("where"));
337 let arity = crate::emit::wide_signature();
338 let connection_name = quote::format_ident!("{interface}ConnectionName");
339 let edge_name = quote::format_ident!("{interface}EdgeName");
340
341 quote! {
342 #[graphql(name = #field)]
343 #arity
344 async fn #method(
345 &self,
346 #ctx: &#ag::Context<'_>,
347 #[graphql(name = "orderBy")] #order: ::core::option::Option<#orderings<#order_by>>,
348 #[graphql(name = "first")] #first: ::core::option::Option<u32>,
349 #[graphql(name = "last")] #last: ::core::option::Option<u32>,
350 #[graphql(name = "after")] #after: ::core::option::Option<::std::string::String>,
351 #[graphql(name = "before")] #before: ::core::option::Option<::std::string::String>,
352 // LAST, and that placement is the widening law rather than a preference: the SDL renders
353 // arguments in declaration order, so an argument appended leaves every byte before it where
354 // it was.
355 #[graphql(name = "where")] #predicate: ::core::option::Option<#filter>,
356 ) -> #ag::Result<#connection<#output, #cursor, #connection_name, #edge_name>> {
357 let __ingraph_door = #ag::Context::data::<#door<#backend>>(#ctx)?;
358 // A LOCAL rather than an inline expression, because `InterfaceFind::filter` BORROWS the
359 // predicate for the whole walk, so it has to outlive the builder it is handed to.
360 let __ingraph_predicate = match #predicate {
361 ::core::option::Option::Some(__ingraph_written) => ::core::option::Option::Some(
362 <#comparison<#backend> as #try_from_filter<#filter>>::try_from_filter(__ingraph_written)
363 .map_err(|__ingraph_refusal| #refused_filter(&__ingraph_refusal))?,
364 ),
365 ::core::option::Option::None => ::core::option::Option::None,
366 };
367 let __ingraph_request = <#page_request<#cursor>>::of(
368 #first,
369 #last,
370 ::core::option::Option::as_deref(&#after),
371 ::core::option::Option::as_deref(&#before),
372 )
373 .map_err(|__ingraph_refusal| #refused(&__ingraph_refusal))?;
374 // The KEY DEFAULT's one door: an absent argument and `orderBy: []` reach the same empty
375 // order, and an interface's own tail — `(…, __ig_kind__, id)` — is what makes the empty one
376 // total.
377 let __ingraph_terms: ::std::vec::Vec<#order_by> = ::core::iter::Iterator::collect(
378 ::core::iter::Iterator::cloned(
379 #orderings::terms(&::core::option::Option::unwrap_or_default(#order)),
380 ),
381 );
382 // THE POOL is the surface, and it is FORCED — see this module's note: a resolver future is
383 // `Send`-bounded, and sqlx implements `Acquire<'c>` for a borrowed connection at ONE
384 // lifetime, so anything narrower than `&Pool` is *implementation of `sqlx::Acquire` is not
385 // general enough*. Each call therefore opens its own read, and the gap between the two is
386 // what the hydration's coherence refusal reports rather than hides.
387 let __ingraph_found = #interface::#finder(#door::pool(__ingraph_door));
388 let __ingraph_found = match &__ingraph_predicate {
389 ::core::option::Option::Some(__ingraph_narrowing) => {
390 __ingraph_found.filter(__ingraph_narrowing)
391 }
392 ::core::option::Option::None => __ingraph_found,
393 };
394 let __ingraph_found = __ingraph_found.order(&__ingraph_terms);
395 let __ingraph_page: #page_ty<#row, #cursor> = match &__ingraph_request {
396 #page_request::Forward { after: __ingraph_at, .. } => {
397 let __ingraph_walk = __ingraph_found.first(#page_request::size(&__ingraph_request));
398 match __ingraph_at {
399 ::core::option::Option::Some(__ingraph_cursor) => {
400 __ingraph_walk.after(__ingraph_cursor).fetch().await
401 }
402 ::core::option::Option::None => __ingraph_walk.fetch().await,
403 }
404 }
405 #page_request::Backward { before: __ingraph_at, .. } => {
406 let __ingraph_walk = __ingraph_found.last(#page_request::size(&__ingraph_request));
407 match __ingraph_at {
408 ::core::option::Option::Some(__ingraph_cursor) => {
409 __ingraph_walk.before(__ingraph_cursor).fetch().await
410 }
411 ::core::option::Option::None => __ingraph_walk.fetch().await,
412 }
413 }
414 }
415 .map_err(|__ingraph_refusal| #refused(&__ingraph_refusal))?;
416
417 // THE GATHER, one member at a time, each answer scattered back to the position the PAGE
418 // asked for it at — so what a client receives is the statement's order across every member
419 // rather than the members' order.
420 let __ingraph_rows = #page_ty::edges(&__ingraph_page);
421 let mut __ingraph_nodes: ::std::vec::Vec<::core::option::Option<#output>> =
422 ::std::vec::Vec::with_capacity(<[_]>::len(__ingraph_rows));
423 for _ in 0..<[_]>::len(__ingraph_rows) {
424 ::std::vec::Vec::push(&mut __ingraph_nodes, ::core::option::Option::None);
425 }
426 for __ingraph_kind in <#vocabulary as #capability>::ALL {
427 let mut __ingraph_asked: ::std::vec::Vec<#address> = ::std::vec::Vec::new();
428 let mut __ingraph_slots: ::std::vec::Vec<usize> = ::std::vec::Vec::new();
429 for (__ingraph_at, __ingraph_edge) in
430 ::core::iter::Iterator::enumerate(<[_]>::iter(__ingraph_rows))
431 {
432 let __ingraph_id = #row::id(#edge_ty::node(__ingraph_edge));
433 if #address::kind(__ingraph_id) != *__ingraph_kind {
434 continue;
435 }
436 ::std::vec::Vec::push(
437 &mut __ingraph_asked,
438 ::core::clone::Clone::clone(__ingraph_id),
439 );
440 ::std::vec::Vec::push(&mut __ingraph_slots, __ingraph_at);
441 }
442 if ::std::vec::Vec::is_empty(&__ingraph_asked) {
443 continue;
444 }
445 let __ingraph_raised = #interface::#hydrate(
446 *__ingraph_kind,
447 &__ingraph_asked,
448 #door::pool(__ingraph_door),
449 )
450 .await
451 .map_err(|__ingraph_refusal| #refused_row(&__ingraph_refusal))?;
452 for (__ingraph_at, __ingraph_node) in ::core::iter::Iterator::zip(
453 ::std::vec::Vec::into_iter(__ingraph_slots),
454 ::std::vec::Vec::into_iter(__ingraph_raised),
455 ) {
456 __ingraph_nodes[__ingraph_at] = ::core::option::Option::Some(__ingraph_node);
457 }
458 }
459 #page_ty::into_connection_of(__ingraph_page, __ingraph_nodes)
460 .map_err(|__ingraph_refusal| #refused_row(&__ingraph_refusal))
461 }
462 }
463 }
464
465 /// The unit's FACE: `#[Object]` over the one leg, inside the binding gate AND this database's own.
466 ///
467 /// Both gates, because both halves are named: `#[Object]` is async-graphql's and the engine call
468 /// names one dialect's row, its cursor value and its finder.
469 fn queries_face(&self) -> proc_macro2::TokenStream {
470 let Some(kind) = self.wire_query_database() else {
471 return quote!();
472 };
473 let name = default_queries_name(&self.name);
474 let sdl = name.to_string();
475 let ag = self.framework(&[], "async_graphql");
476 let shelf = crate::emit::vendored(&self.krate, "async_graphql");
477 let binding_gate = self.framework(&["gate"], "if_async_graphql");
478 let database_gate = self.framework(&["gate"], &kind.gate().to_string());
479 let prelude = crate::emit::wire::prelude();
480 let names = self.page_names();
481 let leg = self.list_leg(kind);
482 quote! {
483 #binding_gate! {
484 #database_gate! {
485 const _: () = {
486 #prelude
487
488 #names
489
490 #[#ag::Object(crate = #shelf, name = #sdl)]
491 impl #name {
492 #leg
493 }
494 };
495 }
496 }
497 }
498 }
499
500 /// The unit, the binding that seats it, and the face that answers — this module's whole
501 /// contribution to [`InterfaceModel::emit`].
502 pub(crate) fn queries(&self) -> proc_macro2::TokenStream {
503 let declaration = self.queries_type();
504 let binding = self.wire_binding();
505 let face = self.queries_face();
506 quote! {
507 #declaration
508 #binding
509 #face
510 }
511 }
512}