capnp-rpc-0.19.0/.cargo_vcs_info.json0000644000000001470000000000100130100ustar { "git": { "sha1": "4e1a30a1ea658d7c8f5bf9a91238fe7953058da4" }, "path_in_vcs": "capnp-rpc" }capnp-rpc-0.19.0/CHANGELOG.md000064400000000000000000000046261046102023000134170ustar 00000000000000## v0.19.0 Follow v0.19.0 release of other capnp crates. ## v0.18.0 Follow v0.19.0 release of other capnp crates. ## v0.17.0 - Rename `WeakCapabilityServerSet` to `CapabilityServerSet` and remove the old implmentation. ## v0.16.2 - Add WeakCapabilityServerSet, intended to eventually replace CapabilityServerSet. ## v0.16.1 - Regenerate code, with rpc.capnp from upstream latest release, version 0.10.3. ## v0.16.0 - Add reconnect API. ## v0.15.1 - Remove some `unimplemented!()` panics. - Lots of style and formatting fixes that should have no effect. ## v0.15.0 - Add CapabilityServerSet. ## v0.14.2 - Fix potential panic in broken pipelined capabilities. ## v0.14.1 - Include LICENSE in published crate. ## v0.14.0 - Update for `SetPointerBuilder` no longer having a `To` type parameter. ## v0.13.1 - Turn some disconnect panics into error results. ## v0.13.0 - Remove deprecated `ServerHook` impl. ## v0.12.3 - Expand deprecation note for capnp_rpc::Server. ## v0.12.2 - Add capnp_rpc::new_client() and deprecate capnp_rpc::Server. ## v0.12.1 - Check in generated rpc_capnp.rs and rpc_twoparty.rs files, to avoid build-time dependency on capnp tool. ## v0.12.0 - Follow 0.12.0 release of other capnp crates. ## v0.11.0 - Export Disconnector struct from capnp_rpc (#140). - Switch to std::future::Future. - Update minimum required rustc version to 1.39. ## v0.10.0 - Update to Rust 2018. - Update minimum required rustc version to 1.35. ## v0.9.0 - Remove deprecated items. - Add ImbuedMessageBuilder to provide functionality that was previously automatically provided by capnp::message::Builder. ## v0.8.3 - Add RpcSystem::get_disconnector() method. - Migrate away from some deprecated futures-rs functionality. ## v0.8.2 - Prevent a double-borrow that could happen in rare situations with ForkedPromise. ## v0.8.1 - Fix a possible deadlock. ## v0.8.0 - Drop GJ dependency in favor of futures-rs. - Fix a bug that could in rare cases cause Disembargo messages to fail with a "does not point back to sender" error. ## v0.7.4 - Eliminate some calls to unwrap(), in favor of saner error handling. - Eliminate dependency on capnp/c++.capnp. ## v0.7.3 - Directly include rpc.capnp and rpc-twoparty.capnp to make the build more robust. ## v0.7.2 - Fix "unimplemented" panic that could happen on certain broken capabilities. ## v0.7.1 - Fix bug where piplining on a method that returned a null capability could cause a panic. capnp-rpc-0.19.0/Cargo.toml0000644000000020730000000000100110060ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" name = "capnp-rpc" version = "0.19.0" authors = ["David Renshaw "] autoexamples = false description = "implementation of the Cap'n Proto remote procedure call protocol" documentation = "https://docs.rs/capnp-rpc/" readme = "README.md" categories = ["network-programming"] license = "MIT" repository = "https://github.com/capnproto/capnproto-rust" [dependencies.capnp] version = "0.19.0" [dependencies.capnp-futures] version = "0.19.0" [dependencies.futures] version = "0.3.0" features = ["std"] default-features = false [lints.clippy] type_complexity = "allow" capnp-rpc-0.19.0/Cargo.toml.orig000064400000000000000000000013241046102023000144650ustar 00000000000000[package] name = "capnp-rpc" version = "0.19.0" authors = [ "David Renshaw " ] license = "MIT" description = "implementation of the Cap'n Proto remote procedure call protocol" repository = "https://github.com/capnproto/capnproto-rust" documentation = "https://docs.rs/capnp-rpc/" categories = ["network-programming"] autoexamples = false edition = "2021" readme = "README.md" [dependencies.futures] version = "0.3.0" default-features = false features = ["std"] [dependencies] capnp-futures = { version = "0.19.0", path = "../capnp-futures" } capnp = {version = "0.19.0", path = "../capnp"} #[lints] #workspace = true [lints.clippy] type_complexity = "allow" # this should be removed in future capnp-rpc-0.19.0/LICENSE000064400000000000000000000021121046102023000125770ustar 00000000000000Copyright (c) 2013-2018 Sandstorm Development Group, Inc. and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.capnp-rpc-0.19.0/README.md000064400000000000000000000114001046102023000130510ustar 00000000000000# capnp-rpc-rust [![crates.io](https://img.shields.io/crates/v/capnp-rpc.svg)](https://crates.io/crates/capnp-rpc) [documentation](https://docs.rs/capnp-rpc/) This is a [level one](https://capnproto.org/rpc.html#protocol-features) implementation of the Cap'n Proto remote procedure call protocol. It is a fairly direct translation of the original [C++ implementation](https://github.com/sandstorm-io/capnproto). ## Defining an interface First, make sure that the [`capnp` executable](https://capnproto.org/capnp-tool.html) is installed on your system, and that you have the [`capnpc`](https://crates.io/crates/capnpc) crate in the `build-dependencies` section of your `Cargo.toml`. Then, in a file named `foo.capnp`, define your interface: ```capnp @0xa7ed6c5c8a98ca40; interface Bar { baz @0 (x :Int32) -> (y :Int32); } interface Qux { quux @0 (bar :Bar) -> (y :Int32); } ``` Now you can invoke the schema compiler in a [`build.rs`](http://doc.crates.io/build-script.html) file, like this: ```rust fn main() { ::capnpc::CompilerCommand::new().file("foo.capnp").run().unwrap(); } ``` and you can include the generated code in your project like this: ```rust pub mod foo_capnp { include!(concat!(env!("OUT_DIR"), "/foo_capnp.rs")); } ``` ## Calling methods on an RPC object For each defined interface, the generated code includes a `Client` struct that can be used to call the interface's methods. For example, the following code calls the `Bar.baz()` method: ```rust fn call_bar(client: ::foo_capnp::bar::Client) -> Box> { let mut req = client.baz_request(); req.get().set_x(11); Box::new(req.send().promise.and_then(|response| { Ok(response.get()?.get_y()) })) } ``` A `bar::Client` is a reference to a possibly-remote `Bar` object. The Cap'n Proto RPC runtime tracks the number of such references that are live at any given time and automatically drops the object when none are left. ## Implementing an interface The generated code also includes a `Server` trait for each of your interfaces. To create an RPC-enabled object, you must implement that trait. ```rust struct MyBar {} impl ::foo_capnp::bar::Server for MyBar { fn baz(&mut self, params: ::foo_capnp::bar::BazParams, mut results: ::foo_capnp::bar::BazResults) -> Promise<(), ::capnp::Error> { // `pry!` is defined in capnp_rpc. It's analogous to `try!`. results.get().set_y(pry!(params.get()).get_x() + 1); Promise::ok(()) } } ``` Then you can convert your object into a capability client like this: ```rust let client: foo_capnp::bar::Client = capnp_rpc::new_client(MyBar {}); ``` This new `client` can now be sent across the network. You can use it as the bootstrap capability when you construct an `RpcSystem`, and you can pass it in RPC method arguments and results. ## Async methods The methods of the generated `Server` traits return a value of type `Promise<(), ::capnp::Error>`. A `Promise` is either an immediate value, constructed by `Promise::ok()` or `Promise::err()`, or it is a wrapper of a `Future`, constructed by `Promise::from_future()`. The results will be sent back to the method's caller once two things have happened: 1. The `Results` struct has been dropped. 2. The returned `Promise` has resolved. Usually (1) happens before (2). Here's an example of a method implementation that does not return immediately: ```rust struct MyQux {} impl ::foo_capnp::qux::Server for MyQux { fn quux(&mut self, params: ::foo_capnp::qux::QuuxParams, mut results: ::foo_capnp::wux::QuuxResults) -> Promise<(), ::capnp::Error> { // Call `baz()` on the passed-in client. let bar_client = pry!(pry!(params.get()).get_bar()); let mut req = bar_client.baz_request(); req.get().set_x(42); Promise::from_future(req.send().promise.and_then(move |response| { results.get().set_y(response.get()?.get_y()); Ok(()) })) } } ``` It's possible for multiple calls of `quux()` to be active at the same time on the same object, and they do not need to return in the same order as they were called. ## Further reading * The [hello world example](/capnp-rpc/examples/hello-world) demonstrates a basic request/reply pattern. * The [calculator example](/capnp-rpc/examples/calculator) demonstrates how to use [promise pipelining](https://capnproto.org/rpc.html#time-travel-promise-pipelining). * The [pubsub example](/capnp-rpc/examples/pubsub) shows how even an interface with no methods can be useful. * The [Sandstorm raw API example app](https://github.com/dwrensha/sandstorm-rawapi-example-rust) shows how Sandstorm lets you write web apps using Cap'n Proto instead of HTTP. capnp-rpc-0.19.0/schema/rpc-twoparty.capnp000064400000000000000000000226401046102023000165400ustar 00000000000000# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors # Licensed under the MIT License: # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. @0xa184c7885cdaf2a1; # This file defines the "network-specific parameters" in rpc.capnp to support a network consisting # of two vats. Each of these vats may in fact be in communication with other vats, but any # capabilities they forward must be proxied. Thus, to each end of the connection, all capabilities # received from the other end appear to live in a single vat. # # Two notable use cases for this model include: # - Regular client-server communications, where a remote client machine (perhaps living on an end # user's personal device) connects to a server. The server may be part of a cluster, and may # call on other servers in the cluster to help service the user's request. It may even obtain # capabilities from these other servers which it passes on to the user. To simplify network # common traversal problems (e.g. if the user is behind a firewall), it is probably desirable to # multiplex all communications between the server cluster and the client over the original # connection rather than form new ones. This connection should use the two-party protocol, as # the client has no interest in knowing about additional servers. # - Applications running in a sandbox. A supervisor process may execute a confined application # such that all of the confined app's communications with the outside world must pass through # the supervisor. In this case, the connection between the confined app and the supervisor might # as well use the two-party protocol, because the confined app is intentionally prevented from # talking to any other vat anyway. Any external resources will be proxied through the supervisor, # and so to the contained app will appear as if they were hosted by the supervisor itself. # # Since there are only two vats in this network, there is never a need for three-way introductions, # so level 3 is free. Moreover, because it is never necessary to form new connections, the # two-party protocol can be used easily anywhere where a two-way byte stream exists, without regard # to where that byte stream goes or how it was initiated. This makes the two-party runtime library # highly reusable. # # Joins (level 4) _could_ be needed in cases where one or both vats are participating in other # networks that use joins. For instance, if Alice and Bob are speaking through the two-party # protocol, and Bob is also participating on another network, Bob may send Alice two or more # proxied capabilities which, unbeknownst to Bob at the time, are in fact pointing at the same # remote object. Alice may then request to join these capabilities, at which point Bob will have # to forward the join to the other network. Note, however, that if Alice is _not_ participating on # any other network, then Alice will never need to _receive_ a Join, because Alice would always # know when two locally-hosted capabilities are the same and would never export a redundant alias # to Bob. So, Alice can respond to all incoming joins with an error, and only needs to implement # outgoing joins if she herself desires to use this feature. Also, outgoing joins are relatively # easy to implement in this scenario. # # What all this means is that a level 4 implementation of the confined network is barely more # complicated than a level 2 implementation. However, such an implementation allows the "client" # or "confined" app to access the server's/supervisor's network with equal functionality to any # native participant. In other words, an application which implements only the two-party protocol # can be paired with a proxy app in order to participate in any network. # # So, when implementing Cap'n Proto in a new language, it makes sense to implement only the # two-party protocol initially, and then pair applications with an appropriate proxy written in # C++, rather than implement other parameterizations of the RPC protocol directly. using Cxx = import "/capnp/c++.capnp"; $Cxx.namespace("capnp::rpc::twoparty"); # Note: SturdyRef is not specified here. It is up to the application to define semantics of # SturdyRefs if desired. enum Side { server @0; # The object lives on the "server" or "supervisor" end of the connection. Only the # server/supervisor knows how to interpret the ref; to the client, it is opaque. # # Note that containers intending to implement strong confinement should rewrite SturdyRefs # received from the external network before passing them on to the confined app. The confined # app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps # maliciously leak), but instead receives only a thing that it can pass back to the container # later to restore the ref. See: # http://www.erights.org/elib/capability/dist-confine.html client @1; # The object lives on the "client" or "confined app" end of the connection. Only the client # knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not # actually know how to persist capabilities at all, so use of this is unusual. } struct VatId { side @0 :Side; } struct ProvisionId { # Only used for joins, since three-way introductions never happen on a two-party network. joinId @0 :UInt32; # The ID from `JoinKeyPart`. } struct RecipientId {} # Never used, because there are only two parties. struct ThirdPartyCapId {} # Never used, because there is no third party. struct JoinKeyPart { # Joins in the two-party case are simplified by a few observations. # # First, on a two-party network, a Join only ever makes sense if the receiving end is also # connected to other networks. A vat which is not connected to any other network can safely # reject all joins. # # Second, since a two-party connection bisects the network -- there can be no other connections # between the networks at either end of the connection -- if one part of a join crosses the # connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request # off some other network which needs to be forwarded across the two-party connection can # collect all the parts on its end and only forward them across the two-party connection when all # have been received. # # For example, imagine that Alice and Bob are vats connected over a two-party connection, and # each is also connected to other networks. At some point, Alice receives one part of a Join # request off her network. The request is addressed to a capability that Alice received from # Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as # if she hosted the capability locally (this is important so that if not all the Join parts end # up at Alice, the original sender can detect the failed Join without hanging). As other parts # trickle in, Alice verifies that each part is addressed to a capability from Bob and continues # to respond to each one. Once the complete set of join parts is received, Alice checks if they # were all for the exact same capability. If so, she doesn't need to send anything to Bob at # all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were # addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice # does not forward the Join parts she received herself, but essentially forwards the Join as a # whole. # # On Bob's end, since he knows that Alice will always send all parts of a Join together, he # simply waits until he's received them all, then performs a join on the respective capabilities # as if it had been requested locally. joinId @0 :UInt32; # A number identifying this join, chosen by the sender. May be reused once `Finish` messages are # sent corresponding to all of the `Join` messages. partCount @1 :UInt16; # The number of capabilities to be joined. partNum @2 :UInt16; # Which part this request targets -- a number in the range [0, partCount). } struct JoinResult { joinId @0 :UInt32; # Matches `JoinKeyPart`. succeeded @1 :Bool; # All JoinResults in the set will have the same value for `succeeded`. The receiver actually # implements the join by waiting for all the `JoinKeyParts` and then performing its own join on # them, then going back and answering all the join requests afterwards. cap @2 :Capability; # One of the JoinResults will have a non-null `cap` which is the joined capability. } capnp-rpc-0.19.0/schema/rpc.capnp000064400000000000000000002474271046102023000146650ustar 00000000000000# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors # Licensed under the MIT License: # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. @0xb312981b2552a250; # Recall that Cap'n Proto RPC allows messages to contain references to remote objects that # implement interfaces. These references are called "capabilities", because they both designate # the remote object to use and confer permission to use it. # # Recall also that Cap'n Proto RPC has the feature that when a method call itself returns a # capability, the caller can begin calling methods on that capability _before the first call has # returned_. The caller essentially sends a message saying "Hey server, as soon as you finish # that previous call, do this with the result!". Cap'n Proto's RPC protocol makes this possible. # # The protocol is significantly more complicated than most RPC protocols. However, this is # implementation complexity that underlies an easy-to-grasp higher-level model of object oriented # programming. That is, just like TCP is a surprisingly complicated protocol that implements a # conceptually-simple byte stream abstraction, Cap'n Proto is a surprisingly complicated protocol # that implements a conceptually-simple object abstraction. # # Cap'n Proto RPC is based heavily on CapTP, the object-capability protocol used by the E # programming language: # http://www.erights.org/elib/distrib/captp/index.html # # Cap'n Proto RPC takes place between "vats". A vat hosts some set of objects and talks to other # vats through direct bilateral connections. Typically, there is a 1:1 correspondence between vats # and processes (in the unix sense of the word), although this is not strictly always true (one # process could run multiple vats, or a distributed virtual vat might live across many processes). # # Cap'n Proto does not distinguish between "clients" and "servers" -- this is up to the application. # Either end of any connection can potentially hold capabilities pointing to the other end, and # can call methods on those capabilities. In the doc comments below, we use the words "sender" # and "receiver". These refer to the sender and receiver of an instance of the struct or field # being documented. Sometimes we refer to a "third-party" that is neither the sender nor the # receiver. Documentation is generally written from the point of view of the sender. # # It is generally up to the vat network implementation to securely verify that connections are made # to the intended vat as well as to encrypt transmitted data for privacy and integrity. See the # `VatNetwork` example interface near the end of this file. # # When a new connection is formed, the only interesting things that can be done are to send a # `Bootstrap` (level 0) or `Accept` (level 3) message. # # Unless otherwise specified, messages must be delivered to the receiving application in the same # order in which they were initiated by the sending application. The goal is to support "E-Order", # which states that two calls made on the same reference must be delivered in the order which they # were made: # http://erights.org/elib/concurrency/partial-order.html # # Since the full protocol is complicated, we define multiple levels of support that an # implementation may target. For many applications, level 1 support will be sufficient. # Comments in this file indicate which level requires the corresponding feature to be # implemented. # # * **Level 0:** The implementation does not support object references. Only the bootstrap interface # can be called. At this level, the implementation does not support object-oriented protocols and # is similar in complexity to JSON-RPC or Protobuf services. This level should be considered only # a temporary stepping-stone toward level 1 as the lack of object references drastically changes # how protocols are designed. Applications _should not_ attempt to design their protocols around # the limitations of level 0 implementations. # # * **Level 1:** The implementation supports simple bilateral interaction with object references # and promise pipelining, but interactions between three or more parties are supported only via # proxying of objects. E.g. if Alice (in Vat A) wants to send Bob (in Vat B) a capability # pointing to Carol (in Vat C), Alice must create a proxy of Carol within Vat A and send Bob a # reference to that; Bob cannot form a direct connection to Carol. Level 1 implementations do # not support checking if two capabilities received from different vats actually point to the # same object ("join"), although they should be able to do this check on capabilities received # from the same vat. # # * **Level 2:** The implementation supports saving persistent capabilities -- i.e. capabilities # that remain valid even after disconnect, and can be restored on a future connection. When a # capability is saved, the requester receives a `SturdyRef`, which is a token that can be used # to restore the capability later. # # * **Level 3:** The implementation supports three-way interactions. That is, if Alice (in Vat A) # sends Bob (in Vat B) a capability pointing to Carol (in Vat C), then Vat B will automatically # form a direct connection to Vat C rather than have requests be proxied through Vat A. # # * **Level 4:** The entire protocol is implemented, including joins (checking if two capabilities # are equivalent). # # Note that an implementation must also support specific networks (transports), as described in # the "Network-specific Parameters" section below. An implementation might have different levels # depending on the network used. # # New implementations of Cap'n Proto should start out targeting the simplistic two-party network # type as defined in `rpc-twoparty.capnp`. With this network type, level 3 is irrelevant and # levels 2 and 4 are much easier than usual to implement. When such an implementation is paired # with a container proxy, the contained app effectively gets to make full use of the proxy's # network at level 4. And since Cap'n Proto IPC is extremely fast, it may never make sense to # bother implementing any other vat network protocol -- just use the correct container type and get # it for free. using Cxx = import "/capnp/c++.capnp"; $Cxx.namespace("capnp::rpc"); # ======================================================================================== # The Four Tables # # Cap'n Proto RPC connections are stateful (although an application built on Cap'n Proto could # export a stateless interface). As in CapTP, for each open connection, a vat maintains four state # tables: questions, answers, imports, and exports. See the diagram at: # http://www.erights.org/elib/distrib/captp/4tables.html # # The question table corresponds to the other end's answer table, and the imports table corresponds # to the other end's exports table. # # The entries in each table are identified by ID numbers (defined below as 32-bit integers). These # numbers are always specific to the connection; a newly-established connection starts with no # valid IDs. Since low-numbered IDs will pack better, it is suggested that IDs be assigned like # Unix file descriptors -- prefer the lowest-number ID that is currently available. # # IDs in the questions/answers tables are chosen by the questioner and generally represent method # calls that are in progress. # # IDs in the imports/exports tables are chosen by the exporter and generally represent objects on # which methods may be called. Exports may be "settled", meaning the exported object is an actual # object living in the exporter's vat, or they may be "promises", meaning the exported object is # the as-yet-unknown result of an ongoing operation and will eventually be resolved to some other # object once that operation completes. Calls made to a promise will be forwarded to the eventual # target once it is known. The eventual replacement object does *not* get the same ID as the # promise, as it may turn out to be an object that is already exported (so already has an ID) or # may even live in a completely different vat (and so won't get an ID on the same export table # at all). # # IDs can be reused over time. To make this safe, we carefully define the lifetime of IDs. Since # messages using the ID could be traveling in both directions simultaneously, we must define the # end of life of each ID _in each direction_. The ID is only safe to reuse once it has been # released by both sides. # # When a Cap'n Proto connection is lost, everything on the four tables is lost. All questions are # canceled and throw exceptions. All imports become broken (all future calls to them throw # exceptions). All exports and answers are implicitly released. The only things not lost are # persistent capabilities (`SturdyRef`s). The application must plan for this and should respond by # establishing a new connection and restoring from these persistent capabilities. using QuestionId = UInt32; # **(level 0)** # # Identifies a question in the sender's question table (which corresponds to the receiver's answer # table). The questioner (caller) chooses an ID when making a call. The ID remains valid in # caller -> callee messages until a Finish message is sent, and remains valid in callee -> caller # messages until a Return message is sent. using AnswerId = QuestionId; # **(level 0)** # # Identifies an answer in the sender's answer table (which corresponds to the receiver's question # table). # # AnswerId is physically equivalent to QuestionId, since the question and answer tables correspond, # but we define a separate type for documentation purposes: we always use the type representing # the sender's point of view. using ExportId = UInt32; # **(level 1)** # # Identifies an exported capability or promise in the sender's export table (which corresponds # to the receiver's import table). The exporter chooses an ID before sending a capability over the # wire. If the capability is already in the table, the exporter should reuse the same ID. If the # ID is a promise (as opposed to a settled capability), this must be indicated at the time the ID # is introduced (e.g. by using `senderPromise` instead of `senderHosted` in `CapDescriptor`); in # this case, the importer shall expect a later `Resolve` message that replaces the promise. # # ExportId/ImportIds are subject to reference counting. Whenever an `ExportId` is sent over the # wire (from the exporter to the importer), the export's reference count is incremented (unless # otherwise specified). The reference count is later decremented by a `Release` message. Since # the `Release` message can specify an arbitrary number by which to reduce the reference count, the # importer should usually batch reference decrements and only send a `Release` when it believes the # reference count has hit zero. Of course, it is possible that a new reference to the export is # in-flight at the time that the `Release` message is sent, so it is necessary for the exporter to # keep track of the reference count on its end as well to avoid race conditions. # # When a connection is lost, all exports are implicitly released. It is not possible to restore # a connection state after disconnect (although a transport layer could implement a concept of # persistent connections if it is transparent to the RPC layer). using ImportId = ExportId; # **(level 1)** # # Identifies an imported capability or promise in the sender's import table (which corresponds to # the receiver's export table). # # ImportId is physically equivalent to ExportId, since the export and import tables correspond, # but we define a separate type for documentation purposes: we always use the type representing # the sender's point of view. # # An `ImportId` remains valid in importer -> exporter messages until the importer has sent # `Release` messages that (it believes) have reduced the reference count to zero. # ======================================================================================== # Messages struct Message { # An RPC connection is a bi-directional stream of Messages. union { unimplemented @0 :Message; # The sender previously received this message from the peer but didn't understand it or doesn't # yet implement the functionality that was requested. So, the sender is echoing the message # back. In some cases, the receiver may be able to recover from this by pretending the sender # had taken some appropriate "null" action. # # For example, say `resolve` is received by a level 0 implementation (because a previous call # or return happened to contain a promise). The level 0 implementation will echo it back as # `unimplemented`. The original sender can then simply release the cap to which the promise # had resolved, thus avoiding a leak. # # For any message type that introduces a question, if the message comes back unimplemented, # the original sender may simply treat it as if the question failed with an exception. # # In cases where there is no sensible way to react to an `unimplemented` message (without # resource leaks or other serious problems), the connection may need to be aborted. This is # a gray area; different implementations may take different approaches. abort @1 :Exception; # Sent when a connection is being aborted due to an unrecoverable error. This could be e.g. # because the sender received an invalid or nonsensical message or because the sender had an # internal error. The sender will shut down the outgoing half of the connection after `abort` # and will completely close the connection shortly thereafter (it's up to the sender how much # of a time buffer they want to offer for the client to receive the `abort` before the # connection is reset). # Level 0 features ----------------------------------------------- bootstrap @8 :Bootstrap; # Request the peer's bootstrap interface. call @2 :Call; # Begin a method call. return @3 :Return; # Complete a method call. finish @4 :Finish; # Release a returned answer / cancel a call. # Level 1 features ----------------------------------------------- resolve @5 :Resolve; # Resolve a previously-sent promise. release @6 :Release; # Release a capability so that the remote object can be deallocated. disembargo @13 :Disembargo; # Lift an embargo used to enforce E-order over promise resolution. # Level 2 features ----------------------------------------------- obsoleteSave @7 :AnyPointer; # Obsolete request to save a capability, resulting in a SturdyRef. This has been replaced # by the `Persistent` interface defined in `persistent.capnp`. This operation was never # implemented. obsoleteDelete @9 :AnyPointer; # Obsolete way to delete a SturdyRef. This operation was never implemented. # Level 3 features ----------------------------------------------- provide @10 :Provide; # Provide a capability to a third party. accept @11 :Accept; # Accept a capability provided by a third party. # Level 4 features ----------------------------------------------- join @12 :Join; # Directly connect to the common root of two or more proxied caps. } } # Level 0 message types ---------------------------------------------- struct Bootstrap { # **(level 0)** # # Get the "bootstrap" interface exported by the remote vat. # # For level 0, 1, and 2 implementations, the "bootstrap" interface is simply the main interface # exported by a vat. If the vat acts as a server fielding connections from clients, then the # bootstrap interface defines the basic functionality available to a client when it connects. # The exact interface definition obviously depends on the application. # # We call this a "bootstrap" because in an ideal Cap'n Proto world, bootstrap interfaces would # never be used. In such a world, any time you connect to a new vat, you do so because you # received an introduction from some other vat (see `ThirdPartyCapId`). Thus, the first message # you send is `Accept`, and further communications derive from there. `Bootstrap` is not used. # # In such an ideal world, DNS itself would support Cap'n Proto -- performing a DNS lookup would # actually return a new Cap'n Proto capability, thus introducing you to the target system via # level 3 RPC. Applications would receive the capability to talk to DNS in the first place as # an initial endowment or part of a Powerbox interaction. Therefore, an app can form arbitrary # connections without ever using `Bootstrap`. # # Of course, in the real world, DNS is not Cap'n-Proto-based, and we don't want Cap'n Proto to # require a whole new internet infrastructure to be useful. Therefore, we offer bootstrap # interfaces as a way to get up and running without a level 3 introduction. Thus, bootstrap # interfaces are used to "bootstrap" from other, non-Cap'n-Proto-based means of service discovery, # such as legacy DNS. # # Note that a vat need not provide a bootstrap interface, and in fact many vats (especially those # acting as clients) do not. In this case, the vat should either reply to `Bootstrap` with a # `Return` indicating an exception, or should return a dummy capability with no methods. questionId @0 :QuestionId; # A new question ID identifying this request, which will eventually receive a Return message # containing the restored capability. deprecatedObjectId @1 :AnyPointer; # ** DEPRECATED ** # # A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies # which one to return. If this pointer is null, then the default bootstrap interface is returned. # # As of version 0.5, use of this field is deprecated. If a service wants to export multiple # bootstrap interfaces, it should instead define a single bootstrap interface that has methods # that return each of the other interfaces. # # **History** # # In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`. # At the time, it was thought that this would eventually serve as the way to restore SturdyRefs # (level 2). Meanwhile, an application could offer its "main" interface on a well-known # (non-secret) SturdyRef. # # Since level 2 RPC was not implemented at the time, the `Restore` message was in practice only # used to obtain the main interface. Since most applications had only one main interface that # they wanted to restore, they tended to designate this with a null `objectId`. # # Unfortunately, the earliest version of the EZ RPC interfaces set a precedent of exporting # multiple main interfaces by allowing them to be exported under string names. In this case, # `objectId` was a Text value specifying the name. # # All of this proved problematic for several reasons: # # - The arrangement assumed that a client wishing to restore a SturdyRef would know exactly what # machine to connect to and would be able to immediately restore a SturdyRef on connection. # However, in practice, the ability to restore SturdyRefs is itself a capability that may # require going through an authentication process to obtain. Thus, it makes more sense to # define a "restorer service" as a full Cap'n Proto interface. If this restorer interface is # offered as the vat's bootstrap interface, then this is equivalent to the old arrangement. # # - Overloading "Restore" for the purpose of obtaining well-known capabilities encouraged the # practice of exporting singleton services with string names. If singleton services are desired, # it is better to have one main interface that has methods that can be used to obtain each # service, in order to get all the usual benefits of schemas and type checking. # # - Overloading "Restore" also had a security problem: Often, "main" or "well-known" # capabilities exported by a vat are in fact not public: they are intended to be accessed only # by clients who are capable of forming a connection to the vat. This can lead to trouble if # the client itself has other clients and wishes to forward some `Restore` requests from those # external clients -- it has to be very careful not to allow through `Restore` requests # addressing the default capability. # # For example, consider the case of a sandboxed Sandstorm application and its supervisor. The # application exports a default capability to its supervisor that provides access to # functionality that only the supervisor is supposed to access. Meanwhile, though, applications # may publish other capabilities that may be persistent, in which case the application needs # to field `Restore` requests that could come from anywhere. These requests of course have to # pass through the supervisor, as all communications with the outside world must. But, the # supervisor has to be careful not to honor an external request addressing the application's # default capability, since this capability is privileged. Unfortunately, the default # capability cannot be given an unguessable name, because then the supervisor itself would not # be able to address it! # # As of Cap'n Proto 0.5, `Restore` has been renamed to `Bootstrap` and is no longer planned for # use in restoring SturdyRefs. # # Note that 0.4 also defined a message type called `Delete` that, like `Restore`, addressed a # SturdyRef, but indicated that the client would not restore the ref again in the future. This # operation was never implemented, so it was removed entirely. If a "delete" operation is desired, # it should exist as a method on the same interface that handles restoring SturdyRefs. However, # the utility of such an operation is questionable. You wouldn't be able to rely on it for # garbage collection since a client could always disappear permanently without remembering to # delete all its SturdyRefs, thus leaving them dangling forever. Therefore, it is advisable to # design systems such that SturdyRefs never represent "owned" pointers. # # For example, say a SturdyRef points to an image file hosted on some server. That image file # should also live inside a collection (a gallery, perhaps) hosted on the same server, owned by # a user who can delete the image at any time. If the user deletes the image, the SturdyRef # stops working. On the other hand, if the SturdyRef is discarded, this has no effect on the # existence of the image in its collection. } struct Call { # **(level 0)** # # Message type initiating a method call on a capability. questionId @0 :QuestionId; # A number, chosen by the caller, that identifies this call in future messages. This number # must be different from all other calls originating from the same end of the connection (but # may overlap with question IDs originating from the opposite end). A fine strategy is to use # sequential question IDs, but the recipient should not assume this. # # A question ID can be reused once both: # - A matching Return has been received from the callee. # - A matching Finish has been sent from the caller. target @1 :MessageTarget; # The object that should receive this call. interfaceId @2 :UInt64; # The type ID of the interface being called. Each capability may implement multiple interfaces. methodId @3 :UInt16; # The ordinal number of the method to call within the requested interface. allowThirdPartyTailCall @8 :Bool = false; # Indicates whether or not the receiver is allowed to send a `Return` containing # `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee # will have to proxy the return in the case of a tail call to a third-party vat. noPromisePipelining @9 :Bool = false; # If true, the sender promises that it won't make any promise-pipelined calls on the results of # this call. If it breaks this promise, the receiver may throw an arbitrary error from such # calls. # # The receiver may use this as an optimization, by skipping the bookkeeping needed for pipelining # when no pipelined calls are expected. The sender typically sets this to false when the method's # schema does not specify any return capabilities. onlyPromisePipeline @10 :Bool = false; # If true, the sender only plans to use this call to make pipelined calls. The receiver need not # send a `Return` message (but is still allowed to do so). # # Since the sender does not know whether a `Return` will be sent, it must release all state # related to the call when it sends `Finish`. However, in the case that the callee does not # recognize this hint and chooses to send a `Return`, then technically the caller is not allowed # to reuse the question ID until it receives said `Return`. This creates a conundrum: How does # the caller decide when it's OK to reuse the ID? To sidestep the problem, the C++ implementation # uses high-numbered IDs (with the high-order bit set) for such calls, and cycles through the # IDs in order. If all 2^31 IDs in this space are used without ever seeing a `Return`, then the # implementation assumes that the other end is in fact honoring the hint, and the ID counter is # allowed to loop around. If a `Return` is ever seen when `onlyPromisePipeline` was set, then # the implementation stops using this hint. params @4 :Payload; # The call parameters. `params.content` is a struct whose fields correspond to the parameters of # the method. sendResultsTo :union { # Where should the return message be sent? caller @5 :Void; # Send the return message back to the caller (the usual). yourself @6 :Void; # **(level 1)** # # Don't actually return the results to the sender. Instead, hold on to them and await # instructions from the sender regarding what to do with them. In particular, the sender # may subsequently send a `Return` for some other call (which the receiver had previously made # to the sender) with `takeFromOtherQuestion` set. The results from this call are then used # as the results of the other call. # # When `yourself` is used, the receiver must still send a `Return` for the call, but sets the # field `resultsSentElsewhere` in that `Return` rather than including the results. # # This feature can be used to implement tail calls in which a call from Vat A to Vat B ends up # returning the result of a call from Vat B back to Vat A. # # In particular, the most common use case for this feature is when Vat A makes a call to a # promise in Vat B, and then that promise ends up resolving to a capability back in Vat A. # Vat B must forward all the queued calls on that promise back to Vat A, but can set `yourself` # in the calls so that the results need not pass back through Vat B. # # For example: # - Alice, in Vat A, calls foo() on Bob in Vat B. # - Alice makes a pipelined call bar() on the promise returned by foo(). # - Later on, Bob resolves the promise from foo() to point at Carol, who lives in Vat A (next # to Alice). # - Vat B dutifully forwards the bar() call to Carol. Let us call this forwarded call bar'(). # Notice that bar() and bar'() are travelling in opposite directions on the same network # link. # - The `Call` for bar'() has `sendResultsTo` set to `yourself`. # - Vat B sends a `Return` for bar() with `takeFromOtherQuestion` set in place of the results, # with the value set to the question ID of bar'(). Vat B does not wait for bar'() to return, # as doing so would introduce unnecessary round trip latency. # - Vat A receives bar'() and delivers it to Carol. # - When bar'() returns, Vat A sends a `Return` for bar'() to Vat B, with `resultsSentElsewhere` # set in place of results. # - Vat A sends a `Finish` for the bar() call to Vat B. # - Vat B receives the `Finish` for bar() and sends a `Finish` for bar'(). thirdParty @7 :RecipientId; # **(level 3)** # # The call's result should be returned to a different vat. The receiver (the callee) expects # to receive an `Accept` message from the indicated vat, and should return the call's result # to it, rather than to the sender of the `Call`. # # This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` # messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from # Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends # an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C # also sends a `Return` to Vat B with `resultsSentElsewhere`. } } struct Return { # **(level 0)** # # Message type sent from callee to caller indicating that the call has completed. answerId @0 :AnswerId; # Equal to the QuestionId of the corresponding `Call` message. releaseParamCaps @1 :Bool = true; # If true, all capabilities that were in the params should be considered released. The sender # must not send separate `Release` messages for them. Level 0 implementations in particular # should always set this true. This defaults true because if level 0 implementations forget to # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget # to set it to false they'll quickly get errors. # # The receiver should act as if the sender had sent a release message with count=1 for each # CapDescriptor in the original Call message. noFinishNeeded @8 :Bool = false; # If true, the sender does not need the receiver to send a `Finish` message; its answer table # entry has already been cleaned up. This implies that the results do not contain any # capabilities, since the `Finish` message would normally release those capabilities from # promise pipelining responsibility. The caller may still send a `Finish` message if it wants, # which will be silently ignored by the callee. union { results @2 :Payload; # The result. # # For regular method calls, `results.content` points to the result struct. # # For a `Return` in response to an `Accept` or `Bootstrap`, `results` contains a single # capability (rather than a struct), and `results.content` is just a capability pointer with # index 0. A `Finish` is still required in this case. exception @3 :Exception; # Indicates that the call failed and explains why. canceled @4 :Void; # Indicates that the call was canceled due to the caller sending a Finish message # before the call had completed. resultsSentElsewhere @5 :Void; # This is set when returning from a `Call` that had `sendResultsTo` set to something other # than `caller`. # # It doesn't matter too much when this is sent, as the receiver doesn't need to do anything # with it, but the C++ implementation appears to wait for the call to finish before sending # this. takeFromOtherQuestion @6 :QuestionId; # The sender has also sent (before this message) a `Call` with the given question ID and with # `sendResultsTo.yourself` set, and the results of that other call should be used as the # results here. `takeFromOtherQuestion` can only used once per question. acceptFromThirdParty @7 :ThirdPartyCapId; # **(level 3)** # # The caller should contact a third-party vat to pick up the results. An `Accept` message # sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`. # It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set. } } struct Finish { # **(level 0)** # # Message type sent from the caller to the callee to indicate: # 1) The questionId will no longer be used in any messages sent by the callee (no further # pipelined requests). # 2) If the call has not returned yet, the caller no longer cares about the result. If nothing # else cares about the result either (e.g. there are no other outstanding calls pipelined on # the result of this one) then the callee may wish to immediately cancel the operation and # send back a Return message with "canceled" set. However, implementations are not required # to support premature cancellation -- instead, the implementation may wait until the call # actually completes and send a normal `Return` message. # # TODO(someday): Should we separate (1) and implicitly releasing result capabilities? It would be # possible and useful to notify the server that it doesn't need to keep around the response to # service pipeline requests even though the caller still wants to receive it / hasn't yet # finished processing it. It could also be useful to notify the server that it need not marshal # the results because the caller doesn't want them anyway, even if the caller is still sending # pipelined calls, although this seems less useful (just saving some bytes on the wire). questionId @0 :QuestionId; # ID of the call whose result is to be released. releaseResultCaps @1 :Bool = true; # If true, all capabilities that were in the results should be considered released. The sender # must not send separate `Release` messages for them. Level 0 implementations in particular # should always set this true. This defaults true because if level 0 implementations forget to # set it they'll never notice (just silently leak caps), but if level >=1 implementations forget # set it false they'll quickly get errors. requireEarlyCancellationWorkaround @2 :Bool = true; # If true, if the RPC system receives this Finish message before the original call has even been # delivered, it should defer cancellation util after delivery. In particular, this gives the # destination object a chance to opt out of cancellation, e.g. as controlled by the # `allowCancellation` annotation defined in `c++.capnp`. # # This is a work-around. Versions 1.0 and up of Cap'n Proto always set this to false. However, # older versions of Cap'n Proto unintentionally exhibited this errant behavior by default, and # as a result programs built with older versions could be inadvertently relying on their peers # to implement the behavior. The purpose of this flag is to let newer versions know when the # peer is an older version, so that it can attempt to work around the issue. # # See also comments in handleFinish() in rpc.c++ for more details. } # Level 1 message types ---------------------------------------------- struct Resolve { # **(level 1)** # # Message type sent to indicate that a previously-sent promise has now been resolved to some other # object (possibly another promise) -- or broken, or canceled. # # Keep in mind that it's possible for a `Resolve` to be sent to a level 0 implementation that # doesn't implement it. For example, a method call or return might contain a capability in the # payload. Normally this is fine even if the receiver is level 0, because they will implicitly # release all such capabilities on return / finish. But if the cap happens to be a promise, then # a follow-up `Resolve` may be sent regardless of this release. The level 0 receiver will reply # with an `unimplemented` message, and the sender (of the `Resolve`) can respond to this as if the # receiver had immediately released any capability to which the promise resolved. # # When implementing promise resolution, it's important to understand how embargos work and the # tricky case of the Tribble 4-way race condition. See the comments for the Disembargo message, # below. promiseId @0 :ExportId; # The ID of the promise to be resolved. # # Unlike all other instances of `ExportId` sent from the exporter, the `Resolve` message does # _not_ increase the reference count of `promiseId`. In fact, it is expected that the receiver # will release the export soon after receiving `Resolve`, and the sender will not send this # `ExportId` again until it has been released and recycled. # # When an export ID sent over the wire (e.g. in a `CapDescriptor`) is indicated to be a promise, # this indicates that the sender will follow up at some point with a `Resolve` message. If the # same `promiseId` is sent again before `Resolve`, still only one `Resolve` is sent. If the # same ID is sent again later _after_ a `Resolve`, it can only be because the export's # reference count hit zero in the meantime and the ID was re-assigned to a new export, therefore # this later promise does _not_ correspond to the earlier `Resolve`. # # If a promise ID's reference count reaches zero before a `Resolve` is sent, the `Resolve` # message may or may not still be sent (the `Resolve` may have already been in-flight when # `Release` was sent, but if the `Release` is received before `Resolve` then there is no longer # any reason to send a `Resolve`). Thus a `Resolve` may be received for a promise of which # the receiver has no knowledge, because it already released it earlier. In this case, the # receiver should simply release the capability to which the promise resolved. union { cap @1 :CapDescriptor; # The object to which the promise resolved. # # The sender promises that from this point forth, until `promiseId` is released, it shall # simply forward all messages to the capability designated by `cap`. This is true even if # `cap` itself happens to designate another promise, and that other promise later resolves -- # messages sent to `promiseId` shall still go to that other promise, not to its resolution. # This is important in the case that the receiver of the `Resolve` ends up sending a # `Disembargo` message towards `promiseId` in order to control message ordering -- that # `Disembargo` really needs to reflect back to exactly the object designated by `cap` even # if that object is itself a promise. exception @2 :Exception; # Indicates that the promise was broken. } } struct Release { # **(level 1)** # # Message type sent to indicate that the sender is done with the given capability and the receiver # can free resources allocated to it. id @0 :ImportId; # What to release. referenceCount @1 :UInt32; # The amount by which to decrement the reference count. The export is only actually released # when the reference count reaches zero. } struct Disembargo { # **(level 1)** # # Message sent to indicate that an embargo on a recently-resolved promise may now be lifted. # # Embargos are used to enforce E-order in the presence of promise resolution. That is, if an # application makes two calls foo() and bar() on the same capability reference, in that order, # the calls should be delivered in the order in which they were made. But if foo() is called # on a promise, and that promise happens to resolve before bar() is called, then the two calls # may travel different paths over the network, and thus could arrive in the wrong order. In # this case, the call to `bar()` must be embargoed, and a `Disembargo` message must be sent along # the same path as `foo()` to ensure that the `Disembargo` arrives after `foo()`. Once the # `Disembargo` arrives, `bar()` can then be delivered. # # There are two particular cases where embargos are important. Consider object Alice, in Vat A, # who holds a promise P, pointing towards Vat B, that eventually resolves to Carol. The two # cases are: # - Carol lives in Vat A, i.e. next to Alice. In this case, Vat A needs to send a `Disembargo` # message that echos through Vat B and back, to ensure that all pipelined calls on the promise # have been delivered. # - Carol lives in a different Vat C. When the promise resolves, a three-party handoff occurs # (see `Provide` and `Accept`, which constitute level 3 of the protocol). In this case, we # piggyback on the state that has already been set up to handle the handoff: the `Accept` # message (from Vat A to Vat C) is embargoed, as are all pipelined messages sent to it, while # a `Disembargo` message is sent from Vat A through Vat B to Vat C. See `Accept.embargo` for # an example. # # Note that in the case where Carol actually lives in Vat B (i.e., the same vat that the promise # already pointed at), no embargo is needed, because the pipelined calls are delivered over the # same path as the later direct calls. # # Keep in mind that promise resolution happens both in the form of Resolve messages as well as # Return messages (which resolve PromisedAnswers). Embargos apply in both cases. # # An alternative strategy for enforcing E-order over promise resolution could be for Vat A to # implement the embargo internally. When Vat A is notified of promise resolution, it could # send a dummy no-op call to promise P and wait for it to complete. Until that call completes, # all calls to the capability are queued locally. This strategy works, but is pessimistic: # in the three-party case, it requires an A -> B -> C -> B -> A round trip before calls can start # being delivered directly to from Vat A to Vat C. The `Disembargo` message allows latency to be # reduced. (In the two-party loopback case, the `Disembargo` message is just a more explicit way # of accomplishing the same thing as a no-op call, but isn't any faster.) # # *The Tribble 4-way Race Condition* # # Any implementation of promise resolution and embargos must be aware of what we call the # "Tribble 4-way race condition", after Dean Tribble, who explained the problem in a lively # Friam meeting. # # Embargos are designed to work in the case where a two-hop path is being shortened to one hop. # But sometimes there are more hops. Imagine that Alice has a reference to a remote promise P1 # that eventually resolves to _another_ remote promise P2 (in a third vat), which _at the same # time_ happens to resolve to Bob (in a fourth vat). In this case, we're shortening from a 3-hop # path (with four parties) to a 1-hop path (Alice -> Bob). # # Extending the embargo/disembargo protocol to be able to shorted multiple hops at once seems # difficult. Instead, we make a rule that prevents this case from coming up: # # One a promise P has been resolved to a remote object reference R, then all further messages # received addressed to P will be forwarded strictly to R. Even if it turns out later that R is # itself a promise, and has resolved to some other object Q, messages sent to P will still be # forwarded to R, not directly to Q (R will of course further forward the messages to Q). # # This rule does not cause a significant performance burden because once P has resolved to R, it # is expected that people sending messages to P will shortly start sending them to R instead and # drop P. P is at end-of-life anyway, so it doesn't matter if it ignores chances to further # optimize its path. # # Note well: the Tribble 4-way race condition does not require each vat to be *distinct*; as long # as each resolution crosses a network boundary the race can occur -- so this concerns even level # 1 implementations, not just level 3 implementations. target @0 :MessageTarget; # What is to be disembargoed. using EmbargoId = UInt32; # Used in `senderLoopback` and `receiverLoopback`, below. context :union { senderLoopback @1 :EmbargoId; # The sender is requesting a disembargo on a promise that is known to resolve back to a # capability hosted by the sender. As soon as the receiver has echoed back all pipelined calls # on this promise, it will deliver the Disembargo back to the sender with `receiverLoopback` # set to the same value as `senderLoopback`. This value is chosen by the sender, and since # it is also consumed be the sender, the sender can use whatever strategy it wants to make sure # the value is unambiguous. # # The receiver must verify that the target capability actually resolves back to the sender's # vat. Otherwise, the sender has committed a protocol error and should be disconnected. receiverLoopback @2 :EmbargoId; # The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to # this capability, and that Disembargo is now being echoed back. accept @3 :Void; # **(level 3)** # # The sender is requesting a disembargo on a promise that is known to resolve to a third-party # capability that the sender is currently in the process of accepting (using `Accept`). # The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The # receiver should now send a `Disembargo` with `provide` set to the question ID of that # `Provide` message. # # See `Accept.embargo` for an example. provide @4 :QuestionId; # **(level 3)** # # The sender is requesting a disembargo on a capability currently being provided to a third # party. The question ID identifies the `Provide` message previously sent by the sender to # this capability. On receipt, the receiver (the capability host) shall release the embargo # on the `Accept` message that it has received from the third party. See `Accept.embargo` for # an example. } } # Level 2 message types ---------------------------------------------- # See persistent.capnp. # Level 3 message types ---------------------------------------------- struct Provide { # **(level 3)** # # Message type sent to indicate that the sender wishes to make a particular capability implemented # by the receiver available to a third party for direct access (without the need for the third # party to proxy through the sender). # # (In CapTP, `Provide` and `Accept` are methods of the global `NonceLocator` object exported by # every vat. In Cap'n Proto, we bake this into the core protocol.) questionId @0 :QuestionId; # Question ID to be held open until the recipient has received the capability. A result will be # returned once the third party has successfully received the capability. The sender must at some # point send a `Finish` message as with any other call, and that message can be used to cancel the # whole operation. target @1 :MessageTarget; # What is to be provided to the third party. recipient @2 :RecipientId; # Identity of the third party that is expected to pick up the capability. } struct Accept { # **(level 3)** # # Message type sent to pick up a capability hosted by the receiving vat and provided by a third # party. The third party previously designated the capability using `Provide`. # # This message is also used to pick up a redirected return -- see `Return.acceptFromThirdParty`. questionId @0 :QuestionId; # A new question ID identifying this accept message, which will eventually receive a Return # message containing the provided capability (or the call result in the case of a redirected # return). provision @1 :ProvisionId; # Identifies the provided object to be picked up. embargo @2 :Bool; # If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent, # and any pipelined calls will not be delivered, until the embargo is released. The receiver # (the capability host) will expect the provider (the vat that sent the `Provide` message) to # eventually send a `Disembargo` message with the field `context.provide` set to the question ID # of the original `Provide` message. At that point, the embargo is released and the queued # messages are delivered. # # For example: # - Alice, in Vat A, holds a promise P, which currently points toward Vat B. # - Alice calls foo() on P. The `Call` message is sent to Vat B. # - The promise P in Vat B ends up resolving to Carol, in Vat C. # - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient. # - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a # `ThirdPartyCapId` identifying Carol in Vat C. # - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that # it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept` # message. # - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set. # - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't # know anything about the mechanics of promise resolution happening under the hood, but she # expects that bar() will be delivered after foo() because that is the order in which she # initiated the calls. # - Vat A sends the bar() call to Vat C, as a pipelined call on the result of the `Accept` (which # hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability # are embargoed, Vat C does not deliver the call yet. # - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C. # - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the # question ID of the `Provide` message it had sent previously. # - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo() # before delivering bar(). # - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from # Vat A, as well as deliver bar(). } # Level 4 message types ---------------------------------------------- struct Join { # **(level 4)** # # Message type sent to implement E.join(), which, given a number of capabilities that are # expected to be equivalent, finds the underlying object upon which they all agree and forms a # direct connection to it, skipping any proxies that may have been constructed by other vats # while transmitting the capability. See: # http://erights.org/elib/equality/index.html # # Note that this should only serve to bypass fully-transparent proxies -- proxies that were # created merely for convenience, without any intention of hiding the underlying object. # # For example, say Bob holds two capabilities hosted by Alice and Carol, but he expects that both # are simply proxies for a capability hosted elsewhere. He then issues a join request, which # operates as follows: # - Bob issues Join requests on both Alice and Carol. Each request contains a different piece # of the JoinKey. # - Alice is proxying a capability hosted by Dana, so forwards the request to Dana's cap. # - Dana receives the first request and sees that the JoinKeyPart is one of two. She notes that # she doesn't have the other part yet, so she records the request and responds with a # JoinResult. # - Alice relays the JoinAnswer back to Bob. # - Carol is also proxying a capability from Dana, and so forwards her Join request to Dana as # well. # - Dana receives Carol's request and notes that she now has both parts of a JoinKey. She # combines them in order to form information needed to form a secure connection to Bob. She # also responds with another JoinResult. # - Bob receives the responses from Alice and Carol. He uses the returned JoinResults to # determine how to connect to Dana and attempts to form the connection. Since Bob and Dana now # agree on a secret key that neither Alice nor Carol ever saw, this connection can be made # securely even if Alice or Carol is conspiring against the other. (If Alice and Carol are # conspiring _together_, they can obviously reproduce the key, but this doesn't matter because # the whole point of the join is to verify that Alice and Carol agree on what capability they # are proxying.) # # If the two capabilities aren't actually proxies of the same object, then the join requests # will come back with conflicting `hostId`s and the join will fail before attempting to form any # connection. questionId @0 :QuestionId; # Question ID used to respond to this Join. (Note that this ID only identifies one part of the # request for one hop; each part has a different ID and relayed copies of the request have # (probably) different IDs still.) # # The receiver will reply with a `Return` whose `results` is a JoinResult. This `JoinResult` # is relayed from the joined object's host, possibly with transformation applied as needed # by the network. # # Like any return, the result must be released using a `Finish`. However, this release # should not occur until the joiner has either successfully connected to the joined object. # Vats relaying a `Join` message similarly must not release the result they receive until the # return they relayed back towards the joiner has itself been released. This allows the # joined object's host to detect when the Join operation is canceled before completing -- if # it receives a `Finish` for one of the join results before the joiner successfully # connects. It can then free any resources it had allocated as part of the join. target @1 :MessageTarget; # The capability to join. keyPart @2 :JoinKeyPart; # A part of the join key. These combine to form the complete join key, which is used to establish # a direct connection. # TODO(before implementing): Change this so that multiple parts can be sent in a single Join # message, so that if multiple join parts are going to cross the same connection they can be sent # together, so that the receive can potentially optimize its handling of them. In the case where # all parts are bundled together, should the recipient be expected to simply return a cap, so # that the caller can immediately start pipelining to it? } # ======================================================================================== # Common structures used in messages struct MessageTarget { # The target of a `Call` or other messages that target a capability. union { importedCap @0 :ImportId; # This message is to a capability or promise previously imported by the caller (exported by # the receiver). promisedAnswer @1 :PromisedAnswer; # This message is to a capability that is expected to be returned by another call that has not # yet been completed. # # At level 0, this is supported only for addressing the result of a previous `Bootstrap`, so # that initial startup doesn't require a round trip. } } struct Payload { # Represents some data structure that might contain capabilities. content @0 :AnyPointer; # Some Cap'n Proto data structure. Capability pointers embedded in this structure index into # `capTable`. capTable @1 :List(CapDescriptor); # Descriptors corresponding to the cap pointers in `content`. } struct CapDescriptor { # **(level 1)** # # When an application-defined type contains an interface pointer, that pointer contains an index # into the message's capability table -- i.e. the `capTable` part of the `Payload`. Each # capability in the table is represented as a `CapDescriptor`. The runtime API should not reveal # the CapDescriptor directly to the application, but should instead wrap it in some kind of # callable object with methods corresponding to the interface that the capability implements. # # Keep in mind that `ExportIds` in a `CapDescriptor` are subject to reference counting. See the # description of `ExportId`. # # Note that it is currently not possible to include a broken capability in the CapDescriptor # table. Instead, create a new export (`senderPromise`) for each broken capability and then # immediately follow the payload-bearing Call or Return message with one Resolve message for each # broken capability, resolving it to an exception. union { none @0 :Void; # There is no capability here. This `CapDescriptor` should not appear in the payload content. # A `none` CapDescriptor can be generated when an application inserts a capability into a # message and then later changes its mind and removes it -- rewriting all of the other # capability pointers may be hard, so instead a tombstone is left, similar to the way a removed # struct or list instance is zeroed out of the message but the space is not reclaimed. # Hopefully this is unusual. senderHosted @1 :ExportId; # The ID of a capability in the sender's export table (receiver's import table). It may be a # newly allocated table entry, or an existing entry (increments the reference count). senderPromise @2 :ExportId; # A promise that the sender will resolve later. The sender will send exactly one Resolve # message at a future point in time to replace this promise. Note that even if the same # `senderPromise` is received multiple times, only one `Resolve` is sent to cover all of # them. If `senderPromise` is released before the `Resolve` is sent, the sender (of this # `CapDescriptor`) may choose not to send the `Resolve` at all. receiverHosted @3 :ImportId; # A capability (or promise) previously exported by the receiver (imported by the sender). receiverAnswer @4 :PromisedAnswer; # A capability expected to be returned in the results of a currently-outstanding call posed # by the sender. thirdPartyHosted @5 :ThirdPartyCapDescriptor; # **(level 3)** # # A capability that lives in neither the sender's nor the receiver's vat. The sender needs # to form a direct connection to a third party to pick up the capability. # # Level 1 and 2 implementations that receive a `thirdPartyHosted` may simply send calls to its # `vine` instead. } attachedFd @6 :UInt8 = 0xff; # If the RPC message in which this CapDescriptor was delivered also had file descriptors # attached, and `fd` is a valid index into the list of attached file descriptors, then # that file descriptor should be attached to this capability. If `attachedFd` is out-of-bounds # for said list, then no FD is attached. # # For example, if the RPC message arrived over a Unix socket, then file descriptors may be # attached by sending an SCM_RIGHTS ancillary message attached to the data bytes making up the # raw message. Receivers who wish to opt into FD passing should arrange to receive SCM_RIGHTS # whenever receiving an RPC message. Senders who wish to send FDs need not verify whether the # receiver knows how to receive them, because the operating system will automatically discard # ancillary messages like SCM_RIGHTS if the receiver doesn't ask to receive them, including # automatically closing any FDs. # # It is up to the application protocol to define what capabilities are expected to have file # descriptors attached, and what those FDs mean. But, for example, an application could use this # to open a file on disk and then transmit the open file descriptor to a sandboxed process that # does not otherwise have permission to access the filesystem directly. This is usually an # optimization: the sending process could instead provide an RPC interface supporting all the # operations needed (such as reading and writing a file), but by passing the file descriptor # directly, the recipient can often perform operations much more efficiently. Application # designers are encouraged to provide such RPC interfaces and automatically fall back to them # when FD passing is not available, so that the application can still work when the parties are # remote over a network. # # An attached FD is most often associated with a `senderHosted` descriptor. It could also make # sense in the case of `thirdPartyHosted`: in this case, the sender is forwarding the FD that # they received from the third party, so that the receiver can start using it without first # interacting with the third party. This is an optional optimization -- the middleman may choose # not to forward capabilities, in which case the receiver will need to complete the handshake # with the third party directly before receiving the FD. If an implementation receives a second # attached FD after having already received one previously (e.g. both in a `thirdPartyHosted` # CapDescriptor and then later again when receiving the final capability directly from the # third party), the implementation should discard the later FD and stick with the original. At # present, there is no known reason why other capability types (e.g. `receiverHosted`) would want # to carry an attached FD, but we reserve the right to define a meaning for this in the future. # # Each file descriptor attached to the message must be used in no more than one CapDescriptor, # so that the receiver does not need to use dup() or refcounting to handle the possibility of # multiple capabilities using the same descriptor. If multiple CapDescriptors do point to the # same FD index, then the receiver can arbitrarily choose which capability ends up having the # FD attached. # # To mitigate DoS attacks, RPC implementations should limit the number of FDs they are willing to # receive in a single message to a small value. If a message happens to contain more than that, # the list is truncated. Moreover, in some cases, FD passing needs to be blocked entirely for # security or implementation reasons, in which case the list may be truncated to zero. Hence, # `attachedFd` might point past the end of the list, which the implementation should treat as if # no FD was attached at all. # # The type of this field was chosen to be UInt8 because Linux supports sending only a maximum # of 253 file descriptors in an SCM_RIGHTS message anyway, and CapDescriptor had two bytes of # padding left -- so after adding this, there is still one byte for a future feature. # Conveniently, this also means we're able to use 0xff as the default value, which will always # be out-of-range (of course, the implementation should explicitly enforce that 255 descriptors # cannot be sent at once, rather than relying on Linux to do so). } struct PromisedAnswer { # **(mostly level 1)** # # Specifies how to derive a promise from an unanswered question, by specifying the path of fields # to follow from the root of the eventual result struct to get to the desired capability. Used # to address method calls to a not-yet-returned capability or to pass such a capability as an # input to some other method call. # # Level 0 implementations must support `PromisedAnswer` only for the case where the answer is # to a `Bootstrap` message. In this case, `path` is always empty since `Bootstrap` always returns # a raw capability. questionId @0 :QuestionId; # ID of the question (in the sender's question table / receiver's answer table) whose answer is # expected to contain the capability. transform @1 :List(Op); # Operations / transformations to apply to the result in order to get the capability actually # being addressed. E.g. if the result is a struct and you want to call a method on a capability # pointed to by a field of the struct, you need a `getPointerField` op. struct Op { union { noop @0 :Void; # Does nothing. This member is mostly defined so that we can make `Op` a union even # though (as of this writing) only one real operation is defined. getPointerField @1 :UInt16; # Get a pointer field within a struct. The number is an index into the pointer section, NOT # a field ordinal, so that the receiver does not need to understand the schema. # TODO(someday): We could add: # - For lists, the ability to address every member of the list, or a slice of the list, the # result of which would be another list. This is useful for implementing the equivalent of # a SQL table join (not to be confused with the `Join` message type). # - Maybe some ability to test a union. # - Probably not a good idea: the ability to specify an arbitrary script to run on the # result. We could define a little stack-based language where `Op` specifies one # "instruction" or transformation to apply. Although this is not a good idea # (over-engineered), any narrower additions to `Op` should be designed as if this # were the eventual goal. } } } struct ThirdPartyCapDescriptor { # **(level 3)** # # Identifies a capability in a third-party vat that the sender wants the receiver to pick up. id @0 :ThirdPartyCapId; # Identifies the third-party host and the specific capability to accept from it. vineId @1 :ExportId; # A proxy for the third-party object exported by the sender. In CapTP terminology this is called # a "vine", because it is an indirect reference to the third-party object that snakes through the # sender vat. This serves two purposes: # # * Level 1 and 2 implementations that don't understand how to connect to a third party may # simply send calls to the vine. Such calls will be forwarded to the third-party by the # sender. # # * Level 3 implementations must release the vine only once they have successfully picked up the # object from the third party. This ensures that the capability is not released by the sender # prematurely. # # The sender will close the `Provide` request that it has sent to the third party as soon as # it receives either a `Call` or a `Release` message directed at the vine. } struct Exception { # **(level 0)** # # Describes an arbitrary error that prevented an operation (e.g. a call) from completing. # # Cap'n Proto exceptions always indicate that something went wrong. In other words, in a fantasy # world where everything always works as expected, no exceptions would ever be thrown. Clients # should only ever catch exceptions as a means to implement fault-tolerance, where "fault" can # mean: # - Bugs. # - Invalid input. # - Configuration errors. # - Network problems. # - Insufficient resources. # - Version skew (unimplemented functionality). # - Other logistical problems. # # Exceptions should NOT be used to flag application-specific conditions that a client is expected # to handle in an application-specific way. Put another way, in the Cap'n Proto world, # "checked exceptions" (where an interface explicitly defines the exceptions it throws and # clients are forced by the type system to handle those exceptions) do NOT make sense. reason @0 :Text; # Human-readable failure description. type @3 :Type; # The type of the error. The purpose of this enum is not to describe the error itself, but # rather to describe how the client might want to respond to the error. enum Type { failed @0; # A generic problem occurred, and it is believed that if the operation were repeated without # any change in the state of the world, the problem would occur again. # # A client might respond to this error by logging it for investigation by the developer and/or # displaying it to the user. overloaded @1; # The request was rejected due to a temporary lack of resources. # # Examples include: # - There's not enough CPU time to keep up with incoming requests, so some are rejected. # - The server ran out of RAM or disk space during the request. # - The operation timed out (took significantly longer than it should have). # # A client might respond to this error by scheduling to retry the operation much later. The # client should NOT retry again immediately since this would likely exacerbate the problem. disconnected @2; # The method failed because a connection to some necessary capability was lost. # # Examples include: # - The client introduced the server to a third-party capability, the connection to that third # party was subsequently lost, and then the client requested that the server use the dead # capability for something. # - The client previously requested that the server obtain a capability from some third party. # The server returned a capability to an object wrapping the third-party capability. Later, # the server's connection to the third party was lost. # - The capability has been revoked. Revocation does not necessarily mean that the client is # no longer authorized to use the capability; it is often used simply as a way to force the # client to repeat the setup process, perhaps to efficiently move them to a new back-end or # get them to recognize some other change that has occurred. # # A client should normally respond to this error by releasing all capabilities it is currently # holding related to the one it called and then re-creating them by restoring SturdyRefs and/or # repeating the method calls used to create them originally. In other words, disconnect and # start over. This should in turn cause the server to obtain a new copy of the capability that # it lost, thus making everything work. # # If the client receives another `disconnected` error in the process of rebuilding the # capability and retrying the call, it should treat this as an `overloaded` error: the network # is currently unreliable, possibly due to load or other temporary issues. unimplemented @3; # The server doesn't implement the requested method. If there is some other method that the # client could call (perhaps an older and/or slower interface), it should try that instead. # Otherwise, this should be treated like `failed`. } obsoleteIsCallersFault @1 :Bool; # OBSOLETE. Ignore. obsoleteDurability @2 :UInt16; # OBSOLETE. See `type` instead. trace @4 :Text; # Stack trace text from the remote server. The format is not specified. By default, # implementations do not provide stack traces; the application must explicitly enable them # when desired. } # ======================================================================================== # Network-specific Parameters # # Some parts of the Cap'n Proto RPC protocol are not specified here because different vat networks # may wish to use different approaches to solving them. For example, on the public internet, you # may want to authenticate vats using public-key cryptography, but on a local intranet with trusted # infrastructure, you may be happy to authenticate based on network address only, or some other # lightweight mechanism. # # To accommodate this, we specify several "parameter" types. Each type is defined here as an # alias for `AnyPointer`, but a specific network will want to define a specific set of types to use. # All vats in a vat network must agree on these parameters in order to be able to communicate. # Inter-network communication can be accomplished through "gateways" that perform translation # between the primitives used on each network; these gateways may need to be deeply stateful, # depending on the translations they perform. # # For interaction over the global internet between parties with no other prior arrangement, a # particular set of bindings for these types is defined elsewhere. (TODO(someday): Specify where # these common definitions live.) # # Another common network type is the two-party network, in which one of the parties typically # interacts with the outside world entirely through the other party. In such a connection between # Alice and Bob, all objects that exist on Bob's other networks appear to Alice as if they were # hosted by Bob himself, and similarly all objects on Alice's network (if she even has one) appear # to Bob as if they were hosted by Alice. This network type is interesting because from the point # of view of a simple application that communicates with only one other party via the two-party # protocol, there are no three-party interactions at all, and joins are unusually simple to # implement, so implementing at level 4 is barely more complicated than implementing at level 1. # Moreover, if you pair an app implementing the two-party network with a container that implements # some other network, the app can then participate on the container's network just as if it # implemented that network directly. The types used by the two-party network are defined in # `rpc-twoparty.capnp`. # # The things that we need to parameterize are: # - How to store capabilities long-term without holding a connection open (mostly level 2). # - How to authenticate vats in three-party introductions (level 3). # - How to implement `Join` (level 4). # # Persistent references # --------------------- # # **(mostly level 2)** # # We want to allow some capabilities to be stored long-term, even if a connection is lost and later # recreated. ExportId is a short-term identifier that is specific to a connection, so it doesn't # help here. We need a way to specify long-term identifiers, as well as a strategy for # reconnecting to a referenced capability later. # # Three-party interactions # ------------------------ # # **(level 3)** # # In cases where more than two vats are interacting, we have situations where VatA holds a # capability hosted by VatB and wants to send that capability to VatC. This can be accomplished # by VatA proxying requests on the new capability, but doing so has two big problems: # - It's inefficient, requiring an extra network hop. # - If VatC receives another capability to the same object from VatD, it is difficult for VatC to # detect that the two capabilities are really the same and to implement the E "join" operation, # which is necessary for certain four-or-more-party interactions, such as the escrow pattern. # See: http://www.erights.org/elib/equality/grant-matcher/index.html # # Instead, we want a way for VatC to form a direct, authenticated connection to VatB. # # Join # ---- # # **(level 4)** # # The `Join` message type and corresponding operation arranges for a direct connection to be formed # between the joiner and the host of the joined object, and this connection must be authenticated. # Thus, the details are network-dependent. using SturdyRef = AnyPointer; # **(level 2)** # # Identifies a persisted capability that can be restored in the future. How exactly a SturdyRef # is restored to a live object is specified along with the SturdyRef definition (i.e. not by # rpc.capnp). # # Generally a SturdyRef needs to specify three things: # - How to reach the vat that can restore the ref (e.g. a hostname or IP address). # - How to authenticate the vat after connecting (e.g. a public key fingerprint). # - The identity of a specific object hosted by the vat. Generally, this is an opaque pointer whose # format is defined by the specific vat -- the client has no need to inspect the object ID. # It is important that the object ID be unguessable if the object is not public (and objects # should almost never be public). # # The above are only suggestions. Some networks might work differently. For example, a private # network might employ a special restorer service whose sole purpose is to restore SturdyRefs. # In this case, the entire contents of SturdyRef might be opaque, because they are intended only # to be forwarded to the restorer service. using ProvisionId = AnyPointer; # **(level 3)** # # The information that must be sent in an `Accept` message to identify the object being accepted. # # In a network where each vat has a public/private key pair, this could simply be the public key # fingerprint of the provider vat along with a nonce matching the one in the `RecipientId` used # in the `Provide` message sent from that provider. using RecipientId = AnyPointer; # **(level 3)** # # The information that must be sent in a `Provide` message to identify the recipient of the # capability. # # In a network where each vat has a public/private key pair, this could simply be the public key # fingerprint of the recipient along with a nonce matching the one in the `ProvisionId`. # # As another example, when communicating between processes on the same machine over Unix sockets, # RecipientId could simply refer to a file descriptor attached to the message via SCM_RIGHTS. # This file descriptor would be one end of a newly-created socketpair, with the other end having # been sent to the capability's recipient in ThirdPartyCapId. using ThirdPartyCapId = AnyPointer; # **(level 3)** # # The information needed to connect to a third party and accept a capability from it. # # In a network where each vat has a public/private key pair, this could be a combination of the # third party's public key fingerprint, hints on how to connect to the third party (e.g. an IP # address), and the nonce used in the corresponding `Provide` message's `RecipientId` as sent # to that third party (used to identify which capability to pick up). # # As another example, when communicating between processes on the same machine over Unix sockets, # ThirdPartyCapId could simply refer to a file descriptor attached to the message via SCM_RIGHTS. # This file descriptor would be one end of a newly-created socketpair, with the other end having # been sent to the process hosting the capability in RecipientId. using JoinKeyPart = AnyPointer; # **(level 4)** # # A piece of a secret key. One piece is sent along each path that is expected to lead to the same # place. Once the pieces are combined, a direct connection may be formed between the sender and # the receiver, bypassing any men-in-the-middle along the paths. See the `Join` message type. # # The motivation for Joins is discussed under "Supporting Equality" in the "Unibus" protocol # sketch: http://www.erights.org/elib/distrib/captp/unibus.html # # In a network where each vat has a public/private key pair and each vat forms no more than one # connection to each other vat, Joins will rarely -- perhaps never -- be needed, as objects never # need to be transparently proxied and references to the same object sent over the same connection # have the same export ID. Thus, a successful join requires only checking that the two objects # come from the same connection and have the same ID, and then completes immediately. # # However, in networks where two vats may form more than one connection between each other, or # where proxying of objects occurs, joins are necessary. # # Typically, each JoinKeyPart would include a fixed-length data value such that all value parts # XOR'd together forms a shared secret that can be used to form an encrypted connection between # the joiner and the joined object's host. Each JoinKeyPart should also include an indication of # how many parts to expect and a hash of the shared secret (used to match up parts). using JoinResult = AnyPointer; # **(level 4)** # # Information returned as the result to a `Join` message, needed by the joiner in order to form a # direct connection to a joined object. This might simply be the address of the joined object's # host vat, since the `JoinKey` has already been communicated so the two vats already have a shared # secret to use to authenticate each other. # # The `JoinResult` should also contain information that can be used to detect when the Join # requests ended up reaching different objects, so that this situation can be detected easily. # This could be a simple matter of including a sequence number -- if the joiner receives two # `JoinResult`s with sequence number 0, then they must have come from different objects and the # whole join is a failure. # ======================================================================================== # Network interface sketch # # The interfaces below are meant to be pseudo-code to illustrate how the details of a particular # vat network might be abstracted away. They are written like Cap'n Proto interfaces, but in # practice you'd probably define these interfaces manually in the target programming language. A # Cap'n Proto RPC implementation should be able to use these interfaces without knowing the # definitions of the various network-specific parameters defined above. # interface VatNetwork { # # Represents a vat network, with the ability to connect to particular vats and receive # # connections from vats. # # # # Note that methods returning a `Connection` may return a pre-existing `Connection`, and the # # caller is expected to find and share state with existing users of the connection. # # # Level 0 features ----------------------------------------------- # # connect(vatId :VatId) :Connection; # # Connect to the given vat. The transport should return a promise that does not # # resolve until authentication has completed, but allows messages to be pipelined in before # # that; the transport either queues these messages until authenticated, or sends them encrypted # # such that only the authentic vat would be able to decrypt them. The latter approach avoids a # # round trip for authentication. # # accept() :Connection; # # Wait for the next incoming connection and return it. Only connections formed by # # connect() are returned by this method. # # # Level 4 features ----------------------------------------------- # # newJoiner(count :UInt32) :NewJoinerResponse; # # Prepare a new Join operation, which will eventually lead to forming a new direct connection # # to the host of the joined capability. `count` is the number of capabilities to join. # # struct NewJoinerResponse { # joinKeyParts :List(JoinKeyPart); # # Key parts to send in Join messages to each capability. # # joiner :Joiner; # # Used to establish the final connection. # } # # interface Joiner { # addJoinResult(result :JoinResult) :Void; # # Add a JoinResult received in response to one of the `Join` messages. All `JoinResult`s # # returned from all paths must be added before trying to connect. # # connect() :ConnectionAndProvisionId; # # Try to form a connection to the joined capability's host, verifying that it has received # # all of the JoinKeyParts. Once the connection is formed, the caller should send an `Accept` # # message on it with the specified `ProvisionId` in order to receive the final capability. # } # # acceptConnectionFromJoiner(parts :List(JoinKeyPart), paths :List(VatPath)) # :ConnectionAndProvisionId; # # Called on a joined capability's host to receive the connection from the joiner, once all # # key parts have arrived. The caller should expect to receive an `Accept` message over the # # connection with the given ProvisionId. # } # # interface Connection { # # Level 0 features ----------------------------------------------- # # send(message :Message) :Void; # # Send the message. Returns successfully when the message (and all preceding messages) has # # been acknowledged by the recipient. # # receive() :Message; # # Receive the next message, and acknowledges receipt to the sender. Messages are received in # # the order in which they are sent. # # # Level 3 features ----------------------------------------------- # # introduceTo(recipient :Connection) :IntroductionInfo; # # Call before starting a three-way introduction, assuming a `Provide` message is to be sent on # # this connection and a `ThirdPartyCapId` is to be sent to `recipient`. # # struct IntroductionInfo { # sendToRecipient :ThirdPartyCapId; # sendToTarget :RecipientId; # } # # connectToIntroduced(capId :ThirdPartyCapId) :ConnectionAndProvisionId; # # Given a ThirdPartyCapId received over this connection, connect to the third party. The # # caller should then send an `Accept` message over the new connection. # # acceptIntroducedConnection(recipientId :RecipientId) :Connection; # # Given a RecipientId received in a `Provide` message on this `Connection`, wait for the # # recipient to connect, and return the connection formed. Usually, the first message received # # on the new connection will be an `Accept` message. # } # # struct ConnectionAndProvisionId { # # **(level 3)** # # connection :Connection; # # Connection on which to issue `Accept` message. # # provision :ProvisionId; # # `ProvisionId` to send in the `Accept` message. # } capnp-rpc-0.19.0/src/attach.rs000064400000000000000000000040041046102023000141750ustar 00000000000000// Copyright (c) 2013-2017 Sandstorm Development Group, Inc. and contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use futures::Future; use std::pin::Pin; use std::task::{Context, Poll}; pub struct AttachFuture where F: Future + Unpin, { original_future: F, value: Option, } impl Unpin for AttachFuture where F: Future + Unpin {} impl Future for AttachFuture where F: Future + Unpin, { type Output = F::Output; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { let result = Pin::new(&mut self.original_future).poll(cx); if result.is_ready() { self.value.take(); } result } } pub trait Attach: Future where Self: Unpin, { fn attach(self, value: T) -> AttachFuture where Self: Sized, { AttachFuture { original_future: self, value: Some(value), } } } impl Attach for F where F: Future + Unpin {} capnp-rpc-0.19.0/src/broken.rs000064400000000000000000000110321046102023000142100ustar 00000000000000// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use capnp::any_pointer; use capnp::private::capability::{ ClientHook, ParamsHook, PipelineHook, PipelineOp, RequestHook, ResultsHook, }; use capnp::Error; use capnp::capability::{Promise, RemotePromise}; use capnp::traits::ImbueMut; use std::rc::Rc; pub struct Pipeline { error: Error, } impl Pipeline { pub fn new(error: Error) -> Self { Self { error } } } impl PipelineHook for Pipeline { fn add_ref(&self) -> Box { Box::new(Self::new(self.error.clone())) } fn get_pipelined_cap(&self, _ops: &[PipelineOp]) -> Box { new_cap(self.error.clone()) } } pub struct Request { error: Error, message: ::capnp::message::Builder<::capnp::message::HeapAllocator>, cap_table: Vec>>, } impl Request { pub fn new(error: Error, _size_hint: Option<::capnp::MessageSize>) -> Self { Self { error, message: ::capnp::message::Builder::new_default(), cap_table: Vec::new(), } } } impl RequestHook for Request { fn get(&mut self) -> any_pointer::Builder { let mut result: any_pointer::Builder = self.message.get_root().unwrap(); result.imbue_mut(&mut self.cap_table); result } fn get_brand(&self) -> usize { 0 } fn send(self: Box) -> RemotePromise { let pipeline = Pipeline::new(self.error.clone()); RemotePromise { promise: Promise::err(self.error), pipeline: any_pointer::Pipeline::new(Box::new(pipeline)), } } fn tail_send(self: Box) -> Option<(u32, Promise<(), Error>, Box)> { None } } struct ClientInner { error: Error, _resolved: bool, brand: usize, } pub struct Client { inner: Rc, } impl Client { pub fn new(error: Error, resolved: bool, brand: usize) -> Self { Self { inner: Rc::new(ClientInner { error, _resolved: resolved, brand, }), } } } impl ClientHook for Client { fn add_ref(&self) -> Box { Box::new(Self { inner: self.inner.clone(), }) } fn new_call( &self, _interface_id: u64, _method_id: u16, size_hint: Option<::capnp::MessageSize>, ) -> ::capnp::capability::Request { ::capnp::capability::Request::new(Box::new(Request::new( self.inner.error.clone(), size_hint, ))) } fn call( &self, _interface_id: u64, _method_id: u16, _params: Box, _results: Box, ) -> Promise<(), Error> { Promise::err(self.inner.error.clone()) } fn get_ptr(&self) -> usize { (self.inner.as_ref()) as *const _ as usize } fn get_brand(&self) -> usize { self.inner.brand } fn get_resolved(&self) -> Option> { None } fn when_more_resolved(&self) -> Option, Error>> { None } fn when_resolved(&self) -> Promise<(), Error> { crate::rpc::default_when_resolved_impl(self) } } pub fn new_cap(exception: Error) -> Box { Box::new(Client::new(exception, false, 0)) } capnp-rpc-0.19.0/src/lib.rs000064400000000000000000000413151046102023000135050ustar 00000000000000// Copyright (c) 2013-2017 Sandstorm Development Group, Inc. and contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. //! An implementation of the [Cap'n Proto remote procedure call](https://capnproto.org/rpc.html) //! protocol. Includes all [Level 1](https://capnproto.org/rpc.html#protocol-features) features. //! //! # Example //! //! ```capnp //! # Cap'n Proto schema //! interface Foo { //! identity @0 (x: UInt32) -> (y: UInt32); //! } //! ``` //! //! ```ignore //! // Rust server defining an implementation of Foo. //! struct FooImpl; //! impl foo::Server for FooImpl { //! fn identity(&mut self, //! params: foo::IdentityParams, //! mut results: foo::IdentityResults) //! -> Promise<(), ::capnp::Error> //! { //! let x = pry!(params.get()).get_x(); //! results.get().set_y(x); //! Promise::ok(()) //! } //! } //! ``` //! //! ```ignore //! // Rust client calling a remote implementation of Foo. //! let mut request = foo_client.identity_request(); //! request.get().set_x(123); //! let promise = request.send().promise.and_then(|response| { //! println!("results = {}", response.get()?.get_y()); //! Ok(()) //! }); //! ``` //! //! For a more complete example, see use capnp::capability::Promise; use capnp::private::capability::ClientHook; use capnp::Error; use futures::channel::oneshot; use futures::{Future, FutureExt, TryFutureExt}; use std::cell::RefCell; use std::pin::Pin; use std::rc::{Rc, Weak}; use std::task::{Context, Poll}; pub use crate::rpc::Disconnector; use crate::task_set::TaskSet; pub use crate::reconnect::{auto_reconnect, lazy_auto_reconnect, SetTarget}; /// Code generated from /// [rpc.capnp](https://github.com/sandstorm-io/capnproto/blob/master/c%2B%2B/src/capnp/rpc.capnp). pub mod rpc_capnp; /// Code generated from /// [rpc-twoparty.capnp](https://github.com/sandstorm-io/capnproto/blob/master/c%2B%2B/src/capnp/rpc-twoparty.capnp). pub mod rpc_twoparty_capnp; /// Like `try!()`, but for functions that return a `Promise` rather than a `Result`. /// /// Unwraps a `Result`. In the case of an error `Err(e)`, immediately returns from the /// enclosing function with `Promise::err(e)`. #[macro_export] macro_rules! pry { ($expr:expr) => { match $expr { ::std::result::Result::Ok(val) => val, ::std::result::Result::Err(err) => { return ::capnp::capability::Promise::err(::std::convert::From::from(err)) } } }; } mod attach; mod broken; mod local; mod queued; mod reconnect; mod rpc; mod sender_queue; mod split; mod task_set; pub mod twoparty; use capnp::message; pub trait OutgoingMessage { fn get_body(&mut self) -> ::capnp::Result<::capnp::any_pointer::Builder>; fn get_body_as_reader(&self) -> ::capnp::Result<::capnp::any_pointer::Reader>; /// Sends the message. Returns a promise for the message that resolves once the send has completed. /// Dropping the returned promise does *not* cancel the send. fn send( self: Box, ) -> ( Promise>, Error>, Rc>, ); fn take(self: Box) -> ::capnp::message::Builder<::capnp::message::HeapAllocator>; } pub trait IncomingMessage { fn get_body(&self) -> ::capnp::Result<::capnp::any_pointer::Reader>; } pub trait Connection { fn get_peer_vat_id(&self) -> VatId; fn new_outgoing_message(&mut self, first_segment_word_size: u32) -> Box; /// Waits for a message to be received and returns it. If the read stream cleanly terminates, /// returns None. If any other problem occurs, returns an Error. fn receive_incoming_message(&mut self) -> Promise>, Error>; // Waits until all outgoing messages have been sent, then shuts down the outgoing stream. The // returned promise resolves after shutdown is complete. fn shutdown(&mut self, result: ::capnp::Result<()>) -> Promise<(), Error>; } pub trait VatNetwork { /// Returns None if `hostId` refers to the local vat. fn connect(&mut self, host_id: VatId) -> Option>>; /// Waits for the next incoming connection and return it. fn accept(&mut self) -> Promise>, ::capnp::Error>; fn drive_until_shutdown(&mut self) -> Promise<(), Error>; } /// A portal to objects available on the network. /// /// The RPC implemententation sits on top of an implementation of `VatNetwork`, which /// determines how to form connections between vats. The RPC implementation determines /// how to use such connections to manage object references and make method calls. /// /// At the moment, this is all rather more general than it needs to be, because the only /// implementation of `VatNetwork` is `twoparty::VatNetwork`. However, eventually we /// will need to have more sophisticated `VatNetwork` implementations, in order to support /// [level 3](https://capnproto.org/rpc.html#protocol-features) features. /// /// An `RpcSystem` is a `Future` and needs to be driven by a task executor. A common way /// accomplish that is to pass the `RpcSystem` to `tokio_core::reactor::Handle::spawn()`. #[must_use = "futures do nothing unless polled"] pub struct RpcSystem where VatId: 'static, { network: Box>, bootstrap_cap: Box, // XXX To handle three or more party networks, this should be a map from connection pointers // to connection states. connection_state: Rc>>>>, tasks: TaskSet, handle: crate::task_set::TaskSetHandle, } impl RpcSystem { /// Constructs a new `RpcSystem` with the given network and bootstrap capability. pub fn new( mut network: Box>, bootstrap: Option<::capnp::capability::Client>, ) -> Self { let bootstrap_cap = match bootstrap { Some(cap) => cap.hook, None => broken::new_cap(Error::failed("no bootstrap capability".to_string())), }; let (mut handle, tasks) = TaskSet::new(Box::new(SystemTaskReaper)); let mut handle1 = handle.clone(); handle.add(network.drive_until_shutdown().then(move |r| { let r = match r { Ok(()) => Ok(()), Err(e) => { if e.kind != ::capnp::ErrorKind::Disconnected { // Don't report disconnects as an error. Err(e) } else { Ok(()) } } }; handle1.terminate(r); Promise::ok(()) })); let mut result = Self { network, bootstrap_cap, connection_state: Rc::new(RefCell::new(None)), tasks, handle: handle.clone(), }; let accept_loop = result.accept_loop(); handle.add(accept_loop); result } /// Connects to the given vat and returns its bootstrap interface. pub fn bootstrap(&mut self, vat_id: VatId) -> T where T: ::capnp::capability::FromClientHook, { let Some(connection) = self.network.connect(vat_id) else { return T::new(self.bootstrap_cap.clone()); }; let connection_state = Self::get_connection_state( &self.connection_state, self.bootstrap_cap.clone(), connection, self.handle.clone(), ); let hook = rpc::ConnectionState::bootstrap(&connection_state); T::new(hook) } // not really a loop, because it doesn't need to be for the two party case fn accept_loop(&mut self) -> Promise<(), Error> { let connection_state_ref = self.connection_state.clone(); let bootstrap_cap = self.bootstrap_cap.clone(); let handle = self.handle.clone(); Promise::from_future(self.network.accept().map_ok(move |connection| { Self::get_connection_state(&connection_state_ref, bootstrap_cap, connection, handle); })) } // If `connection_state_ref` is not already populated, populates it with a new // `ConnectionState` built from a local bootstrap capability and `connection`, // spawning any background tasks onto `handle`. Returns the resulting value // held in `connection_state_ref`. fn get_connection_state( connection_state_ref: &Rc>>>>, bootstrap_cap: Box, connection: Box>, mut handle: crate::task_set::TaskSetHandle, ) -> Rc> { // TODO this needs to be updated once we allow more general VatNetworks. let (tasks, result) = match *connection_state_ref.borrow() { Some(ref connection_state) => { // return early. return connection_state.clone(); } None => { let (on_disconnect_fulfiller, on_disconnect_promise) = oneshot::channel::>(); let connection_state_ref1 = connection_state_ref.clone(); handle.add(on_disconnect_promise.then(move |shutdown_promise| { *connection_state_ref1.borrow_mut() = None; match shutdown_promise { Ok(s) => s, Err(e) => Promise::err(Error::failed(format!("{e}"))), } })); rpc::ConnectionState::new(bootstrap_cap, connection, on_disconnect_fulfiller) } }; *connection_state_ref.borrow_mut() = Some(result.clone()); handle.add(tasks); result } /// Returns a `Disconnector` future that can be run to cleanly close the connection to this `RpcSystem`'s network. /// You should get the `Disconnector` before you spawn the `RpcSystem`. pub fn get_disconnector(&self) -> rpc::Disconnector { rpc::Disconnector::new(self.connection_state.clone()) } } impl Future for RpcSystem where VatId: 'static, { type Output = Result<(), Error>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { Pin::new(&mut self.tasks).poll(cx) } } /// Creates a new local RPC client of type `C` out of an object that implements a server trait `S`. pub fn new_client(s: S) -> C where C: capnp::capability::FromServer, { capnp::capability::FromClientHook::new(Box::new(local::Client::new( >::from_server(s), ))) } /// Allows a server to recognize its own capabilities when passed back to it, and obtain the /// underlying Server objects associated with them. Holds only weak references to Server objects /// allowing Server objects to be dropped when dropped by the remote client. Call the `gc` method /// to reclaim memory used for Server objects that have been dropped. pub struct CapabilityServerSet where C: capnp::capability::FromServer, { caps: std::collections::HashMap>>, } impl Default for CapabilityServerSet where C: capnp::capability::FromServer, { fn default() -> Self { Self { caps: std::default::Default::default(), } } } impl CapabilityServerSet where C: capnp::capability::FromServer, { pub fn new() -> Self { Self::default() } /// Adds a new capability to the set and returns a client backed by it. pub fn new_client(&mut self, s: S) -> C { let dispatch = >::from_server(s); let wrapped = Rc::new(RefCell::new(dispatch)); let ptr = wrapped.as_ptr() as usize; self.caps.insert(ptr, Rc::downgrade(&wrapped)); capnp::capability::FromClientHook::new(Box::new(local::Client::from_rc(wrapped))) } /// Looks up a capability and returns its underlying server object, if found. /// Fully resolves the capability before looking it up. pub async fn get_local_server(&self, client: &C) -> Option>> where C: capnp::capability::FromClientHook, { let resolved: C = capnp::capability::get_resolved_cap( capnp::capability::FromClientHook::new(client.as_client_hook().add_ref()), ) .await; let hook = resolved.into_client_hook(); let ptr = hook.get_ptr(); self.caps.get(&ptr).and_then(|c| c.upgrade()) } /// Looks up a capability and returns its underlying server object, if found. /// Does *not* attempt to resolve the capability first, so you will usually want /// to call `get_resolved_cap()` before calling this. The advantage of this method /// over `get_local_server()` is that this one is synchronous and borrows `self` /// over a shorter span (which can be very important if `self` is inside a `RefCell`). pub fn get_local_server_of_resolved(&self, client: &C) -> Option>> where C: capnp::capability::FromClientHook, { let hook = client.as_client_hook(); let ptr = hook.get_ptr(); self.caps.get(&ptr).and_then(|c| c.upgrade()) } /// Reclaim memory used for Server objects that no longer exist. pub fn gc(&mut self) { self.caps.retain(|_, c| c.strong_count() > 0); } } /// Converts a promise for a client into a client that queues up any calls that arrive /// before the promise resolves. // TODO: figure out a better way to allow construction of promise clients. pub fn new_promise_client(client_promise: F) -> T where T: ::capnp::capability::FromClientHook, F: ::futures::Future>, F: 'static + Unpin, { let mut queued_client = crate::queued::Client::new(None); let weak_client = Rc::downgrade(&queued_client.inner); queued_client.drive(client_promise.then(move |r| { if let Some(queued_inner) = weak_client.upgrade() { crate::queued::ClientInner::resolve(&queued_inner, r.map(|c| c.hook)); } Promise::ok(()) })); T::new(Box::new(queued_client)) } struct SystemTaskReaper; impl crate::task_set::TaskReaper for SystemTaskReaper { fn task_failed(&mut self, error: Error) { println!("ERROR: {error}"); } } pub struct ImbuedMessageBuilder where A: ::capnp::message::Allocator, { builder: ::capnp::message::Builder, cap_table: Vec>>, } impl ImbuedMessageBuilder where A: ::capnp::message::Allocator, { pub fn new(allocator: A) -> Self { Self { builder: ::capnp::message::Builder::new(allocator), cap_table: Vec::new(), } } pub fn get_root<'a, T>(&'a mut self) -> ::capnp::Result where T: ::capnp::traits::FromPointerBuilder<'a>, { use capnp::traits::ImbueMut; let mut root: ::capnp::any_pointer::Builder = self.builder.get_root()?; root.imbue_mut(&mut self.cap_table); root.get_as() } pub fn set_root( &mut self, value: impl ::capnp::traits::SetterInput, ) -> ::capnp::Result<()> { use capnp::traits::ImbueMut; let mut root: ::capnp::any_pointer::Builder = self.builder.get_root()?; root.imbue_mut(&mut self.cap_table); root.set_as(value) } } fn canceled_to_error(_e: futures::channel::oneshot::Canceled) -> Error { Error::failed("oneshot was canceled".to_string()) } capnp-rpc-0.19.0/src/local.rs000064400000000000000000000261071046102023000140330ustar 00000000000000// Copyright (c) 2013-2017 Sandstorm Development Group, Inc. and contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use capnp::capability::{self, Promise}; use capnp::private::capability::{ ClientHook, ParamsHook, PipelineHook, PipelineOp, RequestHook, ResponseHook, ResultsHook, }; use capnp::traits::{Imbue, ImbueMut}; use capnp::Error; use capnp::{any_pointer, message}; use futures::channel::oneshot; use futures::TryFutureExt; use std::cell::RefCell; use std::rc::Rc; pub trait ResultsDoneHook { fn add_ref(&self) -> Box; fn get(&self) -> ::capnp::Result; } impl Clone for Box { fn clone(&self) -> Self { self.add_ref() } } pub struct Response { results: Box, } impl Response { fn new(results: Box) -> Self { Self { results } } } impl ResponseHook for Response { fn get(&self) -> ::capnp::Result { self.results.get() } } struct Params { request: message::Builder, cap_table: Vec>>, } impl Params { fn new( request: message::Builder, cap_table: Vec>>, ) -> Self { Self { request, cap_table } } } impl ParamsHook for Params { fn get(&self) -> ::capnp::Result { let mut result: any_pointer::Reader = self.request.get_root_as_reader()?; result.imbue(&self.cap_table); Ok(result) } } struct Results { message: Option>, cap_table: Vec>>, results_done_fulfiller: Option>>, } impl Results { fn new(fulfiller: oneshot::Sender>) -> Self { Self { message: Some(::capnp::message::Builder::new_default()), cap_table: Vec::new(), results_done_fulfiller: Some(fulfiller), } } } impl Drop for Results { fn drop(&mut self) { if let (Some(message), Some(fulfiller)) = (self.message.take(), self.results_done_fulfiller.take()) { let cap_table = ::std::mem::take(&mut self.cap_table); let _ = fulfiller.send(Box::new(ResultsDone::new(message, cap_table))); } else { unreachable!() } } } impl ResultsHook for Results { fn get(&mut self) -> ::capnp::Result { match *self { Self { message: Some(ref mut message), ref mut cap_table, .. } => { let mut result: any_pointer::Builder = message.get_root()?; result.imbue_mut(cap_table); Ok(result) } _ => unreachable!(), } } fn tail_call(self: Box, _request: Box) -> Promise<(), Error> { unimplemented!() } fn direct_tail_call( self: Box, _request: Box, ) -> (Promise<(), Error>, Box) { unimplemented!() } fn allow_cancellation(&self) { unimplemented!() } } struct ResultsDoneInner { message: ::capnp::message::Builder<::capnp::message::HeapAllocator>, cap_table: Vec>>, } struct ResultsDone { inner: Rc, } impl ResultsDone { fn new( message: message::Builder, cap_table: Vec>>, ) -> Self { Self { inner: Rc::new(ResultsDoneInner { message, cap_table }), } } } impl ResultsDoneHook for ResultsDone { fn add_ref(&self) -> Box { Box::new(Self { inner: self.inner.clone(), }) } fn get(&self) -> ::capnp::Result { let mut result: any_pointer::Reader = self.inner.message.get_root_as_reader()?; result.imbue(&self.inner.cap_table); Ok(result) } } pub struct Request { message: message::Builder<::capnp::message::HeapAllocator>, cap_table: Vec>>, interface_id: u64, method_id: u16, client: Box, } impl Request { pub fn new( interface_id: u64, method_id: u16, _size_hint: Option<::capnp::MessageSize>, client: Box, ) -> Self { Self { message: message::Builder::new_default(), cap_table: Vec::new(), interface_id, method_id, client, } } } impl RequestHook for Request { fn get(&mut self) -> any_pointer::Builder { let mut result: any_pointer::Builder = self.message.get_root().unwrap(); result.imbue_mut(&mut self.cap_table); result } fn get_brand(&self) -> usize { 0 } fn send(self: Box) -> capability::RemotePromise { let tmp = *self; let Self { message, cap_table, interface_id, method_id, client, } = tmp; let params = Params::new(message, cap_table); let (results_done_fulfiller, results_done_promise) = oneshot::channel::>(); let results_done_promise = results_done_promise.map_err(crate::canceled_to_error); let results = Results::new(results_done_fulfiller); let promise = client.call(interface_id, method_id, Box::new(params), Box::new(results)); let (pipeline_sender, mut pipeline) = crate::queued::Pipeline::new(); let p = futures::future::try_join(promise, results_done_promise).and_then( move |((), results_done_hook)| { pipeline_sender .complete(Box::new(Pipeline::new(results_done_hook.add_ref())) as Box); Promise::ok(( capability::Response::new(Box::new(Response::new(results_done_hook))), (), )) }, ); let (left, right) = crate::split::split(p); pipeline.drive(right); let pipeline = any_pointer::Pipeline::new(Box::new(pipeline)); capability::RemotePromise { promise: Promise::from_future(left), pipeline, } } fn tail_send(self: Box) -> Option<(u32, Promise<(), Error>, Box)> { unimplemented!() } } struct PipelineInner { results: Box, } pub struct Pipeline { inner: Rc>, } impl Pipeline { pub fn new(results: Box) -> Self { Self { inner: Rc::new(RefCell::new(PipelineInner { results })), } } } impl Clone for Pipeline { fn clone(&self) -> Self { Self { inner: self.inner.clone(), } } } impl PipelineHook for Pipeline { fn add_ref(&self) -> Box { Box::new(self.clone()) } fn get_pipelined_cap(&self, ops: &[PipelineOp]) -> Box { match self .inner .borrow_mut() .results .get() .unwrap() .get_pipelined_cap(ops) { Ok(v) => v, Err(e) => Box::new(crate::broken::Client::new(e, true, 0)) as Box, } } } pub struct Client where S: capability::Server, { inner: Rc>, } impl Client where S: capability::Server, { pub fn new(server: S) -> Self { Self { inner: Rc::new(RefCell::new(server)), } } pub fn from_rc(inner: Rc>) -> Self { Self { inner } } } impl Clone for Client where S: capability::Server, { fn clone(&self) -> Self { Self { inner: self.inner.clone(), } } } impl ClientHook for Client where S: capability::Server + 'static, { fn add_ref(&self) -> Box { Box::new(self.clone()) } fn new_call( &self, interface_id: u64, method_id: u16, size_hint: Option<::capnp::MessageSize>, ) -> capability::Request { capability::Request::new(Box::new(Request::new( interface_id, method_id, size_hint, self.add_ref(), ))) } fn call( &self, interface_id: u64, method_id: u16, params: Box, results: Box, ) -> Promise<(), Error> { // We don't want to actually dispatch the call synchronously, because we don't want the callee // to have any side effects before the promise is returned to the caller. This helps avoid // race conditions. // // TODO: actually use some kind of queue here to guarantee that call order in maintained. // This currently relies on the task scheduler being first-in-first-out. let inner = self.inner.clone(); Promise::from_future(async move { let f = { // We put this borrow_mut() inside a block to avoid a potential // double borrow during f.await let server = &mut *inner.borrow_mut(); server.dispatch_call( interface_id, method_id, ::capnp::capability::Params::new(params), ::capnp::capability::Results::new(results), ) }; f.await }) } fn get_ptr(&self) -> usize { self.inner.as_ptr() as usize } fn get_brand(&self) -> usize { 0 } fn get_resolved(&self) -> Option> { None } fn when_more_resolved(&self) -> Option, Error>> { None } fn when_resolved(&self) -> Promise<(), Error> { crate::rpc::default_when_resolved_impl(self) } } capnp-rpc-0.19.0/src/queued.rs000064400000000000000000000254171046102023000142340ustar 00000000000000// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use capnp::any_pointer; use capnp::capability::Promise; use capnp::private::capability::{ClientHook, ParamsHook, PipelineHook, PipelineOp, ResultsHook}; use capnp::Error; use futures::{Future, FutureExt, TryFutureExt}; use std::cell::RefCell; use std::rc::{Rc, Weak}; use crate::attach::Attach; use crate::sender_queue::SenderQueue; use crate::{broken, local}; pub struct PipelineInner { // Once the promise resolves, this will become non-null and point to the underlying object. redirect: Option>, promise_to_drive: futures::future::Shared>, clients_to_resolve: SenderQueue<(Weak>, Vec), ()>, } impl PipelineInner { fn resolve(this: &Rc>, result: Result, Error>) { assert!(this.borrow().redirect.is_none()); let pipeline = match result { Ok(pipeline_hook) => pipeline_hook, Err(e) => Box::new(broken::Pipeline::new(e)), }; this.borrow_mut().redirect = Some(pipeline.add_ref()); for ((weak_client, ops), waiter) in this.borrow_mut().clients_to_resolve.drain() { if let Some(client) = weak_client.upgrade() { let clienthook = pipeline.get_pipelined_cap_move(ops); ClientInner::resolve(&client, Ok(clienthook)); } let _ = waiter.send(()); } this.borrow_mut().promise_to_drive = Promise::ok(()).shared(); } } pub struct PipelineInnerSender { inner: Option>>, } impl Drop for PipelineInnerSender { fn drop(&mut self) { if let Some(weak_queued) = self.inner.take() { if let Some(pipeline_inner) = weak_queued.upgrade() { PipelineInner::resolve( &pipeline_inner, Ok(Box::new(crate::broken::Pipeline::new(Error::failed( "PipelineInnerSender was canceled".into(), )))), ); } } } } impl PipelineInnerSender { pub fn complete(mut self, pipeline: Box) { if let Some(weak_queued) = self.inner.take() { if let Some(pipeline_inner) = weak_queued.upgrade() { crate::queued::PipelineInner::resolve(&pipeline_inner, Ok(pipeline)); } } } } pub struct Pipeline { inner: Rc>, } impl Pipeline { pub fn new() -> (PipelineInnerSender, Self) { let inner = Rc::new(RefCell::new(PipelineInner { redirect: None, promise_to_drive: Promise::ok(()).shared(), clients_to_resolve: SenderQueue::new(), })); ( PipelineInnerSender { inner: Some(Rc::downgrade(&inner)), }, Self { inner }, ) } pub fn drive(&mut self, promise: F) where F: Future> + 'static + Unpin, { let new = Promise::from_future( futures::future::try_join(self.inner.borrow_mut().promise_to_drive.clone(), promise) .map_ok(|_| ()), ) .shared(); self.inner.borrow_mut().promise_to_drive = new; } } impl Clone for Pipeline { fn clone(&self) -> Self { Self { inner: self.inner.clone(), } } } impl PipelineHook for Pipeline { fn add_ref(&self) -> Box { Box::new(self.clone()) } fn get_pipelined_cap(&self, ops: &[PipelineOp]) -> Box { self.get_pipelined_cap_move(ops.into()) } fn get_pipelined_cap_move(&self, ops: Vec) -> Box { if let Some(p) = &self.inner.borrow().redirect { return p.get_pipelined_cap_move(ops); } let mut queued_client = Client::new(Some(self.inner.clone())); queued_client.drive(self.inner.borrow().promise_to_drive.clone()); let weak_queued = Rc::downgrade(&queued_client.inner); self.inner .borrow_mut() .clients_to_resolve .push_detach((weak_queued, ops)); Box::new(queued_client) } } pub struct ClientInner { // Once the promise resolves, this will become non-null and point to the underlying object. redirect: Option>, // The queued::PipelineInner that this client is derived from, if any. We need to hold on // to a reference to it so that it doesn't get canceled before the client is resolved. pipeline_inner: Option>>, promise_to_drive: Option>>, // When this promise resolves, each queued call will be forwarded to the real client. This needs // to occur *before* any 'whenMoreResolved()' promises resolve, because we want to make sure // previously-queued calls are delivered before any new calls made in response to the resolution. call_forwarding_queue: SenderQueue<(u64, u16, Box, Box), Promise<(), Error>>, // whenMoreResolved() returns forks of this promise. These must resolve *after* queued calls // have been initiated (so that any calls made in the whenMoreResolved() handler are correctly // delivered after calls made earlier), but *before* any queued calls return (because it might // confuse the application if a queued call returns before the capability on which it was made // resolves). Luckily, we know that queued calls will involve, at the very least, an // eventLoop.evalLater. client_resolution_queue: SenderQueue<(), Box>, } impl ClientInner { pub fn resolve(state: &Rc>, result: Result, Error>) { assert!(state.borrow().redirect.is_none()); let client = match result { Ok(clienthook) => clienthook, Err(e) => broken::new_cap(e), }; state.borrow_mut().redirect = Some(client.add_ref()); for (args, waiter) in state.borrow_mut().call_forwarding_queue.drain() { let (interface_id, method_id, params, results) = args; let result_promise = client.call(interface_id, method_id, params, results); let _ = waiter.send(result_promise); } for ((), waiter) in state.borrow_mut().client_resolution_queue.drain() { let _ = waiter.send(client.add_ref()); } state.borrow_mut().promise_to_drive.take(); state.borrow_mut().pipeline_inner.take(); } } pub struct Client { pub inner: Rc>, } impl Client { pub fn new(pipeline_inner: Option>>) -> Self { let inner = Rc::new(RefCell::new(ClientInner { promise_to_drive: None, pipeline_inner, redirect: None, call_forwarding_queue: SenderQueue::new(), client_resolution_queue: SenderQueue::new(), })); Self { inner } } pub fn drive(&mut self, promise: F) where F: Future> + 'static + Unpin, { assert!(self.inner.borrow().promise_to_drive.is_none()); self.inner.borrow_mut().promise_to_drive = Some(Promise::from_future(promise).shared()); } } impl ClientHook for Client { fn add_ref(&self) -> Box { Box::new(Self { inner: self.inner.clone(), }) } fn new_call( &self, interface_id: u64, method_id: u16, size_hint: Option<::capnp::MessageSize>, ) -> ::capnp::capability::Request { ::capnp::capability::Request::new(Box::new(local::Request::new( interface_id, method_id, size_hint, self.add_ref(), ))) } fn call( &self, interface_id: u64, method_id: u16, params: Box, results: Box, ) -> Promise<(), Error> { if let Some(client) = &self.inner.borrow().redirect { return client.call(interface_id, method_id, params, results); } let inner_clone = self.inner.clone(); let promise = self .inner .borrow_mut() .call_forwarding_queue .push((interface_id, method_id, params, results)) .attach(inner_clone) .and_then(|x| x); match self.inner.borrow().promise_to_drive { Some(ref p) => { Promise::from_future(futures::future::try_join(p.clone(), promise).map_ok(|v| v.1)) } None => Promise::from_future(promise), } } fn get_ptr(&self) -> usize { (&*self.inner.borrow()) as *const _ as usize } fn get_brand(&self) -> usize { 0 } fn get_resolved(&self) -> Option> { match &self.inner.borrow().redirect { Some(inner) => Some(inner.clone()), None => None, } } fn when_more_resolved(&self) -> Option, Error>> { if let Some(client) = &self.inner.borrow().redirect { return Some(Promise::ok(client.add_ref())); } let promise = self.inner.borrow_mut().client_resolution_queue.push(()); match &self.inner.borrow().promise_to_drive { Some(p) => Some(Promise::from_future( futures::future::try_join(p.clone(), promise).map_ok(|v| v.1), )), None => Some(Promise::from_future(promise)), } } fn when_resolved(&self) -> Promise<(), Error> { crate::rpc::default_when_resolved_impl(self) } } capnp-rpc-0.19.0/src/reconnect.rs000064400000000000000000000136461046102023000147250ustar 00000000000000use std::cell::RefCell; use std::marker::PhantomData; use std::rc::Rc; use capnp::capability::{FromClientHook, Promise}; use capnp::private::capability::{ClientHook, RequestHook}; use futures::TryFutureExt; pub trait SetTarget { fn add_ref(&self) -> Box>; fn set_target(&self, target: C); } impl Clone for Box> { fn clone(&self) -> Self { self.add_ref() } } struct ClientInner { connect: F, current: Option>, generation: usize, marker: PhantomData, } impl ClientInner where F: FnMut() -> capnp::Result, F: 'static, C: FromClientHook, { fn get_current(&mut self) -> Box { if let Some(hook) = self.current.as_ref() { hook.add_ref() } else { let hook = match (self.connect)() { Ok(hook) => hook.into_client_hook(), Err(err) => crate::broken::new_cap(err), }; self.current = Some(hook.add_ref()); hook } } } struct Client { inner: Rc>>, } impl Client where F: FnMut() -> capnp::Result, F: 'static, C: FromClientHook, C: 'static, { pub fn new(connect: F) -> Client { Client { inner: Rc::new(RefCell::new(ClientInner { connect, generation: 0, current: None, marker: PhantomData, })), } } pub fn get_current(&self) -> Box { self.inner.borrow_mut().get_current() } fn wrap(&self, promise: Promise) -> Promise { let c = self.clone(); let generation = self.inner.borrow().generation; Promise::from_future(promise.map_err(move |err| { if err.kind == capnp::ErrorKind::Disconnected && generation == c.inner.borrow().generation { let mut inner = c.inner.borrow_mut(); inner.generation = generation + 1; match (inner.connect)() { Ok(hook) => inner.current = Some(hook.into_client_hook()), Err(err) => inner.current = Some(crate::broken::new_cap(err)), } } err })) } } impl SetTarget for Client where F: 'static, C: FromClientHook, C: 'static, { fn add_ref(&self) -> Box> { Box::new(self.clone()) } fn set_target(&self, target: C) { self.inner.borrow_mut().current = Some(target.into_client_hook()); } } impl Clone for Client { fn clone(&self) -> Self { Self { inner: self.inner.clone(), } } } impl ClientHook for Client where F: FnMut() -> capnp::Result, F: 'static, C: FromClientHook, C: 'static, { fn add_ref(&self) -> Box { Box::new(self.clone()) } fn new_call( &self, interface_id: u64, method_id: u16, size_hint: Option, ) -> capnp::capability::Request { let result = self .get_current() .new_call(interface_id, method_id, size_hint); let hook = Request::new(self.clone(), result.hook); capnp::capability::Request::new(Box::new(hook)) } fn call( &self, interface_id: u64, method_id: u16, params: Box, results: Box, ) -> Promise<(), capnp::Error> { let result = self .get_current() .call(interface_id, method_id, params, results); self.wrap(result) } fn get_brand(&self) -> usize { 0 } fn get_ptr(&self) -> usize { (self.inner.as_ref()) as *const _ as usize } fn get_resolved(&self) -> Option> { None } fn when_more_resolved(&self) -> Option, capnp::Error>> { None } fn when_resolved(&self) -> Promise<(), capnp::Error> { Promise::ok(()) } } struct Request { parent: Client, inner: Box, } impl Request { fn new(parent: Client, inner: Box) -> Request { Request { parent, inner } } } impl RequestHook for Request where F: FnMut() -> capnp::Result, F: 'static, C: FromClientHook, C: 'static, { fn get(&mut self) -> capnp::any_pointer::Builder<'_> { self.inner.get() } fn get_brand(&self) -> usize { 0 } fn send(self: Box) -> capnp::capability::RemotePromise { let parent = self.parent; let mut result = self.inner.send(); result.promise = parent.wrap(result.promise); result } fn tail_send( self: Box, ) -> Option<( u32, Promise<(), capnp::Error>, Box, )> { todo!() } } pub fn auto_reconnect(mut connect: F) -> capnp::Result<(C, Box>)> where F: FnMut() -> capnp::Result, F: 'static, C: FromClientHook, C: 'static, { let current = connect()?; let c = Client::new(connect); c.set_target(current); let hook: Box = Box::new(c.clone()); Ok((FromClientHook::new(hook), Box::new(c))) } pub fn lazy_auto_reconnect(connect: F) -> (C, Box>) where F: FnMut() -> capnp::Result, F: 'static, C: FromClientHook, C: 'static, { let c: Client = Client::new(connect); let hook: Box = Box::new(c.clone()); (FromClientHook::new(hook), Box::new(c)) } capnp-rpc-0.19.0/src/rpc.rs000064400000000000000000003435141046102023000135310ustar 00000000000000// Copyright (c) 2013-2015 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use std::pin::Pin; use std::task::{Context, Poll}; use capnp::any_pointer; use capnp::capability::Promise; use capnp::private::capability::{ ClientHook, ParamsHook, PipelineHook, PipelineOp, RequestHook, ResponseHook, ResultsHook, }; use capnp::Error; use futures::channel::oneshot; use futures::{future, Future, FutureExt, TryFutureExt}; use std::cell::{Cell, RefCell}; use std::cmp::Reverse; use std::collections::binary_heap::BinaryHeap; use std::collections::hash_map::HashMap; use std::mem; use std::rc::{Rc, Weak}; use std::vec::Vec; use crate::attach::Attach; use crate::local::ResultsDoneHook; use crate::rpc_capnp::{ bootstrap, call, cap_descriptor, disembargo, exception, finish, message, message_target, payload, promised_answer, resolve, return_, }; use crate::task_set::TaskSet; use crate::{broken, local, queued}; pub type QuestionId = u32; pub type AnswerId = QuestionId; pub type ExportId = u32; pub type ImportId = ExportId; pub struct ImportTable { slots: HashMap, } impl ImportTable { pub fn new() -> Self { Self { slots: HashMap::new(), } } } struct ExportTable { slots: Vec>, // prioritize lower values free_ids: BinaryHeap>, } struct ExportTableIter<'a, T> where T: 'a, { table: &'a ExportTable, idx: usize, } impl<'a, T> ::std::iter::Iterator for ExportTableIter<'a, T> where T: 'a, { type Item = &'a T; fn next(&mut self) -> Option<&'a T> { while self.idx < self.table.slots.len() { let idx = self.idx; self.idx += 1; if let Some(v) = &self.table.slots[idx] { return Some(v); } } None } } impl ExportTable { pub fn new() -> Self { Self { slots: Vec::new(), free_ids: BinaryHeap::new(), } } pub fn erase(&mut self, id: u32) { self.slots[id as usize] = None; self.free_ids.push(Reverse(id)); } pub fn push(&mut self, val: T) -> u32 { match self.free_ids.pop() { Some(Reverse(id)) => { self.slots[id as usize] = Some(val); id } None => { self.slots.push(Some(val)); self.slots.len() as u32 - 1 } } } pub fn find(&mut self, id: u32) -> Option<&mut T> { let idx = id as usize; if idx < self.slots.len() { self.slots[idx].as_mut() } else { None } } pub fn iter(&self) -> ExportTableIter { ExportTableIter { table: self, idx: 0, } } } struct Question where VatId: 'static, { is_awaiting_return: bool, #[allow(dead_code)] param_exports: Vec, #[allow(dead_code)] is_tail_call: bool, /// The local QuestionRef, set to None when it is destroyed. self_ref: Option>>>, } impl Question { fn new() -> Self { Self { is_awaiting_return: true, param_exports: Vec::new(), is_tail_call: false, self_ref: None, } } } /// A reference to an entry on the question table. Used to detect when the `Finish` message /// can be sent. struct QuestionRef where VatId: 'static, { connection_state: Rc>, id: QuestionId, fulfiller: Option, Error>>>, } impl QuestionRef { fn new( state: Rc>, id: QuestionId, fulfiller: oneshot::Sender, Error>>, ) -> Self { Self { connection_state: state, id, fulfiller: Some(fulfiller), } } fn fulfill(&mut self, response: Promise, Error>) { if let Some(fulfiller) = self.fulfiller.take() { let _ = fulfiller.send(response); } } fn reject(&mut self, err: Error) { if let Some(fulfiller) = self.fulfiller.take() { let _ = fulfiller.send(Promise::err(err)); } } } impl Drop for QuestionRef { fn drop(&mut self) { let mut questions = self.connection_state.questions.borrow_mut(); match &mut questions.slots[self.id as usize] { Some(q) => { if let Ok(ref mut c) = *self.connection_state.connection.borrow_mut() { let mut message = c.new_outgoing_message(100); // XXX size hint { let root: message::Builder = message.get_body().unwrap().init_as(); let mut builder = root.init_finish(); builder.set_question_id(self.id); // If we're still awaiting a return, then this request is being // canceled, and we're going to ignore any capabilities in the return // message, so set releaseResultCaps true. If we already received the // return, then we've already built local proxies for the caps and will // send Release messages when those are destroyed. builder.set_release_result_caps(q.is_awaiting_return); } let _ = message.send(); } if q.is_awaiting_return { // Still waiting for return, so just remove the QuestionRef pointer from the table. q.self_ref = None; } else { // Call has already returned, so we can now remove it from the table. questions.erase(self.id) } } None => { unreachable!() } } } } struct Answer where VatId: 'static, { // True from the point when the Call message is received to the point when both the `Finish` // message has been received and the `Return` has been sent. active: bool, return_has_been_sent: bool, // Send pipelined calls here. Becomes null as soon as a `Finish` is received. pipeline: Option>, // For locally-redirected calls (Call.sendResultsTo.yourself), this is a promise for the call // result, to be picked up by a subsequent `Return`. redirected_results: Option, Error>>, received_finish: Rc>, call_completion_promise: Option>, // List of exports that were sent in the results. If the finish has `releaseResultCaps` these // will need to be released. result_exports: Vec, } impl Answer { fn new() -> Self { Self { active: false, return_has_been_sent: false, pipeline: None, redirected_results: None, received_finish: Rc::new(Cell::new(false)), call_completion_promise: None, result_exports: Vec::new(), } } } pub struct Export { refcount: u32, client_hook: Box, // If this export is a promise (not a settled capability), the `resolve_op` represents the // ongoing operation to wait for that promise to resolve and then send a `Resolve` message. resolve_op: Promise<(), Error>, } impl Export { fn new(client_hook: Box) -> Self { Self { refcount: 1, client_hook, resolve_op: Promise::err(Error::failed("no resolve op".to_string())), } } } pub struct Import where VatId: 'static, { // Becomes null when the import is destroyed. import_client: Option<(Weak>>, usize)>, // Either a copy of importClient, or, in the case of promises, the wrapping PromiseClient. // Becomes null when it is discarded *or* when the import is destroyed (e.g. the promise is // resolved and the import is no longer needed). app_client: Option>, // If non-null, the import is a promise. promise_client_to_resolve: Option>>>, } impl Import { fn new() -> Self { Self { import_client: None, app_client: None, promise_client_to_resolve: None, } } } struct Embargo { fulfiller: Option>>, } impl Embargo { fn new(fulfiller: oneshot::Sender>) -> Self { Self { fulfiller: Some(fulfiller), } } } fn to_pipeline_ops( ops: ::capnp::struct_list::Reader, ) -> ::capnp::Result> { let mut result = Vec::new(); for op in ops { match op.which()? { promised_answer::op::Noop(()) => { result.push(PipelineOp::Noop); } promised_answer::op::GetPointerField(idx) => { result.push(PipelineOp::GetPointerField(idx)); } } } Ok(result) } fn from_error(error: &Error, mut builder: exception::Builder) { builder.set_reason(&error.to_string()); let typ = match error.kind { ::capnp::ErrorKind::Failed => exception::Type::Failed, ::capnp::ErrorKind::Overloaded => exception::Type::Overloaded, ::capnp::ErrorKind::Disconnected => exception::Type::Disconnected, ::capnp::ErrorKind::Unimplemented => exception::Type::Unimplemented, ::capnp::ErrorKind::SettingDynamicCapabilitiesIsUnsupported => { exception::Type::Unimplemented } _ => exception::Type::Failed, }; builder.set_type(typ); } fn remote_exception_to_error(exception: exception::Reader) -> Error { let (kind, reason) = match (exception.get_type(), exception.get_reason()) { (Ok(exception::Type::Failed), Ok(reason)) => (::capnp::ErrorKind::Failed, reason), (Ok(exception::Type::Overloaded), Ok(reason)) => (::capnp::ErrorKind::Overloaded, reason), (Ok(exception::Type::Disconnected), Ok(reason)) => { (::capnp::ErrorKind::Disconnected, reason) } (Ok(exception::Type::Unimplemented), Ok(reason)) => { (::capnp::ErrorKind::Unimplemented, reason) } _ => (::capnp::ErrorKind::Failed, "(malformed error)".into()), }; let reason_str = reason .to_str() .unwrap_or(""); Error { extra: format!("remote exception: {reason_str}"), kind, } } pub struct ConnectionErrorHandler where VatId: 'static, { weak_state: Weak>, } impl ConnectionErrorHandler { fn new(weak_state: Weak>) -> Self { Self { weak_state } } } impl crate::task_set::TaskReaper for ConnectionErrorHandler { fn task_failed(&mut self, error: ::capnp::Error) { if let Some(state) = self.weak_state.upgrade() { state.disconnect(error) } } } pub struct ConnectionState where VatId: 'static, { bootstrap_cap: Box, exports: RefCell>, questions: RefCell>>, answers: RefCell>>, imports: RefCell>>, exports_by_cap: RefCell>, embargoes: RefCell>, tasks: RefCell>>, connection: RefCell<::std::result::Result>, ::capnp::Error>>, disconnect_fulfiller: RefCell>>>, client_downcast_map: RefCell>>, } impl ConnectionState { pub fn new( bootstrap_cap: Box, connection: Box>, disconnect_fulfiller: oneshot::Sender>, ) -> (TaskSet, Rc) { let state = Rc::new(Self { bootstrap_cap, exports: RefCell::new(ExportTable::new()), questions: RefCell::new(ExportTable::new()), answers: RefCell::new(ImportTable::new()), imports: RefCell::new(ImportTable::new()), exports_by_cap: RefCell::new(HashMap::new()), embargoes: RefCell::new(ExportTable::new()), tasks: RefCell::new(None), connection: RefCell::new(Ok(connection)), disconnect_fulfiller: RefCell::new(Some(disconnect_fulfiller)), client_downcast_map: RefCell::new(HashMap::new()), }); let (mut handle, tasks) = TaskSet::new(Box::new(ConnectionErrorHandler::new(Rc::downgrade(&state)))); handle.add(Self::message_loop(Rc::downgrade(&state))); *state.tasks.borrow_mut() = Some(handle); (tasks, state) } fn new_outgoing_message( &self, first_segment_words: u32, ) -> capnp::Result> { match self.connection.borrow_mut().as_mut() { Err(e) => Err(e.clone()), Ok(c) => Ok(c.new_outgoing_message(first_segment_words)), } } fn disconnect(&self, error: ::capnp::Error) { if self.connection.borrow().is_err() { // Already disconnected. return; } // Carefully pull all the objects out of the tables prior to releasing them because their // destructors could come back and mess with the tables. let mut pipelines_to_release = Vec::new(); let mut clients_to_release = Vec::new(); //let mut tail_calls_to_release = Vec::new(); let mut resolve_ops_to_release = Vec::new(); for q in self.questions.borrow().iter() { if let Some(ref weak_question_ref) = q.self_ref { if let Some(question_ref) = weak_question_ref.upgrade() { question_ref.borrow_mut().reject(error.clone()); } } } { let answer_slots = &mut self.answers.borrow_mut().slots; for (_, ref mut answer) in answer_slots.iter_mut() { // TODO tail call pipelines_to_release.push(answer.pipeline.take()) } } let len = self.exports.borrow().slots.len(); for idx in 0..len { if let Some(exp) = self.exports.borrow_mut().slots[idx].take() { let Export { client_hook, resolve_op, .. } = exp; clients_to_release.push(client_hook); resolve_ops_to_release.push(resolve_op); } } *self.exports.borrow_mut() = ExportTable::new(); { let import_slots = &mut self.imports.borrow_mut().slots; for (_, ref mut import) in import_slots.iter_mut() { if let Some(f) = import.promise_client_to_resolve.take() { if let Some(promise_client) = f.upgrade() { promise_client.borrow_mut().resolve(Err(error.clone())); } } } } let len = self.embargoes.borrow().slots.len(); for idx in 0..len { if let Some(ref mut emb) = self.embargoes.borrow_mut().slots[idx] { if let Some(f) = emb.fulfiller.take() { let _ = f.send(Err(error.clone())); } } } *self.embargoes.borrow_mut() = ExportTable::new(); drop(pipelines_to_release); drop(clients_to_release); drop(resolve_ops_to_release); // TODO drop tail calls match *self.connection.borrow_mut() { Ok(ref mut c) => { let mut message = c.new_outgoing_message(100); // TODO estimate size { let builder = message .get_body() .unwrap() .init_as::() .init_abort(); from_error(&error, builder); } let _ = message.send(); } Err(_) => unreachable!(), } let connection = mem::replace(&mut *self.connection.borrow_mut(), Err(error.clone())); match connection { Ok(mut c) => { let promise = c.shutdown(Err(error)).then(|r| match r { Ok(()) => Promise::ok(()), Err(e) => { if e.kind != ::capnp::ErrorKind::Disconnected { // Don't report disconnects as an error. Promise::err(e) } else { Promise::ok(()) } } }); match self.disconnect_fulfiller.borrow_mut().take() { None => unreachable!(), Some(fulfiller) => { let _ = fulfiller.send(Promise::from_future(promise.attach(c))); } } } Err(_) => unreachable!(), } } // Transform a future into a promise that gets executed even if it is never polled. // Dropping the returned promise cancels the computation. fn eagerly_evaluate(&self, task: F) -> Promise where F: Future> + 'static + Unpin, T: 'static, { let (tx, rx) = oneshot::channel::>(); let (tx2, rx2) = oneshot::channel::<()>(); let f1 = Box::pin(task.map(move |r| { let _ = tx.send(r); })) as Pin + Unpin>>; let f2 = Box::pin(rx2.map(drop)) as Pin + Unpin>>; self.add_task(future::select(f1, f2).map(|_| Ok(()))); Promise::from_future(rx.map_err(crate::canceled_to_error).map(|r| { drop(tx2); r? })) } fn add_task(&self, task: F) where F: Future> + 'static, { if let Some(ref mut tasks) = *self.tasks.borrow_mut() { tasks.add(task); } } pub fn bootstrap(state: &Rc) -> Box { let question_id = state.questions.borrow_mut().push(Question::new()); let (fulfiller, promise) = oneshot::channel(); let promise = promise.map_err(crate::canceled_to_error); let promise = promise.and_then(|response_promise| response_promise); let question_ref = Rc::new(RefCell::new(QuestionRef::new( state.clone(), question_id, fulfiller, ))); let promise = promise.attach(question_ref.clone()); match state.questions.borrow_mut().slots[question_id as usize] { Some(ref mut q) => { q.self_ref = Some(Rc::downgrade(&question_ref)); } None => unreachable!(), } match *state.connection.borrow_mut() { Ok(ref mut c) => { let mut message = c.new_outgoing_message(100); // TODO estimate size { let mut builder = message .get_body() .unwrap() .init_as::() .init_bootstrap(); builder.set_question_id(question_id); } let _ = message.send(); } Err(_) => panic!(), } let pipeline = Pipeline::new(state, question_ref, Some(Promise::from_future(promise))); pipeline.get_pipelined_cap_move(Vec::new()) } fn message_loop(weak_state: Weak) -> Promise<(), capnp::Error> { let Some(state) = weak_state.upgrade() else { return Promise::err(Error::disconnected( "message loop cannot continue without a connection".into(), )); }; let promise = match *state.connection.borrow_mut() { Err(_) => return Promise::ok(()), Ok(ref mut connection) => connection.receive_incoming_message(), }; Promise::from_future(async move { match promise.await? { Some(m) => { Self::handle_message(&weak_state, m)?; weak_state .upgrade() .expect("message loop outlived connection state?") .add_task(Self::message_loop(weak_state)); } None => { weak_state .upgrade() .expect("message loop outlived connection state?") .disconnect(Error::disconnected("Peer disconnected.".to_string())); } } Ok(()) }) } fn send_unimplemented( connection_state: &Rc, message: &dyn crate::IncomingMessage, ) -> capnp::Result<()> { let mut out_message = connection_state.new_outgoing_message(50)?; // XXX size hint { let mut root: message::Builder = out_message.get_body()?.get_as()?; root.set_unimplemented(message.get_body()?.get_as()?)?; } let _ = out_message.send(); Ok(()) } fn handle_unimplemented( connection_state: &Rc, message: message::Reader, ) -> capnp::Result<()> { match message.which()? { message::Resolve(resolve) => { let resolve = resolve?; match resolve.which()? { resolve::Cap(c) => match c?.which()? { cap_descriptor::None(()) => (), cap_descriptor::SenderHosted(export_id) => { connection_state.release_export(export_id, 1)?; } cap_descriptor::SenderPromise(export_id) => { connection_state.release_export(export_id, 1)?; } cap_descriptor::ReceiverAnswer(_) | cap_descriptor::ReceiverHosted(_) => (), cap_descriptor::ThirdPartyHosted(_) => { return Err(Error::failed( "Peer claims we resolved a ThirdPartyHosted cap.".to_string(), )); } }, resolve::Exception(_) => (), } } _ => { return Err(Error::failed( "Peer did not implement required RPC message type.".to_string(), )); } } Ok(()) } fn handle_bootstrap( connection_state: &Rc, bootstrap: bootstrap::Reader, ) -> capnp::Result<()> { use ::capnp::traits::ImbueMut; let answer_id = bootstrap.get_question_id(); if connection_state.connection.borrow().is_err() { // Disconnected; ignore. return Ok(()); } let mut response = connection_state.new_outgoing_message(50)?; // XXX size hint let result_exports = { let mut ret = response .get_body()? .init_as::() .init_return(); ret.set_answer_id(answer_id); let cap = connection_state.bootstrap_cap.clone(); let mut cap_table = Vec::new(); let mut payload = ret.init_results(); { let mut content = payload.reborrow().get_content(); content.imbue_mut(&mut cap_table); content.set_as_capability(cap); } assert_eq!(cap_table.len(), 1); Self::write_descriptors(connection_state, &cap_table, payload) }; let slots = &mut connection_state.answers.borrow_mut().slots; let answer = slots.entry(answer_id).or_insert_with(Answer::new); if answer.active { connection_state.release_exports(&result_exports)?; return Err(Error::failed("questionId is already in use".to_string())); } answer.active = true; answer.return_has_been_sent = true; answer.result_exports = result_exports; answer.pipeline = Some(Box::new(SingleCapPipeline::new( connection_state.bootstrap_cap.clone(), ))); let _ = response.send(); Ok(()) } fn handle_finish(connection_state: &Rc, finish: finish::Reader) -> capnp::Result<()> { let mut exports_to_release = Vec::new(); let answer_id = finish.get_question_id(); let mut erase = false; let answers_slots = &mut connection_state.answers.borrow_mut().slots; match answers_slots.get_mut(&answer_id) { None => { return Err(Error::failed(format!( "Invalid question ID {answer_id} in Finish message." ))); } Some(answer) => { if !answer.active { return Err(Error::failed(format!( "'Finish' for invalid question ID {answer_id}." ))); } answer.received_finish.set(true); if finish.get_release_result_caps() { exports_to_release = ::std::mem::take(&mut answer.result_exports); } // If the pipeline has not been cloned, the following two lines cancel the call. answer.pipeline.take(); answer.call_completion_promise.take(); if answer.return_has_been_sent { erase = true; } } } if erase { answers_slots.remove(&answer_id); } connection_state.release_exports(&exports_to_release)?; Ok(()) } fn handle_disembargo( connection_state: &Rc, disembargo: disembargo::Reader, ) -> capnp::Result<()> { let context = disembargo.get_context(); match context.which()? { disembargo::context::SenderLoopback(embargo_id) => { let mut target = connection_state.get_message_target(disembargo.get_target()?)?; while let Some(resolved) = target.get_resolved() { target = resolved; } if target.get_brand() != connection_state.get_brand() { return Err(Error::failed( "'Disembargo' of type 'senderLoopback' sent to an object that does not point \ back to the sender.".to_string())); } let connection_state_ref = connection_state.clone(); let connection_state_ref1 = connection_state.clone(); let task = async move { if let Ok(ref mut c) = *connection_state_ref.connection.borrow_mut() { let mut message = c.new_outgoing_message(100); // TODO estimate size { let root: message::Builder = message.get_body()?.init_as(); let mut disembargo = root.init_disembargo(); disembargo .reborrow() .init_context() .set_receiver_loopback(embargo_id); let redirect = match Client::from_ptr(target.get_ptr(), &connection_state_ref1) { Some(c) => c.write_target(disembargo.init_target()), None => unreachable!(), }; if redirect.is_some() { return Err(Error::failed( "'Disembargo' of type 'senderLoopback' sent to an object that \ does not appear to have been the subject of a previous \ 'Resolve' message." .to_string(), )); } } let _ = message.send(); } Ok(()) }; connection_state.add_task(task); } disembargo::context::ReceiverLoopback(embargo_id) => { if let Some(embargo) = connection_state.embargoes.borrow_mut().find(embargo_id) { let fulfiller = embargo.fulfiller.take().unwrap(); let _ = fulfiller.send(Ok(())); } else { return Err(Error::failed( "Invalid embargo ID in `Disembargo.context.receiverLoopback".to_string(), )); } connection_state.embargoes.borrow_mut().erase(embargo_id); } disembargo::context::Accept(_) | disembargo::context::Provide(_) => { return Err(Error::unimplemented( "Disembargo::Context::Provide/Accept not implemented".to_string(), )); } } Ok(()) } fn handle_message( weak_state: &Weak, message: Box, ) -> ::capnp::Result<()> { let Some(connection_state) = weak_state.upgrade() else { return Err(Error::disconnected( "handle_message() cannot continue without a connection".into(), )); }; let reader = message.get_body()?.get_as::()?; match reader.which() { Ok(message::Unimplemented(message)) => { Self::handle_unimplemented(&connection_state, message?)? } Ok(message::Abort(abort)) => return Err(remote_exception_to_error(abort?)), Ok(message::Bootstrap(bootstrap)) => { Self::handle_bootstrap(&connection_state, bootstrap?)? } Ok(message::Call(call)) => { let call = call?; let capability = connection_state.get_message_target(call.get_target()?)?; let (interface_id, method_id, question_id, cap_table_array, redirect_results) = { let redirect_results = match call.get_send_results_to().which()? { call::send_results_to::Caller(()) => false, call::send_results_to::Yourself(()) => true, call::send_results_to::ThirdParty(_) => { return Err(Error::failed( "Unsupported `Call.sendResultsTo`.".to_string(), )) } }; let payload = call.get_params()?; ( call.get_interface_id(), call.get_method_id(), call.get_question_id(), Self::receive_caps(&connection_state, payload.get_cap_table()?)?, redirect_results, ) }; if connection_state .answers .borrow() .slots .contains_key(&question_id) { return Err(Error::failed(format!( "Received a new call on in-use question id {question_id}" ))); } let params = Params::new(message, cap_table_array); let answer = Answer::new(); let (results_inner_fulfiller, results_inner_promise) = oneshot::channel(); let results_inner_promise = results_inner_promise.map_err(crate::canceled_to_error); let results = Results::new( &connection_state, question_id, redirect_results, results_inner_fulfiller, answer.received_finish.clone(), ); let (redirected_results_done_promise, redirected_results_done_fulfiller) = if redirect_results { let (f, p) = oneshot::channel::, Error>>(); let p = p.map_err(crate::canceled_to_error).and_then(future::ready); (Some(Promise::from_future(p)), Some(f)) } else { (None, None) }; { let slots = &mut connection_state.answers.borrow_mut().slots; let answer = slots.entry(question_id).or_insert(answer); if answer.active { return Err(Error::failed("questionId is already in use".to_string())); } answer.active = true; } let call_promise = capability.call(interface_id, method_id, Box::new(params), Box::new(results)); let (pipeline_sender, mut pipeline) = queued::Pipeline::new(); let promise = call_promise .then(move |call_result| { results_inner_promise.then(move |result| { future::ready(ResultsDone::from_results_inner( result, call_result, pipeline_sender, )) }) }) .then(move |v| { if let Some(f) = redirected_results_done_fulfiller { match v { Ok(r) => drop(f.send(Ok(Response::redirected(r.clone())))), Err(e) => drop(f.send(Err(e))), } } Promise::ok(()) }); let fork = promise.shared(); pipeline.drive(fork.clone()); { let slots = &mut connection_state.answers.borrow_mut().slots; match slots.get_mut(&question_id) { Some(answer) => { answer.pipeline = Some(Box::new(pipeline)); if redirect_results { answer.redirected_results = redirected_results_done_promise; // More to do here? } else { answer.call_completion_promise = Some(connection_state.eagerly_evaluate(fork)); } } None => unreachable!(), } } } Ok(message::Return(oret)) => { let ret = oret?; let question_id = ret.get_answer_id(); let mut questions = connection_state.questions.borrow_mut(); match questions.slots[question_id as usize] { Some(ref mut question) => { question.is_awaiting_return = false; match question.self_ref { Some(ref question_ref) => match ret.which()? { return_::Results(results) => { let cap_table = Self::receive_caps( &connection_state, results?.get_cap_table()?, )?; let question_ref = question_ref.upgrade().expect("dangling question ref?"); let response = Response::new( connection_state.clone(), question_ref.clone(), message, cap_table, ); question_ref.borrow_mut().fulfill(Promise::ok(response)); } return_::Exception(e) => { let tmp = question_ref.upgrade().expect("dangling question ref?"); tmp.borrow_mut().reject(remote_exception_to_error(e?)); } return_::Canceled(_) => { Self::send_unimplemented(&connection_state, message.as_ref())?; } return_::ResultsSentElsewhere(_) => { Self::send_unimplemented(&connection_state, message.as_ref())?; } return_::TakeFromOtherQuestion(id) => { if let Some(answer) = connection_state.answers.borrow_mut().slots.get_mut(&id) { if let Some(res) = answer.redirected_results.take() { let tmp = question_ref .upgrade() .expect("dangling question ref?"); tmp.borrow_mut().fulfill(res); } else { return Err(Error::failed("return.takeFromOtherQuestion referenced a call that \ did not use sendResultsTo.yourself.".to_string())); } } else { return Err(Error::failed( "return.takeFromOtherQuestion had invalid answer ID." .to_string(), )); } } return_::AcceptFromThirdParty(_) => { drop(questions); Self::send_unimplemented(&connection_state, message.as_ref())?; } }, None => { if let return_::TakeFromOtherQuestion(_) = ret.which()? { return Self::send_unimplemented( &connection_state, message.as_ref(), ); } // Looks like this question was canceled earlier, so `Finish` // was already sent, with `releaseResultCaps` set true so that // we don't have to release them here. We can go ahead and // delete it from the table. questions.erase(question_id); } } } None => { return Err(Error::failed(format!( "Invalid question ID in Return message: {question_id}" ))); } } } Ok(message::Finish(finish)) => Self::handle_finish(&connection_state, finish?)?, Ok(message::Resolve(resolve)) => { let resolve = resolve?; let replacement_or_error = match resolve.which()? { resolve::Cap(c) => match Self::receive_cap(&connection_state, c?)? { Some(cap) => Ok(cap), None => { return Err(Error::failed( "'Resolve' contained 'CapDescriptor.none'.".to_string(), )); } }, resolve::Exception(e) => { // We can't set `replacement` to a new broken cap here because this will // confuse PromiseClient::Resolve() into thinking that the remote // promise resolved to a local capability and therefore a Disembargo is // needed. We must actually reject the promise. Err(remote_exception_to_error(e?)) } }; // If the import is in the table, fulfill it. let slots = &mut connection_state.imports.borrow_mut().slots; if let Some(import) = slots.get_mut(&resolve.get_promise_id()) { match import.promise_client_to_resolve.take() { Some(weak_promise_client) => { if let Some(promise_client) = weak_promise_client.upgrade() { promise_client.borrow_mut().resolve(replacement_or_error); } } None => { return Err(Error::failed( "Got 'Resolve' for a non-promise import.".to_string(), )); } } } } Ok(message::Release(release)) => { let release = release?; connection_state.release_export(release.get_id(), release.get_reference_count())?; } Ok(message::Disembargo(disembargo)) => { Self::handle_disembargo(&connection_state, disembargo?)? } Ok( message::Provide(_) | message::Accept(_) | message::Join(_) | message::ObsoleteSave(_) | message::ObsoleteDelete(_), ) | Err(::capnp::NotInSchema(_)) => { Self::send_unimplemented(&connection_state, message.as_ref())?; } } Ok(()) } fn answer_has_sent_return(&self, id: AnswerId, result_exports: Vec) { let mut erase = false; let answers_slots = &mut self.answers.borrow_mut().slots; if let Some(a) = answers_slots.get_mut(&id) { a.return_has_been_sent = true; if a.received_finish.get() { erase = true; } else { a.result_exports = result_exports; } } else { unreachable!() } if erase { answers_slots.remove(&id); } } fn release_export(&self, id: ExportId, refcount: u32) -> ::capnp::Result<()> { let mut erase_export = false; let mut client_ptr = 0; match self.exports.borrow_mut().find(id) { Some(e) => { if refcount > e.refcount { return Err(Error::failed( "Tried to drop export's refcount below zero.".to_string(), )); } else { e.refcount -= refcount; if e.refcount == 0 { erase_export = true; client_ptr = e.client_hook.get_ptr(); } } } None => { return Err(Error::failed( "Tried to release invalid export ID.".to_string(), )); } } if erase_export { self.exports.borrow_mut().erase(id); self.exports_by_cap.borrow_mut().remove(&client_ptr); } Ok(()) } fn release_exports(&self, exports: &[ExportId]) -> ::capnp::Result<()> { for &export_id in exports { self.release_export(export_id, 1)?; } Ok(()) } fn get_brand(&self) -> usize { self as *const _ as usize } fn get_message_target( &self, target: message_target::Reader, ) -> ::capnp::Result> { match target.which()? { message_target::ImportedCap(export_id) => { match self.exports.borrow().slots.get(export_id as usize) { Some(Some(exp)) => Ok(exp.client_hook.clone()), _ => Err(Error::failed( "Message target is not a current export ID.".to_string(), )), } } message_target::PromisedAnswer(promised_answer) => { let promised_answer = promised_answer?; let question_id = promised_answer.get_question_id(); match self.answers.borrow().slots.get(&question_id) { None => Err(Error::failed( "PromisedAnswer.questionId is not a current question.".to_string(), )), Some(base) => { let pipeline = match base.pipeline { Some(ref pipeline) => pipeline.add_ref(), None => Box::new(broken::Pipeline::new(Error::failed( "Pipeline call on a request that returned not capabilities or was \ already closed." .to_string(), ))) as Box, }; let ops = to_pipeline_ops(promised_answer.get_transform()?)?; Ok(pipeline.get_pipelined_cap(&ops)) } } } } } /// If calls to the given capability should pass over this connection, fill in `target` /// appropriately for such a call and return nullptr. Otherwise, return a `ClientHook` to which /// the call should be forwarded; the caller should then delegate the call to that `ClientHook`. /// /// The main case where this ends up returning non-null is if `cap` is a promise that has /// recently resolved. The application might have started building a request before the promise /// resolved, and so the request may have been built on the assumption that it would be sent over /// this network connection, but then the promise resolved to point somewhere else before the /// request was sent. Now the request has to be redirected to the new target instead. fn write_target( &self, cap: &dyn ClientHook, target: message_target::Builder, ) -> Option> { if cap.get_brand() == self.get_brand() { match Client::from_ptr(cap.get_ptr(), self) { Some(c) => c.write_target(target), None => unreachable!(), } } else { Some(cap.add_ref()) } } fn get_innermost_client(&self, mut client: Box) -> Box { while let Some(inner) = client.get_resolved() { client = inner; } if client.get_brand() == self.get_brand() { match self.client_downcast_map.borrow().get(&client.get_ptr()) { Some(c) => Box::new(c.upgrade().expect("dangling client?")), None => unreachable!(), } } else { client } } /// Implements exporting of a promise. The promise has been exported under the given ID, and is /// to eventually resolve to the ClientHook produced by `promise`. This method waits for that /// resolve to happen and then sends the appropriate `Resolve` message to the peer. fn resolve_exported_promise( state: &Rc, export_id: ExportId, promise: Promise, Error>, ) -> Promise<(), Error> { let weak_connection_state = Rc::downgrade(state); state.eagerly_evaluate(promise.map(move |resolution_result| { let connection_state = weak_connection_state .upgrade() .expect("dangling connection state?"); match resolution_result { Ok(resolution) => { let resolution = connection_state.get_innermost_client(resolution.clone()); let brand = resolution.get_brand(); // Update the export table to point at this object instead. We know that our // entry in the export table is still live because when it is destroyed the // asynchronous resolution task (i.e. this code) is canceled. if let Some(exp) = connection_state.exports.borrow_mut().find(export_id) { connection_state .exports_by_cap .borrow_mut() .remove(&exp.client_hook.get_ptr()); exp.client_hook = resolution.clone(); } else { return Err(Error::failed("export table entry not found".to_string())); } if brand != connection_state.get_brand() { // We're resolving to a local capability. If we're resolving to a promise, // we might be able to reuse our export table entry and avoid sending a // message. if let Some(_promise) = resolution.when_more_resolved() { // We're replacing a promise with another local promise. In this case, // we might actually be able to just reuse the existing export table // entry to represent the new promise -- unless it already has an entry. // Let's check. unimplemented!() } } // OK, we have to send a `Resolve` message. let mut message = connection_state.new_outgoing_message(100)?; // XXX size hint? { let root: message::Builder = message.get_body()?.get_as()?; let mut resolve = root.init_resolve(); resolve.set_promise_id(export_id); let _export = Self::write_descriptor( &connection_state, resolution, resolve.init_cap(), )?; } let _ = message.send(); Ok(()) } Err(e) => { // send error resolution let mut message = connection_state.new_outgoing_message(100)?; // XXX size hint? { let root: message::Builder = message.get_body()?.get_as()?; let mut resolve = root.init_resolve(); resolve.set_promise_id(export_id); from_error(&e, resolve.init_exception()); } let _ = message.send(); Ok(()) } } })) } fn write_descriptor( state: &Rc, mut inner: Box, mut descriptor: cap_descriptor::Builder, ) -> ::capnp::Result> { // Find the innermost wrapped capability. while let Some(resolved) = inner.get_resolved() { inner = resolved; } if inner.get_brand() == state.get_brand() { let result = match Client::from_ptr(inner.get_ptr(), state) { Some(c) => c.write_descriptor(descriptor), None => unreachable!(), }; Ok(result) } else { let ptr = inner.get_ptr(); let contains_key = state.exports_by_cap.borrow().contains_key(&ptr); if contains_key { // We've already seen and exported this capability before. Just up the refcount. let export_id = state.exports_by_cap.borrow()[&ptr]; match state.exports.borrow_mut().find(export_id) { None => unreachable!(), Some(exp) => { descriptor.set_sender_hosted(export_id); exp.refcount += 1; Ok(Some(export_id)) } } } else { // This is the first time we've seen this capability. let exp = Export::new(inner.clone()); let export_id = state.exports.borrow_mut().push(exp); state.exports_by_cap.borrow_mut().insert(ptr, export_id); match inner.when_more_resolved() { Some(wrapped) => { // This is a promise. Arrange for the `Resolve` message to be sent later. if let Some(exp) = state.exports.borrow_mut().find(export_id) { exp.resolve_op = Self::resolve_exported_promise(state, export_id, wrapped); } descriptor.set_sender_promise(export_id); } None => { descriptor.set_sender_hosted(export_id); } } Ok(Some(export_id)) } } } fn write_descriptors( state: &Rc, cap_table: &[Option>], payload: payload::Builder, ) -> Vec { let mut cap_table_builder = payload.init_cap_table(cap_table.len() as u32); let mut exports = Vec::new(); for (idx, value) in cap_table.iter().enumerate() { match value { Some(cap) => { if let Some(export_id) = Self::write_descriptor( state, cap.clone(), cap_table_builder.reborrow().get(idx as u32), ) .unwrap() { exports.push(export_id); } } None => { cap_table_builder.reborrow().get(idx as u32).set_none(()); } } } exports } fn import(state: &Rc, import_id: ImportId, is_promise: bool) -> Box { let connection_state = state.clone(); let import_client = { let slots = &mut state.imports.borrow_mut().slots; let v = slots.entry(import_id).or_insert_with(Import::new); if v.import_client.is_some() { v.import_client .as_ref() .unwrap() .0 .upgrade() .expect("dangling ref to import client?") } else { let import_client = ImportClient::new(&connection_state, import_id); v.import_client = Some(( Rc::downgrade(&import_client), (&*import_client.borrow()) as *const _ as usize, )); import_client } }; // We just received a copy of this import ID, so the remote refcount has gone up. import_client.borrow_mut().add_remote_ref(); if is_promise { // We need to construct a PromiseClient around this import, if we haven't already. match state.imports.borrow_mut().slots.get_mut(&import_id) { Some(import) => { match &import.app_client { Some(c) => { // Use the existing one. Box::new(c.upgrade().expect("dangling client ref?")) } None => { // Create a promise for this import's resolution. let client: Box> = Box::new(import_client.into()); let client: Box = client; // XXX do I need something like this? // Make sure the import is not destroyed while this promise exists. // let promise = promise.attach(client.add_ref()); let client = PromiseClient::new(&connection_state, client, Some(import_id)); import.promise_client_to_resolve = Some(Rc::downgrade(&client)); let client: Box> = Box::new(client.into()); import.app_client = Some(client.downgrade()); client } } } None => { unreachable!() } } } else { let client: Box> = Box::new(import_client.into()); match state.imports.borrow_mut().slots.get_mut(&import_id) { Some(v) => { v.app_client = Some(client.downgrade()); } None => { unreachable!() } }; client } } fn receive_cap( state: &Rc, descriptor: cap_descriptor::Reader, ) -> ::capnp::Result>> { match descriptor.which()? { cap_descriptor::None(()) => Ok(None), cap_descriptor::SenderHosted(sender_hosted) => { Ok(Some(Self::import(state, sender_hosted, false))) } cap_descriptor::SenderPromise(sender_promise) => { Ok(Some(Self::import(state, sender_promise, true))) } cap_descriptor::ReceiverHosted(receiver_hosted) => { if let Some(exp) = state.exports.borrow_mut().find(receiver_hosted) { Ok(Some(exp.client_hook.add_ref())) } else { Ok(Some(broken::new_cap(Error::failed( "invalid 'receivedHosted' export ID".to_string(), )))) } } cap_descriptor::ReceiverAnswer(receiver_answer) => { let promised_answer = receiver_answer?; let question_id = promised_answer.get_question_id(); if let Some(answer) = state.answers.borrow().slots.get(&question_id) { if answer.active { if let Some(ref pipeline) = answer.pipeline { let ops = to_pipeline_ops(promised_answer.get_transform()?)?; return Ok(Some(pipeline.get_pipelined_cap(&ops))); } } } Ok(Some(broken::new_cap(Error::failed( "invalid 'receiver answer'".to_string(), )))) } cap_descriptor::ThirdPartyHosted(_third_party_hosted) => Err(Error::unimplemented( "ThirdPartyHosted caps are not supported.".to_string(), )), } } fn receive_caps( state: &Rc, cap_table: ::capnp::struct_list::Reader, ) -> ::capnp::Result>>> { let mut result = Vec::new(); for idx in 0..cap_table.len() { result.push(Self::receive_cap(state, cap_table.get(idx))?); } Ok(result) } } enum DisconnectorState { Connected, Disconnecting, Disconnected, } /// A `Future` that can be run to disconnect an `RpcSystem`'s ConnectionState and wait for it to be closed. pub struct Disconnector where VatId: 'static, { connection_state: Rc>>>>, state: DisconnectorState, } impl Disconnector { pub fn new(connection_state: Rc>>>>) -> Self { let state = match *(connection_state.borrow()) { Some(_) => DisconnectorState::Connected, None => DisconnectorState::Disconnected, }; Self { connection_state, state, } } fn disconnect(&self) { if let Some(ref state) = *(self.connection_state.borrow()) { state.disconnect(::capnp::Error::disconnected( "client requested disconnect".to_owned(), )); } } } impl Future for Disconnector where VatId: 'static, { type Output = Result<(), capnp::Error>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { self.state = match self.state { DisconnectorState::Connected => { self.disconnect(); DisconnectorState::Disconnecting } DisconnectorState::Disconnecting => { if self.connection_state.borrow().is_some() { DisconnectorState::Disconnecting } else { DisconnectorState::Disconnected } } DisconnectorState::Disconnected => DisconnectorState::Disconnected, }; match self.state { DisconnectorState::Connected => unreachable!(), DisconnectorState::Disconnecting => { cx.waker().wake_by_ref(); Poll::Pending } DisconnectorState::Disconnected => Poll::Ready(Ok(())), } } } struct ResponseState where VatId: 'static, { _connection_state: Rc>, message: Box, cap_table: Vec>>, _question_ref: Rc>>, } enum ResponseVariant where VatId: 'static, { Rpc(ResponseState), LocallyRedirected(Box), } struct Response where VatId: 'static, { variant: Rc>, } impl Response { fn new( connection_state: Rc>, question_ref: Rc>>, message: Box, cap_table_array: Vec>>, ) -> Self { Self { variant: Rc::new(ResponseVariant::Rpc(ResponseState { _connection_state: connection_state, message, cap_table: cap_table_array, _question_ref: question_ref, })), } } fn redirected(results_done: Box) -> Self { Self { variant: Rc::new(ResponseVariant::LocallyRedirected(results_done)), } } } impl Clone for Response { fn clone(&self) -> Self { Self { variant: self.variant.clone(), } } } impl ResponseHook for Response { fn get(&self) -> ::capnp::Result { match *self.variant { ResponseVariant::Rpc(ref state) => { match state .message .get_body()? .get_as::()? .which()? { message::Return(Ok(ret)) => match ret.which()? { return_::Results(Ok(mut payload)) => { use ::capnp::traits::Imbue; payload.imbue(&state.cap_table); Ok(payload.get_content()) } _ => unreachable!(), }, _ => unreachable!(), } } ResponseVariant::LocallyRedirected(ref results_done) => results_done.get(), } } } struct Request where VatId: 'static, { connection_state: Rc>, target: Client, message: Box, cap_table: Vec>>, } fn get_call(message: &mut Box) -> ::capnp::Result { let message_root: message::Builder = message.get_body()?.get_as()?; match message_root.which()? { message::Call(call) => call, _ => { unimplemented!() } } } impl Request where VatId: 'static, { fn new( connection_state: Rc>, _size_hint: Option<::capnp::MessageSize>, target: Client, ) -> ::capnp::Result { let message = connection_state.new_outgoing_message(100)?; Ok(Self { connection_state, target, message, cap_table: Vec::new(), }) } fn init_call(&mut self) -> call::Builder { let message_root: message::Builder = self.message.get_body().unwrap().get_as().unwrap(); message_root.init_call() } fn send_internal( connection_state: &Rc>, mut message: Box, cap_table: &[Option>], is_tail_call: bool, ) -> ( Rc>>, Promise, Error>, ) { // Build the cap table. let exports = ConnectionState::write_descriptors( connection_state, cap_table, get_call(&mut message).unwrap().get_params().unwrap(), ); // Init the question table. Do this after writing descriptors to avoid interference. let mut question = Question::::new(); question.is_awaiting_return = true; question.param_exports = exports; question.is_tail_call = is_tail_call; let question_id = connection_state.questions.borrow_mut().push(question); { let mut call_builder: call::Builder = get_call(&mut message).unwrap(); // Finish and send. call_builder.reborrow().set_question_id(question_id); if is_tail_call { call_builder.get_send_results_to().set_yourself(()); } } let _ = message.send(); // Make the result promise. let (fulfiller, promise) = oneshot::channel::, Error>>(); let promise = promise.map_err(crate::canceled_to_error).and_then(|x| x); let question_ref = Rc::new(RefCell::new(QuestionRef::new( connection_state.clone(), question_id, fulfiller, ))); match connection_state.questions.borrow_mut().slots[question_id as usize] { Some(ref mut q) => { q.self_ref = Some(Rc::downgrade(&question_ref)); } None => unreachable!(), } let promise = promise.attach(question_ref.clone()); let promise2 = Promise::from_future(promise); (question_ref, promise2) } } impl RequestHook for Request { fn get(&mut self) -> any_pointer::Builder { use ::capnp::traits::ImbueMut; let mut builder = get_call(&mut self.message) .unwrap() .get_params() .unwrap() .get_content(); builder.imbue_mut(&mut self.cap_table); builder } fn get_brand<'a>(&self) -> usize { self.connection_state.get_brand() } fn send(self: Box) -> ::capnp::capability::RemotePromise { let tmp = *self; let Self { connection_state, target, mut message, cap_table, } = tmp; let write_target_result = { let call_builder: call::Builder = get_call(&mut message).unwrap(); target.write_target(call_builder.get_target().unwrap()) }; match write_target_result { Some(redirect) => { // Whoops, this capability has been redirected while we were building the request! // We'll have to make a new request and do a copy. Ick. let mut call_builder: call::Builder = get_call(&mut message).unwrap(); let mut replacement = redirect.new_call( call_builder.reborrow().get_interface_id(), call_builder.reborrow().get_method_id(), None, ); replacement .set( call_builder .get_params() .unwrap() .get_content() .into_reader(), ) .unwrap(); replacement.send() } None => { let (question_ref, promise) = Self::send_internal(&connection_state, message, &cap_table, false); let forked_promise1 = promise.shared(); let forked_promise2 = forked_promise1.clone(); // The pipeline must get notified of resolution before the app does to maintain ordering. let pipeline = Pipeline::new( &connection_state, question_ref, Some(Promise::from_future(forked_promise1)), ); let resolved = pipeline.when_resolved(); let forked_promise2 = resolved.map(|_| Ok(())).and_then(|()| forked_promise2); let app_promise = Promise::from_future( forked_promise2 .map_ok(|response| ::capnp::capability::Response::new(Box::new(response))), ); ::capnp::capability::RemotePromise { promise: app_promise, pipeline: any_pointer::Pipeline::new(Box::new(pipeline)), } } } } fn tail_send(self: Box) -> Option<(u32, Promise<(), Error>, Box)> { let tmp = *self; let Self { connection_state, target, mut message, cap_table, } = tmp; if connection_state.connection.borrow().is_err() { // Disconnected; fall back to a regular send() which will fail appropriately. return None; } let write_target_result = { let call_builder: crate::rpc_capnp::call::Builder = get_call(&mut message).unwrap(); target.write_target(call_builder.get_target().unwrap()) }; let (question_ref, promise) = match write_target_result { Some(_redirect) => { return None; } None => Self::send_internal(&connection_state, message, &cap_table, true), }; let promise = promise.map_ok(|_response| { // Response should be null if `Return` handling code is correct. unimplemented!() }); let question_id = question_ref.borrow().id; let pipeline = Pipeline::never_done(connection_state, question_ref); Some(( question_id, Promise::from_future(promise), Box::new(pipeline), )) } } enum PipelineVariant where VatId: 'static, { Waiting(Rc>>), Resolved(Response), Broken(Error), } struct PipelineState where VatId: 'static, { variant: PipelineVariant, redirect_later: Option, Error>>>>, connection_state: Rc>, #[allow(dead_code)] resolve_self_promise: Promise<(), Error>, promise_clients_to_resolve: RefCell< crate::sender_queue::SenderQueue< (Weak>>, Vec), (), >, >, resolution_waiters: crate::sender_queue::SenderQueue<(), ()>, } impl PipelineState where VatId: 'static, { fn resolve(state: &Rc>, response: Result, Error>) { let to_resolve = { let tmp = state.borrow(); let r = tmp.promise_clients_to_resolve.borrow_mut().drain(); r }; for ((c, ops), _) in to_resolve { let resolved = match response.clone() { Ok(v) => match v.get() { Ok(x) => x.get_pipelined_cap(&ops), Err(e) => Err(e), }, Err(e) => Err(e), }; if let Some(c) = c.upgrade() { c.borrow_mut().resolve(resolved); } } let new_variant = match response { Ok(r) => PipelineVariant::Resolved(r), Err(e) => PipelineVariant::Broken(e), }; let _old_variant = mem::replace(&mut state.borrow_mut().variant, new_variant); let waiters = state.borrow_mut().resolution_waiters.drain(); for (_, waiter) in waiters { let _ = waiter.send(()); } } } struct Pipeline where VatId: 'static, { state: Rc>>, } impl Pipeline { fn new( connection_state: &Rc>, question_ref: Rc>>, redirect_later: Option, ::capnp::Error>>, ) -> Self { let state = Rc::new(RefCell::new(PipelineState { variant: PipelineVariant::Waiting(question_ref), connection_state: connection_state.clone(), redirect_later: None, resolve_self_promise: Promise::from_future(future::pending()), promise_clients_to_resolve: RefCell::new(crate::sender_queue::SenderQueue::new()), resolution_waiters: crate::sender_queue::SenderQueue::new(), })); if let Some(redirect_later_promise) = redirect_later { let fork = redirect_later_promise.shared(); let this = Rc::downgrade(&state); let resolve_self_promise = connection_state.eagerly_evaluate(fork.clone().then(move |response| { let Some(state) = this.upgrade() else { return Promise::err(Error::failed("dangling reference to this".into())); }; PipelineState::resolve(&state, response); Promise::ok(()) })); state.borrow_mut().resolve_self_promise = resolve_self_promise; state.borrow_mut().redirect_later = Some(RefCell::new(fork)); } Self { state } } fn when_resolved(&self) -> Promise<(), Error> { self.state.borrow_mut().resolution_waiters.push(()) } fn never_done( connection_state: Rc>, question_ref: Rc>>, ) -> Self { let state = Rc::new(RefCell::new(PipelineState { variant: PipelineVariant::Waiting(question_ref), connection_state, redirect_later: None, resolve_self_promise: Promise::from_future(future::pending()), promise_clients_to_resolve: RefCell::new(crate::sender_queue::SenderQueue::new()), resolution_waiters: crate::sender_queue::SenderQueue::new(), })); Self { state } } } impl PipelineHook for Pipeline { fn add_ref(&self) -> Box { Box::new(Self { state: self.state.clone(), }) } fn get_pipelined_cap(&self, ops: &[PipelineOp]) -> Box { self.get_pipelined_cap_move(ops.into()) } fn get_pipelined_cap_move(&self, ops: Vec) -> Box { match *self.state.borrow() { PipelineState { variant: PipelineVariant::Waiting(ref question_ref), ref connection_state, ref redirect_later, ref promise_clients_to_resolve, .. } => { // Wrap a PipelineClient in a PromiseClient. let pipeline_client = PipelineClient::new(connection_state, question_ref.clone(), ops.clone()); match redirect_later { Some(_r) => { let client: Client = pipeline_client.into(); let promise_client = PromiseClient::new(connection_state, Box::new(client), None); promise_clients_to_resolve .borrow_mut() .push_detach((Rc::downgrade(&promise_client), ops)); let result: Client = promise_client.into(); Box::new(result) } None => { // Oh, this pipeline will never get redirected, so just return the PipelineClient. let client: Client = pipeline_client.into(); Box::new(client) } } } PipelineState { variant: PipelineVariant::Resolved(ref response), .. } => response.get().unwrap().get_pipelined_cap(&ops[..]).unwrap(), PipelineState { variant: PipelineVariant::Broken(ref e), .. } => broken::new_cap(e.clone()), } } } pub struct Params { request: Box, cap_table: Vec>>, } impl Params { fn new( request: Box, cap_table: Vec>>, ) -> Self { Self { request, cap_table } } } impl ParamsHook for Params { fn get(&self) -> ::capnp::Result { let root: message::Reader = self.request.get_body()?.get_as()?; match root.which()? { message::Call(call) => { use ::capnp::traits::Imbue; let mut content = call?.get_params()?.get_content(); content.imbue(&self.cap_table); Ok(content) } _ => { unreachable!() } } } } enum ResultsVariant { Rpc( Box, Vec>>, ), LocallyRedirected( ::capnp::message::Builder<::capnp::message::HeapAllocator>, Vec>>, ), } struct ResultsInner where VatId: 'static, { connection_state: Rc>, variant: Option, redirect_results: bool, answer_id: AnswerId, finish_received: Rc>, } impl ResultsInner where VatId: 'static, { fn ensure_initialized(&mut self) { let answer_id = self.answer_id; if self.variant.is_none() { match ( self.redirect_results, self.connection_state.connection.borrow_mut().as_mut(), ) { (false, Ok(c)) => { let mut message = c.new_outgoing_message(100); // size hint? { let root: message::Builder = message.get_body().unwrap().init_as(); let mut ret = root.init_return(); ret.set_answer_id(answer_id); ret.set_release_param_caps(false); } self.variant = Some(ResultsVariant::Rpc(message, Vec::new())); } _ => { self.variant = Some(ResultsVariant::LocallyRedirected( ::capnp::message::Builder::new_default(), Vec::new(), )); } } } } } // This takes the place of both RpcCallContext and RpcServerResponse in capnproto-c++. pub struct Results where VatId: 'static, { inner: Option>, results_done_fulfiller: Option>>, } impl Results where VatId: 'static, { fn new( connection_state: &Rc>, answer_id: AnswerId, redirect_results: bool, fulfiller: oneshot::Sender>, finish_received: Rc>, ) -> Self { Self { inner: Some(ResultsInner { variant: None, connection_state: connection_state.clone(), redirect_results, answer_id, finish_received, }), results_done_fulfiller: Some(fulfiller), } } } impl Drop for Results { fn drop(&mut self) { match (self.inner.take(), self.results_done_fulfiller.take()) { (Some(inner), Some(fulfiller)) => { let _ = fulfiller.send(inner); } (None, None) => (), _ => unreachable!(), } } } impl ResultsHook for Results { fn get(&mut self) -> ::capnp::Result { use ::capnp::traits::ImbueMut; if let Some(ref mut inner) = self.inner { inner.ensure_initialized(); match inner.variant { None => unreachable!(), Some(ResultsVariant::Rpc(ref mut message, ref mut cap_table)) => { let root: message::Builder = message.get_body()?.get_as()?; match root.which()? { message::Return(ret) => match ret?.which()? { return_::Results(payload) => { let mut content = payload?.get_content(); content.imbue_mut(cap_table); Ok(content) } _ => { unreachable!() } }, _ => { unreachable!() } } } Some(ResultsVariant::LocallyRedirected(ref mut message, ref mut cap_table)) => { let mut result: any_pointer::Builder = message.get_root()?; result.imbue_mut(cap_table); Ok(result) } } } else { unreachable!() } } fn tail_call(self: Box, _request: Box) -> Promise<(), Error> { unimplemented!() } fn direct_tail_call( mut self: Box, request: Box, ) -> (Promise<(), Error>, Box) { if let (Some(inner), Some(fulfiller)) = (self.inner.take(), self.results_done_fulfiller.take()) { let state = inner.connection_state.clone(); if request.get_brand() == state.get_brand() && !inner.redirect_results { // The tail call is headed towards the peer that called us in the first place, so we can // optimize out the return trip. if let Some((question_id, promise, pipeline)) = request.tail_send() { let mut message = state.new_outgoing_message(100).expect("no connection?"); // size hint? { let root: message::Builder = message.get_body().unwrap().init_as(); let mut ret = root.init_return(); ret.set_answer_id(inner.answer_id); ret.set_release_param_caps(false); ret.set_take_from_other_question(question_id); } let _ = message.send(); // TODO cleanupanswertable let _ = fulfiller.send(inner); // ?? return (promise, pipeline); } unimplemented!() } else { unimplemented!() } } else { unreachable!(); } } fn allow_cancellation(&self) { unimplemented!() } } enum ResultsDoneVariant { Rpc( Rc<::capnp::message::Builder<::capnp::message::HeapAllocator>>, Vec>>, ), LocallyRedirected( ::capnp::message::Builder<::capnp::message::HeapAllocator>, Vec>>, ), } struct ResultsDone { inner: Rc, } impl ResultsDone { fn from_results_inner( results_inner: Result, Error>, call_status: Result<(), Error>, pipeline_sender: queued::PipelineInnerSender, ) -> Result, Error> where VatId: 'static, { match results_inner { Err(e) => { pipeline_sender.complete(Box::new(crate::broken::Pipeline::new(e.clone()))); Err(e) } Ok(mut results_inner) => { results_inner.ensure_initialized(); let ResultsInner { connection_state, variant, answer_id, finish_received, .. } = results_inner; match variant { None => unreachable!(), Some(ResultsVariant::Rpc(mut message, cap_table)) => { match (finish_received.get(), call_status) { (true, _) => { let hook = Box::new(Self::rpc(Rc::new(message.take()), cap_table)) as Box; pipeline_sender .complete(Box::new(local::Pipeline::new(hook.clone()))); // Send a Canceled return. if let Ok(connection) = connection_state.connection.borrow_mut().as_mut() { let mut message = connection.new_outgoing_message(50); // XXX size hint { let root: message::Builder = message.get_body()?.get_as()?; let mut ret = root.init_return(); ret.set_answer_id(answer_id); ret.set_release_param_caps(false); ret.set_canceled(()); } let _ = message.send(); } connection_state.answer_has_sent_return(answer_id, Vec::new()); Ok(hook) } (false, Ok(())) => { let exports = { let root: message::Builder = message.get_body()?.get_as()?; match root.which()? { message::Return(ret) => match ret?.which()? { crate::rpc_capnp::return_::Results(Ok(payload)) => { ConnectionState::write_descriptors( &connection_state, &cap_table, payload, ) } _ => { unreachable!() } }, _ => { unreachable!() } } }; let (_promise, m) = message.send(); connection_state.answer_has_sent_return(answer_id, exports); let hook = Box::new(Self::rpc(m, cap_table)) as Box; pipeline_sender .complete(Box::new(local::Pipeline::new(hook.clone()))); Ok(hook) } (false, Err(e)) => { // Send an error return. if let Ok(connection) = connection_state.connection.borrow_mut().as_mut() { let mut message = connection.new_outgoing_message(50); // XXX size hint { let root: message::Builder = message.get_body()?.get_as()?; let mut ret = root.init_return(); ret.set_answer_id(answer_id); ret.set_release_param_caps(false); let mut exc = ret.init_exception(); from_error(&e, exc.reborrow()); } let _ = message.send(); } connection_state.answer_has_sent_return(answer_id, Vec::new()); pipeline_sender .complete(Box::new(crate::broken::Pipeline::new(e.clone()))); Err(e) } } } Some(ResultsVariant::LocallyRedirected(results_done, cap_table)) => { let hook = Box::new(Self::redirected(results_done, cap_table)) as Box; pipeline_sender .complete(Box::new(crate::local::Pipeline::new(hook.clone()))); Ok(hook) } } } } } fn rpc( message: Rc<::capnp::message::Builder<::capnp::message::HeapAllocator>>, cap_table: Vec>>, ) -> Self { Self { inner: Rc::new(ResultsDoneVariant::Rpc(message, cap_table)), } } fn redirected( message: ::capnp::message::Builder<::capnp::message::HeapAllocator>, cap_table: Vec>>, ) -> Self { Self { inner: Rc::new(ResultsDoneVariant::LocallyRedirected(message, cap_table)), } } } impl ResultsDoneHook for ResultsDone { fn add_ref(&self) -> Box { Box::new(Self { inner: self.inner.clone(), }) } fn get(&self) -> ::capnp::Result { use ::capnp::traits::Imbue; match *self.inner { ResultsDoneVariant::Rpc(ref message, ref cap_table) => { let root: message::Reader = message.get_root_as_reader()?; match root.which()? { message::Return(ret) => match ret?.which()? { crate::rpc_capnp::return_::Results(payload) => { let mut content = payload?.get_content(); content.imbue(cap_table); Ok(content) } _ => { unreachable!() } }, _ => { unreachable!() } } } ResultsDoneVariant::LocallyRedirected(ref message, ref cap_table) => { let mut result: any_pointer::Reader = message.get_root_as_reader()?; result.imbue(cap_table); Ok(result) } } } } enum ClientVariant where VatId: 'static, { Import(Rc>>), Pipeline(Rc>>), Promise(Rc>>), __NoIntercept(()), } struct Client where VatId: 'static, { connection_state: Rc>, variant: ClientVariant, } enum WeakClientVariant where VatId: 'static, { Import(Weak>>), Pipeline(Weak>>), Promise(Weak>>), __NoIntercept(()), } struct WeakClient where VatId: 'static, { connection_state: Weak>, variant: WeakClientVariant, } impl WeakClient where VatId: 'static, { fn upgrade(&self) -> Option> { let variant = match &self.variant { WeakClientVariant::Import(ic) => ClientVariant::Import(ic.upgrade()?), WeakClientVariant::Pipeline(pc) => ClientVariant::Pipeline(pc.upgrade()?), WeakClientVariant::Promise(pc) => ClientVariant::Promise(pc.upgrade()?), WeakClientVariant::__NoIntercept(()) => ClientVariant::__NoIntercept(()), }; let connection_state = self.connection_state.upgrade()?; Some(Client { connection_state, variant, }) } } struct ImportClient where VatId: 'static, { connection_state: Rc>, import_id: ImportId, /// Number of times we've received this import from the peer. remote_ref_count: u32, } impl Drop for ImportClient { fn drop(&mut self) { let connection_state = self.connection_state.clone(); assert!(connection_state .client_downcast_map .borrow_mut() .remove(&((self) as *const _ as usize)) .is_some()); // Remove self from the import table, if the table is still pointing at us. let mut remove = false; if let Some(import) = connection_state.imports.borrow().slots.get(&self.import_id) { if let Some((_, ptr)) = import.import_client { if ptr == ((&*self) as *const _ as usize) { remove = true; } } } if remove { connection_state .imports .borrow_mut() .slots .remove(&self.import_id); } // Send a message releasing our remote references. let mut tmp = connection_state.connection.borrow_mut(); if let (true, Ok(c)) = (self.remote_ref_count > 0, tmp.as_mut()) { let mut message = c.new_outgoing_message(50); // XXX size hint { let root: message::Builder = message.get_body().unwrap().init_as(); let mut release = root.init_release(); release.set_id(self.import_id); release.set_reference_count(self.remote_ref_count); } let _ = message.send(); } } } impl ImportClient where VatId: 'static, { fn new( connection_state: &Rc>, import_id: ImportId, ) -> Rc> { Rc::new(RefCell::new(Self { connection_state: connection_state.clone(), import_id, remote_ref_count: 0, })) } fn add_remote_ref(&mut self) { self.remote_ref_count += 1; } } impl From>>> for Client { fn from(client: Rc>>) -> Self { let connection_state = client.borrow().connection_state.clone(); Self::new(&connection_state, ClientVariant::Import(client)) } } /// A `ClientHook` representing a pipelined promise. Always wrapped in `PromiseClient`. struct PipelineClient where VatId: 'static, { connection_state: Rc>, question_ref: Rc>>, ops: Vec, } impl PipelineClient where VatId: 'static, { fn new( connection_state: &Rc>, question_ref: Rc>>, ops: Vec, ) -> Rc> { Rc::new(RefCell::new(Self { connection_state: connection_state.clone(), question_ref, ops, })) } } impl From>>> for Client { fn from(client: Rc>>) -> Self { let connection_state = client.borrow().connection_state.clone(); Self::new(&connection_state, ClientVariant::Pipeline(client)) } } impl Drop for PipelineClient { fn drop(&mut self) { assert!(self .connection_state .client_downcast_map .borrow_mut() .remove(&((self) as *const _ as usize)) .is_some()); } } /// A `ClientHook` that initially wraps one client and then, later on, redirects /// to some other client. struct PromiseClient where VatId: 'static, { connection_state: Rc>, is_resolved: bool, cap: Box, import_id: Option, received_call: bool, resolution_waiters: crate::sender_queue::SenderQueue<(), Box>, } impl PromiseClient { fn new( connection_state: &Rc>, initial: Box, import_id: Option, ) -> Rc> { Rc::new(RefCell::new(Self { connection_state: connection_state.clone(), is_resolved: false, cap: initial, import_id, received_call: false, resolution_waiters: crate::sender_queue::SenderQueue::new(), })) } fn resolve(&mut self, replacement: Result, Error>) { let (mut replacement, is_error) = match replacement { Ok(v) => (v, false), Err(e) => (broken::new_cap(e), true), }; let connection_state = self.connection_state.clone(); let is_connected = connection_state.connection.borrow().is_ok(); let replacement_brand = replacement.get_brand(); if replacement_brand != connection_state.get_brand() && self.received_call && !is_error && is_connected { // The new capability is hosted locally, not on the remote machine. And, we had made calls // to the promise. We need to make sure those calls echo back to us before we allow new // calls to go directly to the local capability, so we need to set a local embargo and send // a `Disembargo` to echo through the peer. let (fulfiller, promise) = oneshot::channel::>(); let promise = promise .map_err(crate::canceled_to_error) .and_then(future::ready); let embargo = Embargo::new(fulfiller); let embargo_id = connection_state.embargoes.borrow_mut().push(embargo); let mut message = connection_state .new_outgoing_message(50) .expect("no connection?"); // XXX size hint { let root: message::Builder = message.get_body().unwrap().init_as(); let mut disembargo = root.init_disembargo(); disembargo .reborrow() .init_context() .set_sender_loopback(embargo_id); let target = disembargo.init_target(); let redirect = connection_state.write_target(&*self.cap, target); if redirect.is_some() { panic!("Original promise target should always be from this RPC connection.") } } // Make a promise which resolves to `replacement` as soon as the `Disembargo` comes back. let embargo_promise = promise.map_ok(move |()| replacement); let mut queued_client = queued::Client::new(None); let weak_queued = Rc::downgrade(&queued_client.inner); queued_client.drive(embargo_promise.then(move |r| { if let Some(q) = weak_queued.upgrade() { queued::ClientInner::resolve(&q, r); } Promise::ok(()) })); // We need to queue up calls in the meantime, so we'll resolve ourselves to a local promise // client instead. replacement = Box::new(queued_client); let _ = message.send(); } for ((), waiter) in self.resolution_waiters.drain() { let _ = waiter.send(replacement.clone()); } let old_cap = mem::replace(&mut self.cap, replacement); connection_state.add_task(async move { drop(old_cap); Ok(()) }); self.is_resolved = true; } } impl Drop for PromiseClient { fn drop(&mut self) { let self_ptr = (self) as *const _ as usize; if let Some(id) = self.import_id { // This object is representing an import promise. That means the import table may still // contain a pointer back to it. Remove that pointer. Note that we have to verify that // the import still exists and the pointer still points back to this object because this // object may actually outlive the import. let slots = &mut self.connection_state.imports.borrow_mut().slots; if let Some(import) = slots.get_mut(&id) { let mut drop_it = false; if let Some(c) = &import.app_client { if let Some(cs) = c.upgrade() { if cs.get_ptr() == self_ptr { drop_it = true; } } } if drop_it { import.app_client = None; } } } assert!(self .connection_state .client_downcast_map .borrow_mut() .remove(&self_ptr) .is_some()); } } impl From>>> for Client { fn from(client: Rc>>) -> Self { let connection_state = client.borrow().connection_state.clone(); Self::new(&connection_state, ClientVariant::Promise(client)) } } impl Client { fn new(connection_state: &Rc>, variant: ClientVariant) -> Self { let client = Self { connection_state: connection_state.clone(), variant, }; let weak = client.downgrade(); // XXX arguably, this should go in each of the variant's constructors. connection_state .client_downcast_map .borrow_mut() .insert(client.get_ptr(), weak); client } fn downgrade(&self) -> WeakClient { let variant = match &self.variant { ClientVariant::Import(import_client) => { WeakClientVariant::Import(Rc::downgrade(import_client)) } ClientVariant::Pipeline(pipeline_client) => { WeakClientVariant::Pipeline(Rc::downgrade(pipeline_client)) } ClientVariant::Promise(promise_client) => { WeakClientVariant::Promise(Rc::downgrade(promise_client)) } _ => { unimplemented!() } }; WeakClient { connection_state: Rc::downgrade(&self.connection_state), variant, } } fn from_ptr(ptr: usize, connection_state: &ConnectionState) -> Option { match connection_state.client_downcast_map.borrow().get(&ptr) { Some(c) => c.upgrade(), None => None, } } fn write_target( &self, mut target: crate::rpc_capnp::message_target::Builder, ) -> Option> { match &self.variant { ClientVariant::Import(import_client) => { target.set_imported_cap(import_client.borrow().import_id); None } ClientVariant::Pipeline(pipeline_client) => { let mut builder = target.init_promised_answer(); let question_ref = &pipeline_client.borrow().question_ref; builder.set_question_id(question_ref.borrow().id); let mut transform = builder.init_transform(pipeline_client.borrow().ops.len() as u32); for idx in 0..pipeline_client.borrow().ops.len() { if let ::capnp::private::capability::PipelineOp::GetPointerField(ordinal) = pipeline_client.borrow().ops[idx] { transform .reborrow() .get(idx as u32) .set_get_pointer_field(ordinal); } } None } ClientVariant::Promise(promise_client) => { promise_client.borrow_mut().received_call = true; self.connection_state .write_target(&*promise_client.borrow().cap, target) } _ => { unimplemented!() } } } fn write_descriptor(&self, mut descriptor: cap_descriptor::Builder) -> Option { match &self.variant { ClientVariant::Import(import_client) => { descriptor.set_receiver_hosted(import_client.borrow().import_id); None } ClientVariant::Pipeline(pipeline_client) => { let mut promised_answer = descriptor.init_receiver_answer(); let question_ref = &pipeline_client.borrow().question_ref; promised_answer.set_question_id(question_ref.borrow().id); let mut transform = promised_answer.init_transform(pipeline_client.borrow().ops.len() as u32); for idx in 0..pipeline_client.borrow().ops.len() { if let ::capnp::private::capability::PipelineOp::GetPointerField(ordinal) = pipeline_client.borrow().ops[idx] { transform .reborrow() .get(idx as u32) .set_get_pointer_field(ordinal); } } None } ClientVariant::Promise(promise_client) => { promise_client.borrow_mut().received_call = true; ConnectionState::write_descriptor( &self.connection_state.clone(), promise_client.borrow().cap.clone(), descriptor, ) .unwrap() } _ => { unimplemented!() } } } } impl Clone for Client { fn clone(&self) -> Self { let variant = match &self.variant { ClientVariant::Import(import_client) => ClientVariant::Import(import_client.clone()), ClientVariant::Pipeline(pipeline_client) => { ClientVariant::Pipeline(pipeline_client.clone()) } ClientVariant::Promise(promise_client) => { ClientVariant::Promise(promise_client.clone()) } _ => { unimplemented!() } }; Self { connection_state: self.connection_state.clone(), variant, } } } impl ClientHook for Client { fn add_ref(&self) -> Box { Box::new(self.clone()) } fn new_call( &self, interface_id: u64, method_id: u16, size_hint: Option<::capnp::MessageSize>, ) -> ::capnp::capability::Request { let request: Box = match Request::new(self.connection_state.clone(), size_hint, self.clone()) { Ok(mut request) => { { let mut call_builder = request.init_call(); call_builder.set_interface_id(interface_id); call_builder.set_method_id(method_id); } Box::new(request) } Err(e) => Box::new(broken::Request::new(e, None)), }; ::capnp::capability::Request::new(request) } fn call( &self, interface_id: u64, method_id: u16, params: Box, mut results: Box, ) -> Promise<(), Error> { // Implement call() by copying params and results messages. let maybe_request = params.get().and_then(|p| { let mut request = p .target_size() .map(|s| self.new_call(interface_id, method_id, Some(s)))?; request.get().set_as(p)?; Ok(request) }); match maybe_request { Err(e) => Promise::err(e), Ok(request) => { let ::capnp::capability::RemotePromise { promise, .. } = request.send(); let promise = promise.and_then(move |response| { pry!(pry!(results.get()).set_as(pry!(response.get()))); Promise::ok(()) }); Promise::from_future(promise) } } // TODO implement this in terms of direct tail call. // We can and should propagate cancellation. // (TODO ?) // context -> allowCancellation(); //results.direct_tail_call(request.hook) } fn get_ptr(&self) -> usize { match &self.variant { ClientVariant::Import(import_client) => (&*import_client.borrow()) as *const _ as usize, ClientVariant::Pipeline(pipeline_client) => { (&*pipeline_client.borrow()) as *const _ as usize } ClientVariant::Promise(promise_client) => { (&*promise_client.borrow()) as *const _ as usize } _ => { unimplemented!() } } } fn get_brand(&self) -> usize { self.connection_state.get_brand() } fn get_resolved(&self) -> Option> { match &self.variant { ClientVariant::Import(_import_client) => None, ClientVariant::Pipeline(_pipeline_client) => None, ClientVariant::Promise(promise_client) => { if promise_client.borrow().is_resolved { Some(promise_client.borrow().cap.clone()) } else { None } } _ => { unimplemented!() } } } fn when_more_resolved(&self) -> Option, Error>> { match &self.variant { ClientVariant::Import(_import_client) => None, ClientVariant::Pipeline(_pipeline_client) => None, ClientVariant::Promise(promise_client) => { Some(promise_client.borrow_mut().resolution_waiters.push(())) } _ => { unimplemented!() } } } fn when_resolved(&self) -> Promise<(), Error> { default_when_resolved_impl(self) } } pub(crate) fn default_when_resolved_impl(client: &C) -> Promise<(), Error> where C: ClientHook, { match client.when_more_resolved() { Some(promise) => { Promise::from_future(promise.and_then(|resolution| resolution.when_resolved())) } None => Promise::ok(()), } } // =================================== struct SingleCapPipeline { cap: Box, } impl SingleCapPipeline { fn new(cap: Box) -> Self { Self { cap } } } impl PipelineHook for SingleCapPipeline { fn add_ref(&self) -> Box { Box::new(Self { cap: self.cap.clone(), }) } fn get_pipelined_cap(&self, ops: &[PipelineOp]) -> Box { if ops.is_empty() { self.cap.add_ref() } else { broken::new_cap(Error::failed("Invalid pipeline transform.".to_string())) } } } capnp-rpc-0.19.0/src/rpc_capnp.rs000064400000000000000000012553571046102023000147220ustar 00000000000000// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. // DO NOT EDIT. // source: rpc.capnp pub mod message { pub use self::Which::{ Abort, Accept, Bootstrap, Call, Disembargo, Finish, Join, ObsoleteDelete, ObsoleteSave, Provide, Release, Resolve, Return, Unimplemented, }; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn has_unimplemented(&self) -> bool { if self.reader.get_data_field::(0) != 0 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_abort(&self) -> bool { if self.reader.get_data_field::(0) != 1 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_call(&self) -> bool { if self.reader.get_data_field::(0) != 2 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_return(&self) -> bool { if self.reader.get_data_field::(0) != 3 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_finish(&self) -> bool { if self.reader.get_data_field::(0) != 4 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_resolve(&self) -> bool { if self.reader.get_data_field::(0) != 5 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_release(&self) -> bool { if self.reader.get_data_field::(0) != 6 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_obsolete_save(&self) -> bool { if self.reader.get_data_field::(0) != 7 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_bootstrap(&self) -> bool { if self.reader.get_data_field::(0) != 8 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_obsolete_delete(&self) -> bool { if self.reader.get_data_field::(0) != 9 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_provide(&self) -> bool { if self.reader.get_data_field::(0) != 10 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_accept(&self) -> bool { if self.reader.get_data_field::(0) != 11 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_join(&self) -> bool { if self.reader.get_data_field::(0) != 12 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_disembargo(&self) -> bool { if self.reader.get_data_field::(0) != 13 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(0) { 0 => ::core::result::Result::Ok(Unimplemented( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 1 => ::core::result::Result::Ok(Abort( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 2 => ::core::result::Result::Ok(Call( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 3 => ::core::result::Result::Ok(Return( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 4 => ::core::result::Result::Ok(Finish( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 5 => ::core::result::Result::Ok(Resolve( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 6 => ::core::result::Result::Ok(Release( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 7 => ::core::result::Result::Ok(ObsoleteSave(::capnp::any_pointer::Reader::new( self.reader.get_pointer_field(0), ))), 8 => ::core::result::Result::Ok(Bootstrap( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 9 => ::core::result::Result::Ok(ObsoleteDelete(::capnp::any_pointer::Reader::new( self.reader.get_pointer_field(0), ))), 10 => ::core::result::Result::Ok(Provide( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 11 => ::core::result::Result::Ok(Accept( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 12 => ::core::result::Result::Ok(Join( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 13 => ::core::result::Result::Ok(Disembargo( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn set_unimplemented( &mut self, value: crate::rpc_capnp::message::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 0); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_unimplemented(self) -> crate::rpc_capnp::message::Builder<'a> { self.builder.set_data_field::(0, 0); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_unimplemented(&self) -> bool { if self.builder.get_data_field::(0) != 0 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_abort( &mut self, value: crate::rpc_capnp::exception::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 1); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_abort(self) -> crate::rpc_capnp::exception::Builder<'a> { self.builder.set_data_field::(0, 1); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_abort(&self) -> bool { if self.builder.get_data_field::(0) != 1 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_call( &mut self, value: crate::rpc_capnp::call::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 2); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_call(self) -> crate::rpc_capnp::call::Builder<'a> { self.builder.set_data_field::(0, 2); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_call(&self) -> bool { if self.builder.get_data_field::(0) != 2 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_return( &mut self, value: crate::rpc_capnp::return_::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 3); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_return(self) -> crate::rpc_capnp::return_::Builder<'a> { self.builder.set_data_field::(0, 3); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_return(&self) -> bool { if self.builder.get_data_field::(0) != 3 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_finish( &mut self, value: crate::rpc_capnp::finish::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 4); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_finish(self) -> crate::rpc_capnp::finish::Builder<'a> { self.builder.set_data_field::(0, 4); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_finish(&self) -> bool { if self.builder.get_data_field::(0) != 4 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_resolve( &mut self, value: crate::rpc_capnp::resolve::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 5); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_resolve(self) -> crate::rpc_capnp::resolve::Builder<'a> { self.builder.set_data_field::(0, 5); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_resolve(&self) -> bool { if self.builder.get_data_field::(0) != 5 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_release( &mut self, value: crate::rpc_capnp::release::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 6); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_release(self) -> crate::rpc_capnp::release::Builder<'a> { self.builder.set_data_field::(0, 6); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_release(&self) -> bool { if self.builder.get_data_field::(0) != 6 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn init_obsolete_save(self) -> ::capnp::any_pointer::Builder<'a> { self.builder.set_data_field::(0, 7); let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_obsolete_save(&self) -> bool { if self.builder.get_data_field::(0) != 7 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_bootstrap( &mut self, value: crate::rpc_capnp::bootstrap::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 8); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_bootstrap(self) -> crate::rpc_capnp::bootstrap::Builder<'a> { self.builder.set_data_field::(0, 8); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_bootstrap(&self) -> bool { if self.builder.get_data_field::(0) != 8 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn init_obsolete_delete(self) -> ::capnp::any_pointer::Builder<'a> { self.builder.set_data_field::(0, 9); let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_obsolete_delete(&self) -> bool { if self.builder.get_data_field::(0) != 9 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_provide( &mut self, value: crate::rpc_capnp::provide::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 10); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_provide(self) -> crate::rpc_capnp::provide::Builder<'a> { self.builder.set_data_field::(0, 10); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_provide(&self) -> bool { if self.builder.get_data_field::(0) != 10 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_accept( &mut self, value: crate::rpc_capnp::accept::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 11); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_accept(self) -> crate::rpc_capnp::accept::Builder<'a> { self.builder.set_data_field::(0, 11); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_accept(&self) -> bool { if self.builder.get_data_field::(0) != 11 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_join( &mut self, value: crate::rpc_capnp::join::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 12); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_join(self) -> crate::rpc_capnp::join::Builder<'a> { self.builder.set_data_field::(0, 12); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_join(&self) -> bool { if self.builder.get_data_field::(0) != 12 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_disembargo( &mut self, value: crate::rpc_capnp::disembargo::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 13); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_disembargo(self) -> crate::rpc_capnp::disembargo::Builder<'a> { self.builder.set_data_field::(0, 13); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_disembargo(&self) -> bool { if self.builder.get_data_field::(0) != 13 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.builder.get_data_field::(0) { 0 => ::core::result::Result::Ok(Unimplemented( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 1 => ::core::result::Result::Ok(Abort( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 2 => ::core::result::Result::Ok(Call( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 3 => ::core::result::Result::Ok(Return( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 4 => ::core::result::Result::Ok(Finish( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 5 => ::core::result::Result::Ok(Resolve( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 6 => ::core::result::Result::Ok(Release( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 7 => ::core::result::Result::Ok(ObsoleteSave(::capnp::any_pointer::Builder::new( self.builder.get_pointer_field(0), ))), 8 => ::core::result::Result::Ok(Bootstrap( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 9 => ::core::result::Result::Ok(ObsoleteDelete( ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)), )), 10 => ::core::result::Result::Ok(Provide( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 11 => ::core::result::Result::Ok(Accept( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 12 => ::core::result::Result::Ok(Join( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 13 => ::core::result::Result::Ok(Disembargo( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 232] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(50, 176, 141, 128, 31, 159, 183, 145), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 14, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 146, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 23, 3, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 77, 101, 115, 115, 97, 103), ::capnp::word(101, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(56, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(121, 1, 0, 0, 114, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(120, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(132, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 254, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(129, 1, 0, 0, 50, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(124, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(136, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(3, 0, 253, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(133, 1, 0, 0, 42, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(128, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(140, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(4, 0, 252, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(137, 1, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(132, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(144, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(5, 0, 251, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(141, 1, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(136, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(148, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(6, 0, 250, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(145, 1, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(140, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(152, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(7, 0, 249, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(149, 1, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(144, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(156, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(9, 0, 248, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(153, 1, 0, 0, 106, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(152, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(164, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 247, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(161, 1, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(160, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(172, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(10, 0, 246, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 9, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(169, 1, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(168, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(180, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(11, 0, 245, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 10, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(177, 1, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(172, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(184, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(12, 0, 244, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 11, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(181, 1, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(176, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(188, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(13, 0, 243, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 12, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(185, 1, 0, 0, 42, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(180, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(192, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(8, 0, 242, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 13, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(189, 1, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(188, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(200, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(117, 110, 105, 109, 112, 108, 101, 109), ::capnp::word(101, 110, 116, 101, 100, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(50, 176, 141, 128, 31, 159, 183, 145), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(97, 98, 111, 114, 116, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(26, 105, 207, 58, 6, 183, 37, 214), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 97, 108, 108, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(212, 76, 157, 120, 206, 83, 106, 131), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 116, 117, 114, 110, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(58, 87, 179, 61, 141, 178, 25, 158), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(102, 105, 110, 105, 115, 104, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 14, 248, 194, 178, 46, 125, 211), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 115, 111, 108, 118, 101, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(110, 8, 137, 250, 85, 150, 194, 187), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 108, 101, 97, 115, 101, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(151, 116, 208, 125, 13, 108, 26, 173), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(111, 98, 115, 111, 108, 101, 116, 101), ::capnp::word(83, 97, 118, 101, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(98, 111, 111, 116, 115, 116, 114, 97), ::capnp::word(112, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(196, 110, 23, 49, 128, 207, 76, 233), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(111, 98, 115, 111, 108, 101, 116, 101), ::capnp::word(68, 101, 108, 101, 116, 101, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 114, 111, 118, 105, 100, 101, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(90, 172, 193, 251, 107, 4, 106, 156), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(97, 99, 99, 101, 112, 116, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(22, 64, 85, 144, 98, 181, 201, 212), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(106, 111, 105, 110, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(175, 1, 224, 144, 4, 152, 225, 251), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(100, 105, 115, 101, 109, 98, 97, 114), ::capnp::word(103, 111, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(17, 55, 189, 15, 139, 54, 100, 249), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => ::introspect(), 3 => ::introspect(), 4 => ::introspect(), 5 => ::introspect(), 6 => ::introspect(), 7 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), 8 => ::introspect(), 9 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), 10 => ::introspect(), 11 => ::introspect(), 12 => ::introspect(), 13 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; pub static MEMBERS_BY_NAME: &[u16] = &[1, 11, 8, 2, 13, 4, 12, 9, 7, 10, 6, 5, 3, 0]; pub const TYPE_ID: u64 = 0x91b7_9f1f_808d_b032; } pub enum Which { Unimplemented(A0), Abort(A1), Call(A2), Return(A3), Finish(A4), Resolve(A5), Release(A6), ObsoleteSave(A7), Bootstrap(A8), ObsoleteDelete(A9), Provide(A10), Accept(A11), Join(A12), Disembargo(A13), } pub type WhichReader<'a> = Which< ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::any_pointer::Reader<'a>, ::capnp::Result>, ::capnp::any_pointer::Reader<'a>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, >; pub type WhichBuilder<'a> = Which< ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::any_pointer::Builder<'a>, ::capnp::Result>, ::capnp::any_pointer::Builder<'a>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, ::capnp::Result>, >; } pub mod bootstrap { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_deprecated_object_id(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(0)) } #[inline] pub fn has_deprecated_object_id(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_deprecated_object_id(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)) } #[inline] pub fn init_deprecated_object_id(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_deprecated_object_id(&self) -> bool { !self.builder.is_pointer_field_null(0) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_deprecated_object_id(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 50] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(196, 110, 23, 49, 128, 207, 76, 233), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 162, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 66, 111, 111, 116, 115, 116), ::capnp::word(114, 97, 112, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(49, 0, 0, 0, 154, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(52, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(64, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(100, 101, 112, 114, 101, 99, 97, 116), ::capnp::word(101, 100, 79, 98, 106, 101, 99, 116), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[1, 0]; pub const TYPE_ID: u64 = 0xe94c_cf80_3117_6ec4; } } pub mod call { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn has_target(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_interface_id(self) -> u64 { self.reader.get_data_field::(1) } #[inline] pub fn get_method_id(self) -> u16 { self.reader.get_data_field::(2) } #[inline] pub fn get_params(self) -> ::capnp::Result> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(1), ::core::option::Option::None, ) } #[inline] pub fn has_params(&self) -> bool { !self.reader.get_pointer_field(1).is_null() } #[inline] pub fn get_send_results_to(self) -> crate::rpc_capnp::call::send_results_to::Reader<'a> { self.reader.into() } #[inline] pub fn get_allow_third_party_tail_call(self) -> bool { self.reader.get_bool_field(128) } #[inline] pub fn get_no_promise_pipelining(self) -> bool { self.reader.get_bool_field(129) } #[inline] pub fn get_only_promise_pipeline(self) -> bool { self.reader.get_bool_field(130) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 3, pointers: 3, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn set_target( &mut self, value: crate::rpc_capnp::message_target::Reader<'_>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_target(self) -> crate::rpc_capnp::message_target::Builder<'a> { ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_target(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_interface_id(self) -> u64 { self.builder.get_data_field::(1) } #[inline] pub fn set_interface_id(&mut self, value: u64) { self.builder.set_data_field::(1, value); } #[inline] pub fn get_method_id(self) -> u16 { self.builder.get_data_field::(2) } #[inline] pub fn set_method_id(&mut self, value: u16) { self.builder.set_data_field::(2, value); } #[inline] pub fn get_params(self) -> ::capnp::Result> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(1), ::core::option::Option::None, ) } #[inline] pub fn set_params( &mut self, value: crate::rpc_capnp::payload::Reader<'_>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(1), value, false, ) } #[inline] pub fn init_params(self) -> crate::rpc_capnp::payload::Builder<'a> { ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) } #[inline] pub fn has_params(&self) -> bool { !self.builder.is_pointer_field_null(1) } #[inline] pub fn get_send_results_to(self) -> crate::rpc_capnp::call::send_results_to::Builder<'a> { self.builder.into() } #[inline] pub fn init_send_results_to( mut self, ) -> crate::rpc_capnp::call::send_results_to::Builder<'a> { self.builder.set_data_field::(3, 0); self.builder.reborrow().get_pointer_field(2).clear(); self.builder.into() } #[inline] pub fn get_allow_third_party_tail_call(self) -> bool { self.builder.get_bool_field(128) } #[inline] pub fn set_allow_third_party_tail_call(&mut self, value: bool) { self.builder.set_bool_field(128, value); } #[inline] pub fn get_no_promise_pipelining(self) -> bool { self.builder.get_bool_field(129) } #[inline] pub fn set_no_promise_pipelining(&mut self, value: bool) { self.builder.set_bool_field(129, value); } #[inline] pub fn get_only_promise_pipeline(self) -> bool { self.builder.get_bool_field(130) } #[inline] pub fn set_only_promise_pipeline(&mut self, value: bool) { self.builder.set_bool_field(130, value); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_target(&self) -> crate::rpc_capnp::message_target::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } pub fn get_params(&self) -> crate::rpc_capnp::payload::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) } pub fn get_send_results_to(&self) -> crate::rpc_capnp::call::send_results_to::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.noop()) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 154] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(212, 76, 157, 120, 206, 83, 106, 131), ::capnp::word(10, 0, 0, 0, 1, 0, 3, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(3, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 255, 1, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 67, 97, 108, 108, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(237, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(236, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(248, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(245, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(240, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(252, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(249, 0, 0, 0, 98, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(248, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(4, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(3, 0, 0, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 1, 0, 0, 74, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(12, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(7, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(9, 1, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(4, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(16, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(153, 95, 171, 26, 246, 176, 232, 218), ::capnp::word(13, 1, 0, 0, 114, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(4, 0, 0, 0, 128, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(249, 0, 0, 0, 194, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(252, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(8, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(5, 0, 0, 0, 129, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 9, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(5, 1, 0, 0, 162, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(20, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(6, 0, 0, 0, 130, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 10, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(17, 1, 0, 0, 162, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(20, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(32, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 97, 114, 103, 101, 116, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(193, 251, 19, 88, 84, 20, 188, 149), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(105, 110, 116, 101, 114, 102, 97, 99), ::capnp::word(101, 73, 100, 0, 0, 0, 0, 0), ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(109, 101, 116, 104, 111, 100, 73, 100), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 97, 114, 97, 109, 115, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(59, 116, 150, 61, 34, 97, 14, 154), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(115, 101, 110, 100, 82, 101, 115, 117), ::capnp::word(108, 116, 115, 84, 111, 0, 0, 0), ::capnp::word(97, 108, 108, 111, 119, 84, 104, 105), ::capnp::word(114, 100, 80, 97, 114, 116, 121, 84), ::capnp::word(97, 105, 108, 67, 97, 108, 108, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(110, 111, 80, 114, 111, 109, 105, 115), ::capnp::word(101, 80, 105, 112, 101, 108, 105, 110), ::capnp::word(105, 110, 103, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(111, 110, 108, 121, 80, 114, 111, 109), ::capnp::word(105, 115, 101, 80, 105, 112, 101, 108), ::capnp::word(105, 110, 101, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => ::introspect(), 3 => ::introspect(), 4 => ::introspect(), 5 => ::introspect(), 6 => ::introspect(), 7 => ::introspect(), 8 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[6, 2, 3, 7, 8, 4, 0, 5, 1]; pub const TYPE_ID: u64 = 0x836a_53ce_789d_4cd4; } pub mod send_results_to { pub use self::Which::{Caller, ThirdParty, Yourself}; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn has_third_party(&self) -> bool { if self.reader.get_data_field::(3) != 2 { return false; } !self.reader.get_pointer_field(2).is_null() } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(3) { 0 => ::core::result::Result::Ok(Caller(())), 1 => ::core::result::Result::Ok(Yourself(())), 2 => ::core::result::Result::Ok(ThirdParty(::capnp::any_pointer::Reader::new( self.reader.get_pointer_field(2), ))), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 3, pointers: 3, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32, ) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn set_caller(&mut self, _value: ()) { self.builder.set_data_field::(3, 0); } #[inline] pub fn set_yourself(&mut self, _value: ()) { self.builder.set_data_field::(3, 1); } #[inline] pub fn init_third_party(self) -> ::capnp::any_pointer::Builder<'a> { self.builder.set_data_field::(3, 2); let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(2)); result.clear(); result } #[inline] pub fn has_third_party(&self) -> bool { if self.builder.get_data_field::(3) != 2 { return false; } !self.builder.is_pointer_field_null(2) } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.builder.get_data_field::(3) { 0 => ::core::result::Result::Ok(Caller(())), 1 => ::core::result::Result::Ok(Yourself(())), 2 => ::core::result::Result::Ok(ThirdParty( ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(2)), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 64] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(153, 95, 171, 26, 246, 176, 232, 218), ::capnp::word(15, 0, 0, 0, 1, 0, 3, 0), ::capnp::word(212, 76, 157, 120, 206, 83, 106, 131), ::capnp::word(3, 0, 7, 0, 1, 0, 3, 0), ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 234, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 67, 97, 108, 108, 46, 115), ::capnp::word(101, 110, 100, 82, 101, 115, 117, 108), ::capnp::word(116, 115, 84, 111, 0, 0, 0, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(64, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(76, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 254, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(73, 0, 0, 0, 74, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(72, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 253, 255, 2, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(81, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(80, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(92, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(99, 97, 108, 108, 101, 114, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(121, 111, 117, 114, 115, 101, 108, 102), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 104, 105, 114, 100, 80, 97, 114), ::capnp::word(116, 121, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => <() as ::capnp::introspect::Introspect>::introspect(), 1 => <() as ::capnp::introspect::Introspect>::introspect(), 2 => { <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect( ) } _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 2, 1]; pub const TYPE_ID: u64 = 0xdae8_b0f6_1aab_5f99; } pub enum Which { Caller(()), Yourself(()), ThirdParty(A0), } pub type WhichReader<'a> = Which<::capnp::any_pointer::Reader<'a>>; pub type WhichBuilder<'a> = Which<::capnp::any_pointer::Builder<'a>>; } } pub mod return_ { pub use self::Which::{ AcceptFromThirdParty, Canceled, Exception, Results, ResultsSentElsewhere, TakeFromOtherQuestion, }; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_answer_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_release_param_caps(self) -> bool { self.reader.get_bool_field_mask(32, true) } #[inline] pub fn has_results(&self) -> bool { if self.reader.get_data_field::(3) != 0 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_exception(&self) -> bool { if self.reader.get_data_field::(3) != 1 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_accept_from_third_party(&self) -> bool { if self.reader.get_data_field::(3) != 5 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_no_finish_needed(self) -> bool { self.reader.get_bool_field(33) } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(3) { 0 => ::core::result::Result::Ok(Results( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 1 => ::core::result::Result::Ok(Exception( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 2 => ::core::result::Result::Ok(Canceled(())), 3 => ::core::result::Result::Ok(ResultsSentElsewhere(())), 4 => ::core::result::Result::Ok(TakeFromOtherQuestion( self.reader.get_data_field::(2), )), 5 => ::core::result::Result::Ok(AcceptFromThirdParty( ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(0)), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 2, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_answer_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_answer_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_release_param_caps(self) -> bool { self.builder.get_bool_field_mask(32, true) } #[inline] pub fn set_release_param_caps(&mut self, value: bool) { self.builder.set_bool_field_mask(32, value, true); } #[inline] pub fn set_results( &mut self, value: crate::rpc_capnp::payload::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(3, 0); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_results(self) -> crate::rpc_capnp::payload::Builder<'a> { self.builder.set_data_field::(3, 0); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_results(&self) -> bool { if self.builder.get_data_field::(3) != 0 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_exception( &mut self, value: crate::rpc_capnp::exception::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(3, 1); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_exception(self) -> crate::rpc_capnp::exception::Builder<'a> { self.builder.set_data_field::(3, 1); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_exception(&self) -> bool { if self.builder.get_data_field::(3) != 1 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_canceled(&mut self, _value: ()) { self.builder.set_data_field::(3, 2); } #[inline] pub fn set_results_sent_elsewhere(&mut self, _value: ()) { self.builder.set_data_field::(3, 3); } #[inline] pub fn set_take_from_other_question(&mut self, value: u32) { self.builder.set_data_field::(3, 4); self.builder.set_data_field::(2, value); } #[inline] pub fn init_accept_from_third_party(self) -> ::capnp::any_pointer::Builder<'a> { self.builder.set_data_field::(3, 5); let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_accept_from_third_party(&self) -> bool { if self.builder.get_data_field::(3) != 5 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_no_finish_needed(self) -> bool { self.builder.get_bool_field(33) } #[inline] pub fn set_no_finish_needed(&mut self, value: bool) { self.builder.set_bool_field(33, value); } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.builder.get_data_field::(3) { 0 => ::core::result::Result::Ok(Results( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 1 => ::core::result::Result::Ok(Exception( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 2 => ::core::result::Result::Ok(Canceled(())), 3 => ::core::result::Result::Ok(ResultsSentElsewhere(())), 4 => ::core::result::Result::Ok(TakeFromOtherQuestion( self.builder.get_data_field::(2), )), 5 => ::core::result::Result::Ok(AcceptFromThirdParty( ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 164] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(58, 87, 179, 61, 141, 178, 25, 158), ::capnp::word(10, 0, 0, 0, 1, 0, 2, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 6, 0), ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 138, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 255, 1, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 82, 101, 116, 117, 114, 110), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(237, 0, 0, 0, 74, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(236, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(248, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 32, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(245, 0, 0, 0, 138, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(248, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(4, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(3, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 1, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(252, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(8, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(4, 0, 254, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(5, 1, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(4, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(16, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(5, 0, 253, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(13, 1, 0, 0, 74, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(12, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(24, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(6, 0, 252, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 1, 0, 0, 170, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(24, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(36, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(7, 0, 251, 255, 2, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(33, 1, 0, 0, 178, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(36, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(48, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(8, 0, 250, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(45, 1, 0, 0, 170, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(48, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(60, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 33, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(57, 1, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(56, 1, 0, 0, 3, 0, 1, 0), ::capnp::word(68, 1, 0, 0, 2, 0, 1, 0), ::capnp::word(97, 110, 115, 119, 101, 114, 73, 100), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 108, 101, 97, 115, 101, 80), ::capnp::word(97, 114, 97, 109, 67, 97, 112, 115), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 115, 117, 108, 116, 115, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(59, 116, 150, 61, 34, 97, 14, 154), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(101, 120, 99, 101, 112, 116, 105, 111), ::capnp::word(110, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(26, 105, 207, 58, 6, 183, 37, 214), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 97, 110, 99, 101, 108, 101, 100), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 115, 117, 108, 116, 115, 83), ::capnp::word(101, 110, 116, 69, 108, 115, 101, 119), ::capnp::word(104, 101, 114, 101, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 97, 107, 101, 70, 114, 111, 109), ::capnp::word(79, 116, 104, 101, 114, 81, 117, 101), ::capnp::word(115, 116, 105, 111, 110, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(97, 99, 99, 101, 112, 116, 70, 114), ::capnp::word(111, 109, 84, 104, 105, 114, 100, 80), ::capnp::word(97, 114, 116, 121, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(110, 111, 70, 105, 110, 105, 115, 104), ::capnp::word(78, 101, 101, 100, 101, 100, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => ::introspect(), 3 => ::introspect(), 4 => <() as ::capnp::introspect::Introspect>::introspect(), 5 => <() as ::capnp::introspect::Introspect>::introspect(), 6 => ::introspect(), 7 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), 8 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 8]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[2, 3, 4, 5, 6, 7]; pub static MEMBERS_BY_NAME: &[u16] = &[7, 0, 4, 3, 8, 1, 2, 5, 6]; pub const TYPE_ID: u64 = 0x9e19_b28d_3db3_573a; } pub enum Which { Results(A0), Exception(A1), Canceled(()), ResultsSentElsewhere(()), TakeFromOtherQuestion(u32), AcceptFromThirdParty(A2), } pub type WhichReader<'a> = Which< ::capnp::Result>, ::capnp::Result>, ::capnp::any_pointer::Reader<'a>, >; pub type WhichBuilder<'a> = Which< ::capnp::Result>, ::capnp::Result>, ::capnp::any_pointer::Builder<'a>, >; } pub mod finish { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_release_result_caps(self) -> bool { self.reader.get_bool_field_mask(32, true) } #[inline] pub fn get_require_early_cancellation_workaround(self) -> bool { self.reader.get_bool_field_mask(33, true) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_release_result_caps(self) -> bool { self.builder.get_bool_field_mask(32, true) } #[inline] pub fn set_release_result_caps(&mut self, value: bool) { self.builder.set_bool_field_mask(32, value, true); } #[inline] pub fn get_require_early_cancellation_workaround(self) -> bool { self.builder.get_bool_field_mask(33, true) } #[inline] pub fn set_require_early_cancellation_workaround(&mut self, value: bool) { self.builder.set_bool_field_mask(33, value, true); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 69] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(99, 14, 248, 194, 178, 46, 125, 211), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 138, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 70, 105, 110, 105, 115, 104), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(68, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(80, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 32, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(77, 0, 0, 0, 146, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(80, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(92, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 33, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(89, 0, 0, 0, 26, 1, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(100, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(112, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 108, 101, 97, 115, 101, 82), ::capnp::word(101, 115, 117, 108, 116, 67, 97, 112), ::capnp::word(115, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 113, 117, 105, 114, 101, 69), ::capnp::word(97, 114, 108, 121, 67, 97, 110, 99), ::capnp::word(101, 108, 108, 97, 116, 105, 111, 110), ::capnp::word(87, 111, 114, 107, 97, 114, 111, 117), ::capnp::word(110, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 1, 2]; pub const TYPE_ID: u64 = 0xd37d_2eb2_c2f8_0e63; } } pub mod resolve { pub use self::Which::{Cap, Exception}; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_promise_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn has_cap(&self) -> bool { if self.reader.get_data_field::(2) != 0 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_exception(&self) -> bool { if self.reader.get_data_field::(2) != 1 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(2) { 0 => ::core::result::Result::Ok(Cap( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 1 => ::core::result::Result::Ok(Exception( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_promise_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_promise_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn set_cap( &mut self, value: crate::rpc_capnp::cap_descriptor::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(2, 0); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_cap(self) -> crate::rpc_capnp::cap_descriptor::Builder<'a> { self.builder.set_data_field::(2, 0); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_cap(&self) -> bool { if self.builder.get_data_field::(2) != 0 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_exception( &mut self, value: crate::rpc_capnp::exception::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(2, 1); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_exception(self) -> crate::rpc_capnp::exception::Builder<'a> { self.builder.set_data_field::(2, 1); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_exception(&self) -> bool { if self.builder.get_data_field::(2) != 1 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.builder.get_data_field::(2) { 0 => ::core::result::Result::Ok(Cap( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 1 => ::core::result::Result::Ok(Exception( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 64] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(110, 8, 137, 250, 85, 150, 194, 187), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 2, 0), ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 146, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 82, 101, 115, 111, 108, 118), ::capnp::word(101, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(68, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(80, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(77, 0, 0, 0, 34, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(72, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 254, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(81, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(80, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(92, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(112, 114, 111, 109, 105, 115, 101, 73), ::capnp::word(100, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 97, 112, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(176, 184, 134, 11, 196, 221, 35, 133), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(101, 120, 99, 101, 112, 116, 105, 111), ::capnp::word(110, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(26, 105, 207, 58, 6, 183, 37, 214), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[1, 2]; pub static MEMBERS_BY_NAME: &[u16] = &[1, 2, 0]; pub const TYPE_ID: u64 = 0xbbc2_9655_fa89_086e; } pub enum Which { Cap(A0), Exception(A1), } pub type WhichReader<'a> = Which< ::capnp::Result>, ::capnp::Result>, >; pub type WhichBuilder<'a> = Which< ::capnp::Result>, ::capnp::Result>, >; } pub mod release { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_reference_count(self) -> u32 { self.reader.get_data_field::(1) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_reference_count(self) -> u32 { self.builder.get_data_field::(1) } #[inline] pub fn set_reference_count(&mut self, value: u32) { self.builder.set_data_field::(1, value); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 48] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(151, 116, 208, 125, 13, 108, 26, 173), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 146, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 82, 101, 108, 101, 97, 115), ::capnp::word(101, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 26, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(45, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(105, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 102, 101, 114, 101, 110, 99), ::capnp::word(101, 67, 111, 117, 110, 116, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; pub const TYPE_ID: u64 = 0xad1a_6c0d_7dd0_7497; } } pub mod disembargo { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn has_target(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_context(self) -> crate::rpc_capnp::disembargo::context::Reader<'a> { self.reader.into() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn set_target( &mut self, value: crate::rpc_capnp::message_target::Reader<'_>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_target(self) -> crate::rpc_capnp::message_target::Builder<'a> { ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_target(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_context(self) -> crate::rpc_capnp::disembargo::context::Builder<'a> { self.builder.into() } #[inline] pub fn init_context(self) -> crate::rpc_capnp::disembargo::context::Builder<'a> { self.builder.set_data_field::(2, 0); self.builder.set_data_field::(0, 0u32); self.builder.into() } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_target(&self) -> crate::rpc_capnp::message_target::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } pub fn get_context(&self) -> crate::rpc_capnp::disembargo::context::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.noop()) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 40] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(17, 55, 189, 15, 139, 54, 100, 249), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 170, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 68, 105, 115, 101, 109, 98), ::capnp::word(97, 114, 103, 111, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(77, 221, 91, 101, 223, 180, 98, 213), ::capnp::word(45, 0, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 97, 114, 103, 101, 116, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(193, 251, 19, 88, 84, 20, 188, 149), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 111, 110, 116, 101, 120, 116, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[1, 0]; pub const TYPE_ID: u64 = 0xf964_368b_0fbd_3711; } pub mod context { pub use self::Which::{Accept, Provide, ReceiverLoopback, SenderLoopback}; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn which(self) -> ::core::result::Result { match self.reader.get_data_field::(2) { 0 => ::core::result::Result::Ok(SenderLoopback( self.reader.get_data_field::(0), )), 1 => ::core::result::Result::Ok(ReceiverLoopback( self.reader.get_data_field::(0), )), 2 => ::core::result::Result::Ok(Accept(())), 3 => ::core::result::Result::Ok(Provide(self.reader.get_data_field::(0))), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32, ) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn set_sender_loopback(&mut self, value: u32) { self.builder.set_data_field::(2, 0); self.builder.set_data_field::(0, value); } #[inline] pub fn set_receiver_loopback(&mut self, value: u32) { self.builder.set_data_field::(2, 1); self.builder.set_data_field::(0, value); } #[inline] pub fn set_accept(&mut self, _value: ()) { self.builder.set_data_field::(2, 2); } #[inline] pub fn set_provide(&mut self, value: u32) { self.builder.set_data_field::(2, 3); self.builder.set_data_field::(0, value); } #[inline] pub fn which(self) -> ::core::result::Result { match self.builder.get_data_field::(2) { 0 => ::core::result::Result::Ok(SenderLoopback( self.builder.get_data_field::(0), )), 1 => ::core::result::Result::Ok(ReceiverLoopback( self.builder.get_data_field::(0), )), 2 => ::core::result::Result::Ok(Accept(())), 3 => ::core::result::Result::Ok(Provide(self.builder.get_data_field::(0))), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 80] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(77, 221, 91, 101, 223, 180, 98, 213), ::capnp::word(21, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(17, 55, 189, 15, 139, 54, 100, 249), ::capnp::word(1, 0, 7, 0, 1, 0, 4, 0), ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 234, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 231, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 68, 105, 115, 101, 109, 98), ::capnp::word(97, 114, 103, 111, 46, 99, 111, 110), ::capnp::word(116, 101, 120, 116, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(97, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(96, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(108, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 254, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(105, 0, 0, 0, 138, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(108, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(120, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 253, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(117, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(124, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(3, 0, 252, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(121, 0, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(128, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(115, 101, 110, 100, 101, 114, 76, 111), ::capnp::word(111, 112, 98, 97, 99, 107, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 99, 101, 105, 118, 101, 114), ::capnp::word(76, 111, 111, 112, 98, 97, 99, 107), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(97, 99, 99, 101, 112, 116, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 114, 111, 118, 105, 100, 101, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => <() as ::capnp::introspect::Introspect>::introspect(), 3 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[0, 1, 2, 3]; pub static MEMBERS_BY_NAME: &[u16] = &[2, 3, 1, 0]; pub const TYPE_ID: u64 = 0xd562_b4df_655b_dd4d; } pub enum Which { SenderLoopback(u32), ReceiverLoopback(u32), Accept(()), Provide(u32), } pub type WhichReader = Which; pub type WhichBuilder = Which; } } pub mod provide { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn has_target(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_recipient(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(1)) } #[inline] pub fn has_recipient(&self) -> bool { !self.reader.get_pointer_field(1).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 2, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn set_target( &mut self, value: crate::rpc_capnp::message_target::Reader<'_>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_target(self) -> crate::rpc_capnp::message_target::Builder<'a> { ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_target(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_recipient(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(1)) } #[inline] pub fn init_recipient(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(1)); result.clear(); result } #[inline] pub fn has_recipient(&self) -> bool { !self.builder.is_pointer_field_null(1) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_target(&self) -> crate::rpc_capnp::message_target::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } pub fn get_recipient(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 64] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(90, 172, 193, 251, 107, 4, 106, 156), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 146, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 80, 114, 111, 118, 105, 100), ::capnp::word(101, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(68, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(80, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(77, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(72, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(81, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(80, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(92, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 97, 114, 103, 101, 116, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(193, 251, 19, 88, 84, 20, 188, 149), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 99, 105, 112, 105, 101, 110), ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 2, 1]; pub const TYPE_ID: u64 = 0x9c6a_046b_fbc1_ac5a; } } pub mod accept { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_provision(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(0)) } #[inline] pub fn has_provision(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_embargo(self) -> bool { self.reader.get_bool_field(32) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_provision(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)) } #[inline] pub fn init_provision(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_provision(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_embargo(self) -> bool { self.builder.get_bool_field(32) } #[inline] pub fn set_embargo(&mut self, value: bool) { self.builder.set_bool_field(32, value); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_provision(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 64] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(22, 64, 85, 144, 98, 181, 201, 212), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 138, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 65, 99, 99, 101, 112, 116), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(68, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(80, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(77, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(76, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(88, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 32, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(85, 0, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(80, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(92, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 114, 111, 118, 105, 115, 105, 111), ::capnp::word(110, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(101, 109, 98, 97, 114, 103, 111, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), 2 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[2, 1, 0]; pub const TYPE_ID: u64 = 0xd4c9_b562_9055_4016; } } pub mod join { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn has_target(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_key_part(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(1)) } #[inline] pub fn has_key_part(&self) -> bool { !self.reader.get_pointer_field(1).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 2, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_target(self) -> ::capnp::Result> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn set_target( &mut self, value: crate::rpc_capnp::message_target::Reader<'_>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_target(self) -> crate::rpc_capnp::message_target::Builder<'a> { ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_target(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_key_part(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(1)) } #[inline] pub fn init_key_part(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(1)); result.clear(); result } #[inline] pub fn has_key_part(&self) -> bool { !self.builder.is_pointer_field_null(1) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_target(&self) -> crate::rpc_capnp::message_target::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } pub fn get_key_part(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 62] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(175, 1, 224, 144, 4, 152, 225, 251), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 74, 111, 105, 110, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(68, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(80, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(77, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(72, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(81, 0, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(76, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(88, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 97, 114, 103, 101, 116, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(193, 251, 19, 88, 84, 20, 188, 149), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(107, 101, 121, 80, 97, 114, 116, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[2, 0, 1]; pub const TYPE_ID: u64 = 0xfbe1_9804_90e0_01af; } } pub mod message_target { pub use self::Which::{ImportedCap, PromisedAnswer}; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn has_promised_answer(&self) -> bool { if self.reader.get_data_field::(2) != 1 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(2) { 0 => ::core::result::Result::Ok(ImportedCap(self.reader.get_data_field::(0))), 1 => ::core::result::Result::Ok(PromisedAnswer( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn set_imported_cap(&mut self, value: u32) { self.builder.set_data_field::(2, 0); self.builder.set_data_field::(0, value); } #[inline] pub fn set_promised_answer( &mut self, value: crate::rpc_capnp::promised_answer::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(2, 1); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_promised_answer(self) -> crate::rpc_capnp::promised_answer::Builder<'a> { self.builder.set_data_field::(2, 1); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_promised_answer(&self) -> bool { if self.builder.get_data_field::(2) != 1 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.builder.get_data_field::(2) { 0 => ::core::result::Result::Ok(ImportedCap(self.builder.get_data_field::(0))), 1 => ::core::result::Result::Ok(PromisedAnswer( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 49] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(193, 251, 19, 88, 84, 20, 188, 149), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 2, 0), ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 194, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 77, 101, 115, 115, 97, 103), ::capnp::word(101, 84, 97, 114, 103, 101, 116, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 98, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 254, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(49, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(48, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(60, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(105, 109, 112, 111, 114, 116, 101, 100), ::capnp::word(67, 97, 112, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 114, 111, 109, 105, 115, 101, 100), ::capnp::word(65, 110, 115, 119, 101, 114, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(160, 28, 111, 205, 214, 177, 0, 216), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[0, 1]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; pub const TYPE_ID: u64 = 0x95bc_1454_5813_fbc1; } pub enum Which { ImportedCap(u32), PromisedAnswer(A0), } pub type WhichReader<'a> = Which<::capnp::Result>>; pub type WhichBuilder<'a> = Which<::capnp::Result>>; } pub mod payload { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_content(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(0)) } #[inline] pub fn has_content(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_cap_table( self, ) -> ::capnp::Result< ::capnp::struct_list::Reader<'a, crate::rpc_capnp::cap_descriptor::Owned>, > { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(1), ::core::option::Option::None, ) } #[inline] pub fn has_cap_table(&self) -> bool { !self.reader.get_pointer_field(1).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 2, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_content(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)) } #[inline] pub fn init_content(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_content(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_cap_table( self, ) -> ::capnp::Result< ::capnp::struct_list::Builder<'a, crate::rpc_capnp::cap_descriptor::Owned>, > { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(1), ::core::option::Option::None, ) } #[inline] pub fn set_cap_table( &mut self, value: ::capnp::struct_list::Reader<'_, crate::rpc_capnp::cap_descriptor::Owned>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(1), value, false, ) } #[inline] pub fn init_cap_table( self, size: u32, ) -> ::capnp::struct_list::Builder<'a, crate::rpc_capnp::cap_descriptor::Owned> { ::capnp::traits::FromPointerBuilder::init_pointer( self.builder.get_pointer_field(1), size, ) } #[inline] pub fn has_cap_table(&self) -> bool { !self.builder.is_pointer_field_null(1) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_content(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 52] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(59, 116, 150, 61, 34, 97, 14, 154), ::capnp::word(10, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 146, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 80, 97, 121, 108, 111, 97), ::capnp::word(100, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(45, 0, 0, 0, 74, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(72, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(99, 111, 110, 116, 101, 110, 116, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 97, 112, 84, 97, 98, 108, 101), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(176, 184, 134, 11, 196, 221, 35, 133), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), 1 => <::capnp::struct_list::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[1, 0]; pub const TYPE_ID: u64 = 0x9a0e_6122_3d96_743b; } } pub mod cap_descriptor { pub use self::Which::{ None, ReceiverAnswer, ReceiverHosted, SenderHosted, SenderPromise, ThirdPartyHosted, }; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn has_receiver_answer(&self) -> bool { if self.reader.get_data_field::(0) != 4 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn has_third_party_hosted(&self) -> bool { if self.reader.get_data_field::(0) != 5 { return false; } !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_attached_fd(self) -> u8 { self.reader.get_data_field_mask::(2, 255) } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(0) { 0 => ::core::result::Result::Ok(None(())), 1 => ::core::result::Result::Ok(SenderHosted(self.reader.get_data_field::(1))), 2 => { ::core::result::Result::Ok(SenderPromise(self.reader.get_data_field::(1))) } 3 => { ::core::result::Result::Ok(ReceiverHosted(self.reader.get_data_field::(1))) } 4 => ::core::result::Result::Ok(ReceiverAnswer( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), 5 => ::core::result::Result::Ok(ThirdPartyHosted( ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn set_none(&mut self, _value: ()) { self.builder.set_data_field::(0, 0); } #[inline] pub fn set_sender_hosted(&mut self, value: u32) { self.builder.set_data_field::(0, 1); self.builder.set_data_field::(1, value); } #[inline] pub fn set_sender_promise(&mut self, value: u32) { self.builder.set_data_field::(0, 2); self.builder.set_data_field::(1, value); } #[inline] pub fn set_receiver_hosted(&mut self, value: u32) { self.builder.set_data_field::(0, 3); self.builder.set_data_field::(1, value); } #[inline] pub fn set_receiver_answer( &mut self, value: crate::rpc_capnp::promised_answer::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 4); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_receiver_answer(self) -> crate::rpc_capnp::promised_answer::Builder<'a> { self.builder.set_data_field::(0, 4); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_receiver_answer(&self) -> bool { if self.builder.get_data_field::(0) != 4 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn set_third_party_hosted( &mut self, value: crate::rpc_capnp::third_party_cap_descriptor::Reader<'_>, ) -> ::capnp::Result<()> { self.builder.set_data_field::(0, 5); ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_third_party_hosted( self, ) -> crate::rpc_capnp::third_party_cap_descriptor::Builder<'a> { self.builder.set_data_field::(0, 5); ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) } #[inline] pub fn has_third_party_hosted(&self) -> bool { if self.builder.get_data_field::(0) != 5 { return false; } !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_attached_fd(self) -> u8 { self.builder.get_data_field_mask::(2, 255) } #[inline] pub fn set_attached_fd(&mut self, value: u8) { self.builder.set_data_field_mask::(2, value, 255); } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.builder.get_data_field::(0) { 0 => ::core::result::Result::Ok(None(())), 1 => { ::core::result::Result::Ok(SenderHosted(self.builder.get_data_field::(1))) } 2 => { ::core::result::Result::Ok(SenderPromise(self.builder.get_data_field::(1))) } 3 => ::core::result::Result::Ok(ReceiverHosted( self.builder.get_data_field::(1), )), 4 => ::core::result::Result::Ok(ReceiverAnswer( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), 5 => ::core::result::Result::Ok(ThirdPartyHosted( ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 129] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(176, 184, 134, 11, 196, 221, 35, 133), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 6, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 194, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 143, 1, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 67, 97, 112, 68, 101, 115), ::capnp::word(99, 114, 105, 112, 116, 111, 114, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(28, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(181, 0, 0, 0, 42, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(176, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(188, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 254, 255, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(185, 0, 0, 0, 106, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(184, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(196, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 253, 255, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(193, 0, 0, 0, 114, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(192, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(204, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(3, 0, 252, 255, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(201, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(200, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(212, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(4, 0, 251, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(209, 0, 0, 0, 122, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(208, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(220, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(5, 0, 250, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(217, 0, 0, 0, 138, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(220, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(232, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(6, 0, 0, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(229, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(228, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(240, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(110, 111, 110, 101, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(115, 101, 110, 100, 101, 114, 72, 111), ::capnp::word(115, 116, 101, 100, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(115, 101, 110, 100, 101, 114, 80, 114), ::capnp::word(111, 109, 105, 115, 101, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 99, 101, 105, 118, 101, 114), ::capnp::word(72, 111, 115, 116, 101, 100, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 101, 99, 101, 105, 118, 101, 114), ::capnp::word(65, 110, 115, 119, 101, 114, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(160, 28, 111, 205, 214, 177, 0, 216), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 104, 105, 114, 100, 80, 97, 114), ::capnp::word(116, 121, 72, 111, 115, 116, 101, 100), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(125, 2, 240, 225, 253, 7, 112, 211), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(97, 116, 116, 97, 99, 104, 101, 100), ::capnp::word(70, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(6, 0, 255, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => <() as ::capnp::introspect::Introspect>::introspect(), 1 => ::introspect(), 2 => ::introspect(), 3 => ::introspect(), 4 => ::introspect(), 5 => ::introspect(), 6 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[6]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[0, 1, 2, 3, 4, 5]; pub static MEMBERS_BY_NAME: &[u16] = &[6, 0, 4, 3, 1, 2, 5]; pub const TYPE_ID: u64 = 0x8523_ddc4_0b86_b8b0; } pub enum Which { None(()), SenderHosted(u32), SenderPromise(u32), ReceiverHosted(u32), ReceiverAnswer(A0), ThirdPartyHosted(A1), } pub type WhichReader<'a> = Which< ::capnp::Result>, ::capnp::Result>, >; pub type WhichBuilder<'a> = Which< ::capnp::Result>, ::capnp::Result>, >; } pub mod promised_answer { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_transform( self, ) -> ::capnp::Result< ::capnp::struct_list::Reader<'a, crate::rpc_capnp::promised_answer::op::Owned>, > { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn has_transform(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_question_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_question_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_transform( self, ) -> ::capnp::Result< ::capnp::struct_list::Builder<'a, crate::rpc_capnp::promised_answer::op::Owned>, > { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn set_transform( &mut self, value: ::capnp::struct_list::Reader<'_, crate::rpc_capnp::promised_answer::op::Owned>, ) -> ::capnp::Result<()> { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) } #[inline] pub fn init_transform( self, size: u32, ) -> ::capnp::struct_list::Builder<'a, crate::rpc_capnp::promised_answer::op::Owned> { ::capnp::traits::FromPointerBuilder::init_pointer( self.builder.get_pointer_field(0), size, ) } #[inline] pub fn has_transform(&self) -> bool { !self.builder.is_pointer_field_null(0) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 57] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(160, 28, 111, 205, 214, 177, 0, 216), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 202, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 23, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 80, 114, 111, 109, 105, 115), ::capnp::word(101, 100, 65, 110, 115, 119, 101, 114), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(129, 144, 86, 21, 68, 148, 22, 243), ::capnp::word(1, 0, 0, 0, 26, 0, 0, 0), ::capnp::word(79, 112, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(49, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(48, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(76, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(113, 117, 101, 115, 116, 105, 111, 110), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 114, 97, 110, 115, 102, 111, 114), ::capnp::word(109, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(129, 144, 86, 21, 68, 148, 22, 243), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => <::capnp::struct_list::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; pub const TYPE_ID: u64 = 0xd800_b1d6_cd6f_1ca0; } pub mod op { pub use self::Which::{GetPointerField, Noop}; #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn which(self) -> ::core::result::Result { match self.reader.get_data_field::(0) { 0 => ::core::result::Result::Ok(Noop(())), 1 => ::core::result::Result::Ok(GetPointerField( self.reader.get_data_field::(1), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new( ::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }, ), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32, ) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn set_noop(&mut self, _value: ()) { self.builder.set_data_field::(0, 0); } #[inline] pub fn set_get_pointer_field(&mut self, value: u16) { self.builder.set_data_field::(0, 1); self.builder.set_data_field::(1, value); } #[inline] pub fn which(self) -> ::core::result::Result { match self.builder.get_data_field::(0) { 0 => ::core::result::Result::Ok(Noop(())), 1 => ::core::result::Result::Ok(GetPointerField( self.builder.get_data_field::(1), )), x => ::core::result::Result::Err(::capnp::NotInSchema(x)), } } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 49] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(129, 144, 86, 21, 68, 148, 22, 243), ::capnp::word(25, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(160, 28, 111, 205, 214, 177, 0, 216), ::capnp::word(0, 0, 7, 0, 0, 0, 2, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 226, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 80, 114, 111, 109, 105, 115), ::capnp::word(101, 100, 65, 110, 115, 119, 101, 114), ::capnp::word(46, 79, 112, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 255, 255, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 42, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 254, 255, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(45, 0, 0, 0, 130, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(110, 111, 111, 112, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(103, 101, 116, 80, 111, 105, 110, 116), ::capnp::word(101, 114, 70, 105, 101, 108, 100, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => <() as ::capnp::introspect::Introspect>::introspect(), 1 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[0, 1]; pub static MEMBERS_BY_NAME: &[u16] = &[1, 0]; pub const TYPE_ID: u64 = 0xf316_9444_1556_9081; } pub enum Which { Noop(()), GetPointerField(u16), } pub type WhichReader = Which; pub type WhichBuilder = Which; } } pub mod third_party_cap_descriptor { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_id(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(0)) } #[inline] pub fn has_id(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_vine_id(self) -> u32 { self.reader.get_data_field::(0) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_id(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)) } #[inline] pub fn init_id(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_id(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_vine_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_vine_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_id(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 49] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(125, 2, 240, 225, 253, 7, 112, 211), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 18, 1, 0, 0), ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 119, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 84, 104, 105, 114, 100, 80), ::capnp::word(97, 114, 116, 121, 67, 97, 112, 68), ::capnp::word(101, 115, 99, 114, 105, 112, 116, 111), ::capnp::word(114, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 26, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(45, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(105, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(118, 105, 110, 101, 73, 100, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), 1 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; pub const TYPE_ID: u64 = 0xd370_07fd_e1f0_027d; } } pub mod exception { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_reason(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn has_reason(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } #[inline] pub fn get_obsolete_is_callers_fault(self) -> bool { self.reader.get_bool_field(0) } #[inline] pub fn get_obsolete_durability(self) -> u16 { self.reader.get_data_field::(1) } #[inline] pub fn get_type( self, ) -> ::core::result::Result { ::core::convert::TryInto::try_into(self.reader.get_data_field::(2)) } #[inline] pub fn get_trace(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { ::capnp::traits::FromPointerReader::get_from_pointer( &self.reader.get_pointer_field(1), ::core::option::Option::None, ) } #[inline] pub fn has_trace(&self) -> bool { !self.reader.get_pointer_field(1).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 2, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_reason(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(0), ::core::option::Option::None, ) } #[inline] pub fn set_reason( &mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>, ) { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(0), value, false, ) .unwrap() } #[inline] pub fn init_reason(self, size: u32) -> ::capnp::text::Builder<'a> { self.builder.get_pointer_field(0).init_text(size) } #[inline] pub fn has_reason(&self) -> bool { !self.builder.is_pointer_field_null(0) } #[inline] pub fn get_obsolete_is_callers_fault(self) -> bool { self.builder.get_bool_field(0) } #[inline] pub fn set_obsolete_is_callers_fault(&mut self, value: bool) { self.builder.set_bool_field(0, value); } #[inline] pub fn get_obsolete_durability(self) -> u16 { self.builder.get_data_field::(1) } #[inline] pub fn set_obsolete_durability(&mut self, value: u16) { self.builder.set_data_field::(1, value); } #[inline] pub fn get_type( self, ) -> ::core::result::Result { ::core::convert::TryInto::try_into(self.builder.get_data_field::(2)) } #[inline] pub fn set_type(&mut self, value: crate::rpc_capnp::exception::Type) { self.builder.set_data_field::(2, value as u16); } #[inline] pub fn get_trace(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { ::capnp::traits::FromPointerBuilder::get_from_pointer( self.builder.get_pointer_field(1), ::core::option::Option::None, ) } #[inline] pub fn set_trace( &mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>, ) { ::capnp::traits::SetterInput::set_pointer_builder( self.builder.reborrow().get_pointer_field(1), value, false, ) .unwrap() } #[inline] pub fn init_trace(self, size: u32) -> ::capnp::text::Builder<'a> { self.builder.get_pointer_field(1).init_text(size) } #[inline] pub fn has_trace(&self) -> bool { !self.builder.is_pointer_field_null(1) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 99] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(26, 105, 207, 58, 6, 183, 37, 214), ::capnp::word(10, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(80, 162, 82, 37, 27, 152, 18, 179), ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 162, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 23, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(37, 0, 0, 0, 31, 1, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 69, 120, 99, 101, 112, 116), ::capnp::word(105, 111, 110, 0, 0, 0, 0, 0), ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(88, 189, 76, 63, 226, 150, 140, 178), ::capnp::word(1, 0, 0, 0, 42, 0, 0, 0), ::capnp::word(84, 121, 112, 101, 0, 0, 0, 0), ::capnp::word(20, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(125, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(120, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(132, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(129, 0, 0, 0, 186, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(132, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(144, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(3, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(141, 0, 0, 0, 154, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(144, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(156, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(153, 0, 0, 0, 42, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(148, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(160, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(4, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(157, 0, 0, 0, 50, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(152, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(164, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(114, 101, 97, 115, 111, 110, 0, 0), ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(111, 98, 115, 111, 108, 101, 116, 101), ::capnp::word(73, 115, 67, 97, 108, 108, 101, 114), ::capnp::word(115, 70, 97, 117, 108, 116, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(111, 98, 115, 111, 108, 101, 116, 101), ::capnp::word(68, 117, 114, 97, 98, 105, 108, 105), ::capnp::word(116, 121, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(88, 189, 76, 63, 226, 150, 140, 178), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(116, 114, 97, 99, 101, 0, 0, 0), ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1 => ::introspect(), 2 => ::introspect(), 3 => ::introspect(), 4 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[2, 1, 0, 4, 3]; pub const TYPE_ID: u64 = 0xd625_b706_3acf_691a; } #[repr(u16)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Type { Failed = 0, Overloaded = 1, Disconnected = 2, Unimplemented = 3, } impl ::capnp::introspect::Introspect for Type { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { encoded_node: &type_::ENCODED_NODE, annotation_types: type_::get_annotation_types, }) .into() } } impl<'a> ::core::convert::From for ::capnp::dynamic_value::Reader<'a> { fn from(e: Type) -> Self { ::capnp::dynamic_value::Enum::new( e.into(), ::capnp::introspect::RawEnumSchema { encoded_node: &type_::ENCODED_NODE, annotation_types: type_::get_annotation_types, } .into(), ) .into() } } impl ::core::convert::TryFrom for Type { type Error = ::capnp::NotInSchema; fn try_from( value: u16, ) -> ::core::result::Result>::Error> { match value { 0 => ::core::result::Result::Ok(Self::Failed), 1 => ::core::result::Result::Ok(Self::Overloaded), 2 => ::core::result::Result::Ok(Self::Disconnected), 3 => ::core::result::Result::Ok(Self::Unimplemented), n => ::core::result::Result::Err(::capnp::NotInSchema(n)), } } } impl From for u16 { #[inline] fn from(x: Type) -> u16 { x as u16 } } impl ::capnp::traits::HasTypeId for Type { const TYPE_ID: u64 = 0xb28c_96e2_3f4c_bd58u64; } mod type_ { pub static ENCODED_NODE: [::capnp::Word; 37] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(88, 189, 76, 63, 226, 150, 140, 178), ::capnp::word(20, 0, 0, 0, 2, 0, 0, 0), ::capnp::word(26, 105, 207, 58, 6, 183, 37, 214), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 202, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 103, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 46, 99, 97, 112, 110), ::capnp::word(112, 58, 69, 120, 99, 101, 112, 116), ::capnp::word(105, 111, 110, 46, 84, 121, 112, 101), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(16, 0, 0, 0, 1, 0, 2, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(41, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 90, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 106, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 114, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(102, 97, 105, 108, 101, 100, 0, 0), ::capnp::word(111, 118, 101, 114, 108, 111, 97, 100), ::capnp::word(101, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(100, 105, 115, 99, 111, 110, 110, 101), ::capnp::word(99, 116, 101, 100, 0, 0, 0, 0), ::capnp::word(117, 110, 105, 109, 112, 108, 101, 109), ::capnp::word(101, 110, 116, 101, 100, 0, 0, 0), ]; pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } } } capnp-rpc-0.19.0/src/rpc_twoparty_capnp.rs000064400000000000000000002054611046102023000166610ustar 00000000000000// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. // DO NOT EDIT. // source: rpc-twoparty.capnp #[repr(u16)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Side { Server = 0, Client = 1, } impl ::capnp::introspect::Introspect for Side { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { encoded_node: &side::ENCODED_NODE, annotation_types: side::get_annotation_types, }) .into() } } impl<'a> ::core::convert::From for ::capnp::dynamic_value::Reader<'a> { fn from(e: Side) -> Self { ::capnp::dynamic_value::Enum::new( e.into(), ::capnp::introspect::RawEnumSchema { encoded_node: &side::ENCODED_NODE, annotation_types: side::get_annotation_types, } .into(), ) .into() } } impl ::core::convert::TryFrom for Side { type Error = ::capnp::NotInSchema; fn try_from( value: u16, ) -> ::core::result::Result>::Error> { match value { 0 => ::core::result::Result::Ok(Self::Server), 1 => ::core::result::Result::Ok(Self::Client), n => ::core::result::Result::Err(::capnp::NotInSchema(n)), } } } impl From for u16 { #[inline] fn from(x: Side) -> u16 { x as u16 } } impl ::capnp::traits::HasTypeId for Side { const TYPE_ID: u64 = 0x9fd6_9ebc_87b9_719cu64; } mod side { pub static ENCODED_NODE: [::capnp::Word; 25] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(156, 113, 185, 135, 188, 158, 214, 159), ::capnp::word(19, 0, 0, 0, 2, 0, 0, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 194, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(25, 0, 0, 0, 55, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 83, 105, 100, 101, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(8, 0, 0, 0, 1, 0, 2, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(17, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(9, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(115, 101, 114, 118, 101, 114, 0, 0), ::capnp::word(99, 108, 105, 101, 110, 116, 0, 0), ]; pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } } pub mod vat_id { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_side( self, ) -> ::core::result::Result { ::core::convert::TryInto::try_into(self.reader.get_data_field::(0)) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_side( self, ) -> ::core::result::Result { ::core::convert::TryInto::try_into(self.builder.get_data_field::(0)) } #[inline] pub fn set_side(&mut self, value: crate::rpc_twoparty_capnp::Side) { self.builder.set_data_field::(0, value as u16); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 33] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(142, 58, 115, 238, 159, 144, 11, 210), ::capnp::word(19, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 202, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 63, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 86, 97, 116, 73, 100), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(13, 0, 0, 0, 42, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(20, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(115, 105, 100, 101, 0, 0, 0, 0), ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(156, 113, 185, 135, 188, 158, 214, 159), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => { ::introspect( ) } _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0]; pub const TYPE_ID: u64 = 0xd20b_909f_ee73_3a8e; } } pub mod provision_id { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_join_id(self) -> u32 { self.reader.get_data_field::(0) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_join_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_join_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 33] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(23, 152, 243, 197, 169, 9, 141, 184), ::capnp::word(19, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 250, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 63, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 80, 114, 111, 118, 105), ::capnp::word(115, 105, 111, 110, 73, 100, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(13, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(20, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(106, 111, 105, 110, 73, 100, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0]; pub const TYPE_ID: u64 = 0xb88d_09a9_c5f3_9817; } } pub mod recipient_id { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 17] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(193, 130, 64, 253, 182, 137, 243, 137), ::capnp::word(19, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 250, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 82, 101, 99, 105, 112), ::capnp::word(105, 101, 110, 116, 73, 100, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { panic!("invalid field index {}", index) } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[]; pub const TYPE_ID: u64 = 0x89f3_89b6_fd40_82c1; } } pub mod third_party_cap_id { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 18] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(157, 181, 44, 103, 121, 73, 127, 180), ::capnp::word(19, 0, 0, 0, 1, 0, 0, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 26, 1, 0, 0), ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 84, 104, 105, 114, 100), ::capnp::word(80, 97, 114, 116, 121, 67, 97, 112), ::capnp::word(73, 100, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { panic!("invalid field index {}", index) } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[]; pub const TYPE_ID: u64 = 0xb47f_4979_672c_b59d; } } pub mod join_key_part { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_join_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_part_count(self) -> u16 { self.reader.get_data_field::(2) } #[inline] pub fn get_part_num(self) -> u16 { self.reader.get_data_field::(3) } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 0, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_join_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_join_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_part_count(self) -> u16 { self.builder.get_data_field::(2) } #[inline] pub fn set_part_count(&mut self, value: u16) { self.builder.set_data_field::(2, value); } #[inline] pub fn get_part_num(self) -> u16 { self.builder.get_data_field::(3) } #[inline] pub fn set_part_num(&mut self, value: u16) { self.builder.set_data_field::(3, value); } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline {} mod _private { pub static ENCODED_NODE: [::capnp::Word; 64] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(131, 202, 127, 9, 89, 144, 178, 149), ::capnp::word(19, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 250, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 74, 111, 105, 110, 75), ::capnp::word(101, 121, 80, 97, 114, 116, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(64, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(76, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(73, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(72, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 3, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(81, 0, 0, 0, 66, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(76, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(88, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(106, 111, 105, 110, 73, 100, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 97, 114, 116, 67, 111, 117, 110), ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(112, 97, 114, 116, 78, 117, 109, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => ::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[0, 1, 2]; pub const TYPE_ID: u64 = 0x95b2_9059_097f_ca83; } } pub mod join_result { #[derive(Copy, Clone)] pub struct Owned(()); impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }) .into() } } impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a>, } impl<'a> ::core::marker::Copy for Reader<'a> {} impl<'a> ::core::clone::Clone for Reader<'a> { fn clone(&self) -> Self { *self } } impl<'a> ::capnp::traits::HasTypeId for Reader<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { Self { reader } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { fn from(reader: Reader<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Reader::new( reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::core::fmt::Debug for Reader<'a> { fn fmt( &self, f: &mut ::core::fmt::Formatter<'_>, ) -> ::core::result::Result<(), ::core::fmt::Error> { core::fmt::Debug::fmt( &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f, ) } } impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { fn get_from_pointer( reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { self.reader } } impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { self.reader .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) } } impl<'a> Reader<'a> { pub fn reborrow(&self) -> Reader<'_> { Self { ..*self } } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.reader.total_size() } #[inline] pub fn get_join_id(self) -> u32 { self.reader.get_data_field::(0) } #[inline] pub fn get_succeeded(self) -> bool { self.reader.get_bool_field(32) } #[inline] pub fn get_cap(self) -> ::capnp::any_pointer::Reader<'a> { ::capnp::any_pointer::Reader::new(self.reader.get_pointer_field(0)) } #[inline] pub fn has_cap(&self) -> bool { !self.reader.get_pointer_field(0).is_null() } } pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a>, } impl<'a> ::capnp::traits::HasStructSize for Builder<'a> { const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 1, }; } impl<'a> ::capnp::traits::HasTypeId for Builder<'a> { const TYPE_ID: u64 = _private::TYPE_ID; } impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { Self { builder } } } impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { fn from(builder: Builder<'a>) -> Self { Self::Struct(::capnp::dynamic_struct::Builder::new( builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types, }), )) } } impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { self.builder .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) } } impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { builder .init_struct(::STRUCT_SIZE) .into() } fn get_from_pointer( builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>, ) -> ::capnp::Result { ::core::result::Result::Ok( builder .get_struct( ::STRUCT_SIZE, default, )? .into(), ) } } impl<'a> ::capnp::traits::SetterInput for Reader<'a> { fn set_pointer_builder( mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool, ) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } } impl<'a> Builder<'a> { pub fn into_reader(self) -> Reader<'a> { self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_> { Builder { builder: self.builder.reborrow(), } } pub fn reborrow_as_reader(&self) -> Reader<'_> { self.builder.as_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { self.builder.as_reader().total_size() } #[inline] pub fn get_join_id(self) -> u32 { self.builder.get_data_field::(0) } #[inline] pub fn set_join_id(&mut self, value: u32) { self.builder.set_data_field::(0, value); } #[inline] pub fn get_succeeded(self) -> bool { self.builder.get_bool_field(32) } #[inline] pub fn set_succeeded(&mut self, value: bool) { self.builder.set_bool_field(32, value); } #[inline] pub fn get_cap(self) -> ::capnp::any_pointer::Builder<'a> { ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)) } #[inline] pub fn init_cap(self) -> ::capnp::any_pointer::Builder<'a> { let mut result = ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)); result.clear(); result } #[inline] pub fn has_cap(&self) -> bool { !self.builder.is_pointer_field_null(0) } } pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline, } impl ::capnp::capability::FromTypelessPipeline for Pipeline { fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { Self { _typeless: typeless, } } } impl Pipeline { pub fn get_cap(&self) -> ::capnp::any_pointer::Pipeline { ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) } } mod _private { pub static ENCODED_NODE: [::capnp::Word; 64] = [ ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), ::capnp::word(238, 235, 183, 48, 54, 58, 38, 157), ::capnp::word(19, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(161, 242, 218, 92, 136, 199, 132, 161), ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(21, 0, 0, 0, 242, 0, 0, 0), ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(29, 0, 0, 0, 175, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(114, 112, 99, 45, 116, 119, 111, 112), ::capnp::word(97, 114, 116, 121, 46, 99, 97, 112), ::capnp::word(110, 112, 58, 74, 111, 105, 110, 82), ::capnp::word(101, 115, 117, 108, 116, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(69, 0, 0, 0, 58, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(64, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(76, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(1, 0, 0, 0, 32, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(73, 0, 0, 0, 82, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(72, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(81, 0, 0, 0, 34, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(76, 0, 0, 0, 3, 0, 1, 0), ::capnp::word(88, 0, 0, 0, 2, 0, 1, 0), ::capnp::word(106, 111, 105, 110, 73, 100, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(115, 117, 99, 99, 101, 101, 100, 101), ::capnp::word(100, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(99, 97, 112, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 3, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ]; pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { match index { 0 => ::introspect(), 1 => ::introspect(), 2 => <::capnp::any_pointer::Owned as ::capnp::introspect::Introspect>::introspect(), _ => panic!("invalid field index {}", index), } } pub fn get_annotation_types( child_index: Option, index: u32, ) -> ::capnp::introspect::Type { panic!("invalid annotation indices ({:?}, {}) ", child_index, index) } pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { encoded_node: &ENCODED_NODE, nonunion_members: NONUNION_MEMBERS, members_by_discriminant: MEMBERS_BY_DISCRIMINANT, members_by_name: MEMBERS_BY_NAME, }; pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; pub static MEMBERS_BY_NAME: &[u16] = &[2, 0, 1]; pub const TYPE_ID: u64 = 0x9d26_3a36_30b7_ebee; } } capnp-rpc-0.19.0/src/sender_queue.rs000064400000000000000000000104201046102023000154140ustar 00000000000000// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use futures::channel::oneshot; use futures::{FutureExt, TryFutureExt}; use std::cell::RefCell; use std::rc::{Rc, Weak}; use capnp::capability::Promise; use capnp::Error; use std::collections::BTreeMap; struct Inner where In: 'static, Out: 'static, { next_id: u64, map: BTreeMap)>, } /// A queue representing tasks that consume input of type `In` and produce output of /// type `Out`. pub struct SenderQueue where In: 'static, Out: 'static, { inner: Rc>>, } pub struct Remover where In: 'static, Out: 'static, { id: u64, inner: Weak>>, } impl Drop for Remover where In: 'static, Out: 'static, { fn drop(&mut self) { if let Some(inner) = self.inner.upgrade() { let Inner { ref mut map, .. } = *inner.borrow_mut(); map.remove(&self.id); } } } impl SenderQueue where In: 'static, Out: 'static, { pub fn new() -> Self { Self { inner: Rc::new(RefCell::new(Inner { next_id: 0, map: BTreeMap::new(), })), } } /// Pushes `value` to the queue, returning a promise that resolves after /// `value` is consumed on the other end of the queue. If the returned promised /// is dropped, then `value` is removed from the queue. pub fn push(&mut self, value: In) -> Promise { let weak_inner = Rc::downgrade(&self.inner); let Inner { ref mut next_id, ref mut map, .. } = *self.inner.borrow_mut(); let (tx, rx) = oneshot::channel(); map.insert(*next_id, (value, tx)); let remover = Remover { id: *next_id, inner: weak_inner, }; *next_id += 1; Promise::from_future( rx.map_err(|_| Error::failed("SenderQueue canceled".into())) .map(move |out| { drop(remover); out }), ) } /// Pushes `values` to the queue. pub fn push_detach(&mut self, value: In) { let Inner { ref mut next_id, ref mut map, .. } = *self.inner.borrow_mut(); let (tx, _rx) = oneshot::channel(); map.insert(*next_id, (value, tx)); *next_id += 1; } pub fn drain(&mut self) -> Drain { let Inner { ref mut next_id, ref mut map, .. } = *self.inner.borrow_mut(); *next_id = 0; let map = ::std::mem::take(map); Drain { iter: map.into_iter(), } } } pub struct Drain where In: 'static, Out: 'static, { iter: ::std::collections::btree_map::IntoIter)>, } impl ::std::iter::Iterator for Drain where In: 'static, Out: 'static, { type Item = (In, oneshot::Sender); fn next(&mut self) -> Option { self.iter.next().map(|(_k, v)| v) } } capnp-rpc-0.19.0/src/split.rs000064400000000000000000000034251046102023000140720ustar 00000000000000// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use futures::{Future, FutureExt}; use std::cell::RefCell; use std::rc::Rc; pub fn split( f: F, ) -> ( impl Future>, impl Future>, ) where F: Future>, E: Clone, { let shared = f .map(|r| { let (v1, v2) = r?; Ok(Rc::new(RefCell::new((Some(v1), Some(v2))))) }) .shared(); ( shared .clone() .map(|r| Ok::(r?.borrow_mut().0.take().unwrap())), shared.map(|r| Ok::(r?.borrow_mut().1.take().unwrap())), ) } capnp-rpc-0.19.0/src/task_set.rs000064400000000000000000000135601046102023000145550ustar 00000000000000// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. use futures::channel::mpsc; use futures::stream::FuturesUnordered; use futures::{Future, FutureExt, Stream}; use std::pin::Pin; use std::task::{Context, Poll}; use std::cell::RefCell; use std::rc::Rc; enum EnqueuedTask { Task(Pin>>>), Terminate(Result<(), E>), } enum TaskInProgress { Task(Pin>>), Terminate(Option>), } impl Unpin for TaskInProgress {} enum TaskDone { Continue, Terminate(Result<(), E>), } impl Future for TaskInProgress { type Output = TaskDone; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { match *self { Self::Terminate(ref mut r) => Poll::Ready(TaskDone::Terminate(r.take().unwrap())), Self::Task(ref mut f) => match f.as_mut().poll(cx) { Poll::Pending => Poll::Pending, Poll::Ready(()) => Poll::Ready(TaskDone::Continue), }, } } } #[must_use = "a TaskSet does nothing unless polled"] pub struct TaskSet { enqueued: Option>>, in_progress: FuturesUnordered>, reaper: Rc>>>, } impl TaskSet where E: 'static, { pub fn new(reaper: Box>) -> (TaskSetHandle, Self) where E: 'static, E: ::std::fmt::Debug, { let (sender, receiver) = mpsc::unbounded(); let set = Self { enqueued: Some(receiver), in_progress: FuturesUnordered::new(), reaper: Rc::new(RefCell::new(reaper)), }; // If the FuturesUnordered ever gets empty, its stream will terminate, which // is not what we want. So we make sure there is always at least one future in it. set.in_progress .push(TaskInProgress::Task(Box::pin(::futures::future::pending()))); let handle = TaskSetHandle { sender }; (handle, set) } } #[derive(Clone)] pub struct TaskSetHandle { sender: mpsc::UnboundedSender>, } impl TaskSetHandle where E: 'static, { pub fn add(&mut self, f: F) where F: Future> + 'static, { let _ = self.sender.unbounded_send(EnqueuedTask::Task(Box::pin(f))); } pub fn terminate(&mut self, result: Result<(), E>) { let _ = self.sender.unbounded_send(EnqueuedTask::Terminate(result)); } } pub trait TaskReaper where E: 'static, { fn task_succeeded(&mut self) {} fn task_failed(&mut self, error: E); } impl Future for TaskSet where E: 'static, { type Output = Result<(), E>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { let mut enqueued_stream_complete = false; if let Self { enqueued: Some(ref mut enqueued), ref mut in_progress, ref reaper, .. } = self.as_mut().get_mut() { loop { match Pin::new(&mut *enqueued).poll_next(cx) { Poll::Pending => break, Poll::Ready(None) => { enqueued_stream_complete = true; break; } Poll::Ready(Some(EnqueuedTask::Terminate(r))) => { in_progress.push(TaskInProgress::Terminate(Some(r))); } Poll::Ready(Some(EnqueuedTask::Task(f))) => { let reaper = Rc::downgrade(reaper); in_progress.push(TaskInProgress::Task(Box::pin(f.map(move |r| { match reaper.upgrade() { None => (), // TaskSet must have been dropped. Some(rc_reaper) => match r { Ok(()) => rc_reaper.borrow_mut().task_succeeded(), Err(e) => rc_reaper.borrow_mut().task_failed(e), }, } })))); } } } } if enqueued_stream_complete { drop(self.enqueued.take()); } loop { match Stream::poll_next(Pin::new(&mut self.in_progress), cx) { Poll::Pending => return Poll::Pending, Poll::Ready(v) => match v { None => return Poll::Ready(Ok(())), Some(TaskDone::Continue) => (), Some(TaskDone::Terminate(Ok(()))) => return Poll::Ready(Ok(())), Some(TaskDone::Terminate(Err(e))) => return Poll::Ready(Err(e)), }, } } } } capnp-rpc-0.19.0/src/twoparty.rs000064400000000000000000000232331046102023000146270ustar 00000000000000// Copyright (c) 2015 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. //! An implementation of `VatNetwork` for the common case of a client-server connection. use capnp::capability::Promise; use capnp::message::ReaderOptions; use futures::channel::oneshot; use futures::{AsyncRead, AsyncWrite, FutureExt, TryFutureExt}; use std::cell::RefCell; use std::rc::{Rc, Weak}; pub type VatId = crate::rpc_twoparty_capnp::Side; struct IncomingMessage { message: ::capnp::message::Reader, } impl IncomingMessage { pub fn new(message: ::capnp::message::Reader) -> Self { Self { message } } } impl crate::IncomingMessage for IncomingMessage { fn get_body(&self) -> ::capnp::Result<::capnp::any_pointer::Reader> { self.message.get_root() } } struct OutgoingMessage { message: ::capnp::message::Builder<::capnp::message::HeapAllocator>, sender: ::capnp_futures::Sender>>, } impl crate::OutgoingMessage for OutgoingMessage { fn get_body(&mut self) -> ::capnp::Result<::capnp::any_pointer::Builder> { self.message.get_root() } fn get_body_as_reader(&self) -> ::capnp::Result<::capnp::any_pointer::Reader> { self.message.get_root_as_reader() } fn send( self: Box, ) -> ( Promise>, ::capnp::Error>, Rc<::capnp::message::Builder<::capnp::message::HeapAllocator>>, ) { let tmp = *self; let Self { message, mut sender, } = tmp; let m = Rc::new(message); (Promise::from_future(sender.send(m.clone())), m) } fn take(self: Box) -> ::capnp::message::Builder<::capnp::message::HeapAllocator> { self.message } } struct ConnectionInner where T: AsyncRead + 'static, { input_stream: Rc>>, sender: ::capnp_futures::Sender>>, side: crate::rpc_twoparty_capnp::Side, receive_options: ReaderOptions, on_disconnect_fulfiller: Option>, } struct Connection where T: AsyncRead + 'static, { inner: Rc>>, } impl Drop for ConnectionInner where T: AsyncRead, { fn drop(&mut self) { match self.on_disconnect_fulfiller.take() { Some(fulfiller) => { let _ = fulfiller.send(()); } None => unreachable!(), } } } impl Connection where T: AsyncRead, { fn new( input_stream: T, sender: ::capnp_futures::Sender< Rc<::capnp::message::Builder<::capnp::message::HeapAllocator>>, >, side: crate::rpc_twoparty_capnp::Side, receive_options: ReaderOptions, on_disconnect_fulfiller: oneshot::Sender<()>, ) -> Self { Self { inner: Rc::new(RefCell::new(ConnectionInner { input_stream: Rc::new(RefCell::new(Some(input_stream))), sender, side, receive_options, on_disconnect_fulfiller: Some(on_disconnect_fulfiller), })), } } } impl crate::Connection for Connection where T: AsyncRead + Unpin, { fn get_peer_vat_id(&self) -> crate::rpc_twoparty_capnp::Side { self.inner.borrow().side } fn new_outgoing_message( &mut self, _first_segment_word_size: u32, ) -> Box { Box::new(OutgoingMessage { message: ::capnp::message::Builder::new_default(), sender: self.inner.borrow().sender.clone(), }) } fn receive_incoming_message( &mut self, ) -> Promise>, ::capnp::Error> { let inner = self.inner.borrow_mut(); let maybe_input_stream = inner.input_stream.borrow_mut().take(); let return_it_here = inner.input_stream.clone(); match maybe_input_stream { Some(mut s) => { let receive_options = inner.receive_options; Promise::from_future(async move { let maybe_message = ::capnp_futures::serialize::try_read_message(&mut s, receive_options) .await?; *return_it_here.borrow_mut() = Some(s); Ok(maybe_message.map(|message| { Box::new(IncomingMessage::new(message)) as Box })) }) } None => { Promise::err(::capnp::Error::failed( "this should not be possible".to_string(), )) // unreachable!(), } } } fn shutdown(&mut self, result: ::capnp::Result<()>) -> Promise<(), ::capnp::Error> { Promise::from_future(self.inner.borrow_mut().sender.terminate(result)) } } /// A vat network with two parties, the client and the server. pub struct VatNetwork where T: AsyncRead + 'static + Unpin, { // connection handle that we will return on accept() connection: Option>, // connection handle that we will return on connect() weak_connection_inner: Weak>>, execution_driver: futures::future::Shared>, side: crate::rpc_twoparty_capnp::Side, } impl VatNetwork where T: AsyncRead + Unpin, { /// Creates a new two-party vat network that will receive data on `input_stream` and send data on /// `output_stream`. /// /// `side` indicates whether this is the client or the server side of the connection. This has no /// effect on the data sent over the connection; it merely exists so that `RpcNetwork::bootstrap` knows /// whether to return the local or the remote bootstrap capability. `VatId` parameters like this one /// will make more sense once we have vat networks with more than two parties. /// /// The options in `receive_options` will be used when reading the messages that come in on `input_stream`. pub fn new( input_stream: T, output_stream: U, side: crate::rpc_twoparty_capnp::Side, receive_options: ReaderOptions, ) -> Self where U: AsyncWrite + 'static + Unpin, { let (fulfiller, disconnect_promise) = oneshot::channel(); let disconnect_promise = disconnect_promise.map_err(|_| ::capnp::Error::disconnected("disconnected".into())); let (execution_driver, sender) = { let (tx, write_queue) = ::capnp_futures::write_queue(output_stream); // Don't use `.join()` here because we need to make sure to wait for `disconnect_promise` to // resolve even if `write_queue` resolves to an error. ( Promise::from_future(write_queue.then(move |r| { disconnect_promise .then(move |_| futures::future::ready(r)) .map_ok(|_| ()) })) .shared(), tx, ) }; let connection = Connection::new(input_stream, sender, side, receive_options, fulfiller); let weak_inner = Rc::downgrade(&connection.inner); Self { connection: Some(connection), weak_connection_inner: weak_inner, execution_driver, side, } } } impl crate::VatNetwork for VatNetwork where T: AsyncRead + Unpin, { fn connect(&mut self, host_id: VatId) -> Option>> { if host_id == self.side { None } else { match self.weak_connection_inner.upgrade() { Some(connection_inner) => Some(Box::new(Connection { inner: connection_inner, })), None => { panic!("tried to reconnect a disconnected twoparty vat network.") } } } } fn accept(&mut self) -> Promise>, ::capnp::Error> { match self.connection.take() { Some(c) => Promise::ok(Box::new(c) as Box>), None => Promise::from_future(::futures::future::pending()), } } fn drive_until_shutdown(&mut self) -> Promise<(), ::capnp::Error> { Promise::from_future(self.execution_driver.clone()) } }