From d591daa884158cc3d24cc6dcdbe7c42ea3fda396 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 13 May 2022 18:24:47 +0200 Subject: [PATCH 01/51] Start on improving a few version thingies --- bffhd/env.rs | 8 ++++++++ bffhd/lib.rs | 5 ++--- build.rs | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 bffhd/env.rs diff --git a/bffhd/env.rs b/bffhd/env.rs new file mode 100644 index 0000000..5411026 --- /dev/null +++ b/bffhd/env.rs @@ -0,0 +1,8 @@ +//! Information extracted from the (build) environment +//! + +/// The BFFH version, as an UTF-8 string +/// +/// This is of the format ".." if build as a normal release +/// or " ..-" if built from source +pub const VERSION: &'static str = env!("BFFHD_VERSION_STRING"); diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 359a181..45a8466 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -31,6 +31,8 @@ pub mod capnp; pub mod utils; +pub mod env; + mod audit; mod keylog; mod logging; @@ -60,9 +62,6 @@ use crate::users::Users; use executor::pool::Executor; use signal_hook::consts::signal::*; -pub const VERSION_STRING: &'static str = env!("BFFHD_VERSION_STRING"); -pub const RELEASE_STRING: &'static str = env!("BFFHD_RELEASE_STRING"); - pub struct Diflouroborane { config: Config, executor: Executor<'static>, diff --git a/build.rs b/build.rs index 122be31..8fbf65c 100644 --- a/build.rs +++ b/build.rs @@ -32,7 +32,7 @@ fn main() { String::from_utf8(out.stdout).expect("git rev-list output was not valid UTF8"); let gitrev = owned_gitrev.trim(); let abbrev = match gitrev.len() { - 0 => "unknown", + 0 => "badsource", _ => &gitrev[0..9], }; From c435f76d084d4d5d24d98ea9a07415e9869f7f31 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sat, 14 May 2022 15:36:32 +0200 Subject: [PATCH 02/51] --version talks about API version too --- bffhd/capnp/connection.rs | 2 +- bffhd/lib.rs | 2 +- bin/bffhd/main.rs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bffhd/capnp/connection.rs b/bffhd/capnp/connection.rs index d950e50..f8517e9 100644 --- a/bffhd/capnp/connection.rs +++ b/bffhd/capnp/connection.rs @@ -51,7 +51,7 @@ impl bootstrap::Server for BootCap { let _guard = span.enter(); let mut builder = result.get(); builder.set_name("bffhd"); - builder.set_release(crate::RELEASE_STRING); + builder.set_release(crate::env::VERSION); Promise::ok(()) } diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 45a8466..c7d457d 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -76,7 +76,7 @@ pub static RESOURCES: OnceCell = OnceCell::new(); impl Diflouroborane { pub fn new(config: Config) -> anyhow::Result { logging::init(&config.logging); - tracing::info!(version = VERSION_STRING, "Starting BFFH"); + tracing::info!(version = env::VERSION, "Starting BFFH"); let span = tracing::info_span!("setup"); let _guard = span.enter(); diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index a6a2f87..846e160 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -11,7 +11,11 @@ fn main() -> anyhow::Result<()> { // values for the name, description and version are pulled from `Cargo.toml`. let matches = Command::new(clap::crate_name!()) .version(clap::crate_version!()) - .long_version(diflouroborane::VERSION_STRING) + .long_version(&*format!("Diflouroborane {version} + \t Implementing API {apiver}", + version=diflouroborane::env::VERSION, + apiver="0.3") + ) .about(clap::crate_description!()) .arg( Arg::new("config") From 25df5bf5b2c7a005769872655bf72e3469ca7e93 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 18 May 2022 17:01:03 +0200 Subject: [PATCH 03/51] Switch to shadow-rs Closes #58 --- Cargo.lock | 94 +++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 5 +++ bffhd/env.rs | 8 ---- bffhd/lib.rs | 3 +- bin/bffhd/main.rs | 42 ++++++++++----------- build.rs | 60 +----------------------------- 6 files changed, 122 insertions(+), 90 deletions(-) delete mode 100644 bffhd/env.rs diff --git a/Cargo.lock b/Cargo.lock index 6955d63..87b54fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -477,6 +477,9 @@ name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -543,6 +546,26 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "const_format" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0936ffe6d0c8d6a51b3b0a73b2acbe925d786f346cf45bfddc8341d79fb7dc8a" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -820,6 +843,7 @@ dependencies = [ "serde", "serde_dhall", "serde_json", + "shadow-rs", "signal-hook", "signal-hook-async-std", "tempfile", @@ -1171,6 +1195,19 @@ dependencies = [ "syn", ] +[[package]] +name = "git2" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "glob" version = "0.3.0" @@ -1291,6 +1328,12 @@ dependencies = [ "syn", ] +[[package]] +name = "is_debug" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d198e9919d9822d5f7083ba8530e04de87841eaf21ead9af8f2304efd57c89" + [[package]] name = "itertools" version = "0.9.0" @@ -1321,6 +1364,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.56" @@ -1364,6 +1416,30 @@ version = "0.2.120" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09" +[[package]] +name = "libgit2-sys" +version = "0.13.4+1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libz-sys" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "lightproc" version = "0.3.0" @@ -2283,6 +2359,18 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "shadow-rs" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f47e98e36909e951f4da3908f4475f969bec92a41734dd92e883aaa11c10294b" +dependencies = [ + "chrono", + "const_format", + "git2", + "is_debug", +] + [[package]] name = "sharded-slab" version = "0.1.4" @@ -2750,6 +2838,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 49d7236..d50d460 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -103,6 +103,8 @@ async-compat = "0.2.1" url = "2.2.2" rustls-native-certs = "0.6.1" +shadow-rs = "0.11" + [dependencies.rsasl] git = "https://github.com/dequbed/rsasl.git" rev = "0b5012d0" @@ -113,5 +115,8 @@ features = ["unstable_custom_mechanism", "provider", "registry_static", "plain"] futures-test = "0.3.16" tempfile = "3.2" +[build-dependencies] +shadow-rs = "0.11" + [workspace] members = ["modules/*", "api"] diff --git a/bffhd/env.rs b/bffhd/env.rs deleted file mode 100644 index 5411026..0000000 --- a/bffhd/env.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Information extracted from the (build) environment -//! - -/// The BFFH version, as an UTF-8 string -/// -/// This is of the format ".." if build as a normal release -/// or " ..-" if built from source -pub const VERSION: &'static str = env!("BFFHD_VERSION_STRING"); diff --git a/bffhd/lib.rs b/bffhd/lib.rs index c7d457d..8aeecc8 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -31,7 +31,8 @@ pub mod capnp; pub mod utils; -pub mod env; +// Store build information in the `env` module. +shadow_rs::shadow!(env); mod audit; mod keylog; diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 846e160..4507d90 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -11,32 +11,33 @@ fn main() -> anyhow::Result<()> { // values for the name, description and version are pulled from `Cargo.toml`. let matches = Command::new(clap::crate_name!()) .version(clap::crate_version!()) - .long_version(&*format!("Diflouroborane {version} - \t Implementing API {apiver}", - version=diflouroborane::env::VERSION, - apiver="0.3") - ) + .long_version(&*format!("{version}\n\ + FabAccess {apiver}\n\ + \t[{build_kind} build built on {build_time}]\n\ + \t {rustc_version}\n\t {cargo_version}", + version=diflouroborane::env::PKG_VERSION, + apiver="0.3", + rustc_version=diflouroborane::env::RUST_VERSION, + cargo_version=diflouroborane::env::CARGO_VERSION, + build_time=diflouroborane::env::BUILD_TIME_3339, + build_kind=diflouroborane::env::BUILD_RUST_CHANNEL)) .about(clap::crate_description!()) - .arg( - Arg::new("config") + .arg(Arg::new("config") .help("Path to the config file to use") .long("config") .short('c') - .takes_value(true), - ) + .takes_value(true)) .arg(Arg::new("verbosity") .help("Increase logging verbosity") .long("verbose") .short('v') .multiple_occurrences(true) .max_occurrences(3) - .conflicts_with("quiet") - ) + .conflicts_with("quiet")) .arg(Arg::new("quiet") .help("Decrease logging verbosity") .long("quiet") - .conflicts_with("verbosity") - ) + .conflicts_with("verbosity")) .arg(Arg::new("log format") .help("Use an alternative log formatter. Available: Full, Compact, Pretty") .long("log-format") @@ -50,26 +51,22 @@ fn main() -> anyhow::Result<()> { .arg( Arg::new("print default") .help("Print a default config to stdout instead of running") - .long("print-default"), - ) + .long("print-default")) .arg( Arg::new("check config") .help("Check config for validity") - .long("check"), - ) + .long("check")) .arg( Arg::new("dump") .help("Dump all internal databases") .long("dump") - .conflicts_with("load"), - ) + .conflicts_with("load")) .arg( Arg::new("load") .help("Load values into the internal databases") .long("load") .takes_value(true) - .conflicts_with("dump"), - ) + .conflicts_with("dump")) .arg(Arg::new("keylog") .help("log TLS keys into PATH. If no path is specified the value of the envvar SSLKEYLOGFILE is used.") .long("tls-key-log") @@ -77,8 +74,7 @@ fn main() -> anyhow::Result<()> { .takes_value(true) .max_values(1) .min_values(0) - .default_missing_value("") - ) + .default_missing_value("")) .get_matches(); let configpath = matches diff --git a/build.rs b/build.rs index 8fbf65c..37f84e1 100644 --- a/build.rs +++ b/build.rs @@ -1,60 +1,4 @@ -use std::process::Command; - fn main() { - println!(">>> Building version number..."); - - let rustc = std::env::var("RUSTC").unwrap(); - let out = Command::new(rustc) - .arg("--version") - .output() - .expect("failed to run `rustc --version`"); - let rustc_version = - String::from_utf8(out.stdout).expect("rustc --version returned invalid UTF-8"); - let rustc_version = rustc_version.trim(); - println!("cargo:rustc-env=CARGO_RUSTC_VERSION={}", rustc_version); - - println!("cargo:rerun-if-env-changed=BFFHD_BUILD_TAGGED_RELEASE"); - let tagged_release = option_env!("BFFHD_BUILD_TAGGED_RELEASE") == Some("1"); - let version_string = if tagged_release { - format!( - "{version} [{rustc}]", - version = env!("CARGO_PKG_VERSION"), - rustc = rustc_version - ) - } else { - // Build version number using the current git commit id - let out = Command::new("git") - .arg("rev-list") - .args(["HEAD", "-1"]) - .output() - .expect("failed to run `git rev-list HEAD -1`"); - let owned_gitrev = - String::from_utf8(out.stdout).expect("git rev-list output was not valid UTF8"); - let gitrev = owned_gitrev.trim(); - let abbrev = match gitrev.len() { - 0 => "badsource", - _ => &gitrev[0..9], - }; - - let out = Command::new("git") - .arg("log") - .args(["-1", "--format=%as"]) - .output() - .expect("failed to run `git log -1 --format=\"format:%as\"`"); - let commit_date = String::from_utf8(out.stdout).expect("git log output was not valid UTF8"); - let commit_date = commit_date.trim(); - - format!( - "{version} ({gitrev} {date}) [{rustc}]", - version = env!("CARGO_PKG_VERSION"), - gitrev = abbrev, - date = commit_date, - rustc = rustc_version - ) - }; - println!("cargo:rustc-env=BFFHD_VERSION_STRING={}", version_string); - println!( - "cargo:rustc-env=BFFHD_RELEASE_STRING=\"BFFH {}\"", - version_string - ); + // Extract build-time information using the `shadow-rs` crate + shadow_rs::new(); } From f905b1f375e91a93886363a9f97501943ae3b097 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 18 May 2022 17:11:00 +0200 Subject: [PATCH 04/51] Slightly more logging during authentication --- bffhd/capnp/authenticationsystem.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bffhd/capnp/authenticationsystem.rs b/bffhd/capnp/authenticationsystem.rs index bab6b65..563ab1b 100644 --- a/bffhd/capnp/authenticationsystem.rs +++ b/bffhd/capnp/authenticationsystem.rs @@ -65,12 +65,16 @@ impl AuthenticationSystem for Authentication { Ok(Step::Done(data)) => { self.state = State::Finished; - let uid = pry!(session.get_property::().ok_or(capnp::Error::failed( - "Authentication didn't provide an authid as required".to_string() - ))); - let session = pry!(manager.open(uid.as_ref()).ok_or(capnp::Error::failed( - "Failed to lookup the given user".to_string() - ))); + let uid = pry!(session.get_property::().ok_or_else(|| { + tracing::warn!("Authentication didn't provide an authid as required."); + capnp::Error::failed( + "Authentication didn't provide an authid as required".to_string(), + ) + })); + let session = pry!(manager.open(uid.as_ref()).ok_or_else(|| { + tracing::warn!(uid = uid.as_str(), "Failed to lookup the given user"); + capnp::Error::failed("Failed to lookup the given user".to_string()) + })); let mut builder = builder.init_successful(); if data.is_some() { From aa71c6bf4abf11aae8093db0315050708ea0c438 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 18:27:07 +0200 Subject: [PATCH 05/51] Include source error message when failing --load Fixes #59 --- bin/bffhd/main.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 4507d90..6c4dd02 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -122,17 +122,14 @@ fn main() -> anyhow::Result<()> { unimplemented!() } else if matches.is_present("load") { let bffh = Diflouroborane::new(config)?; - if bffh - .users - .load_file(matches.value_of("load").unwrap()) - .is_ok() - { - tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); - } else { + if let Err(error) = bffh.users.load_file(matches.value_of("load").unwrap()) { tracing::error!( - "failed to load users from {}", - matches.value_of("load").unwrap() + "failed to load users from {}: {}", + matches.value_of("load").unwrap(), + error, ); + } else { + tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); } return Ok(()); } else { From 689c2b5353dc5c21730102a70fc9b1a5c310b636 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 18:27:54 +0200 Subject: [PATCH 06/51] Add a duplicate user example table --- test/duplicate-users.toml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/duplicate-users.toml diff --git a/test/duplicate-users.toml b/test/duplicate-users.toml new file mode 100644 index 0000000..d08c92d --- /dev/null +++ b/test/duplicate-users.toml @@ -0,0 +1,8 @@ +[UniqueUser] +roles = ["foorole", "barrole"] + +[DuplicateUser] +roles = ["somerole"] + +[DuplicateUser] +roles = ["different", "roles"] From 7784313a95e4bbf113fd7d9b963417794aa314f4 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 18:35:13 +0200 Subject: [PATCH 07/51] Update API submodule --- api/schema | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/schema b/api/schema index 244eb9b..19f20f5 160000 --- a/api/schema +++ b/api/schema @@ -1 +1 @@ -Subproject commit 244eb9bd1b59cfcf36c067ff0d6208c0992766ba +Subproject commit 19f20f5154f0eced6288ff56cac840025ee51da1 From 523c091284e20f00c8a79ef8cbcd8e06866eb979 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 19:25:30 +0200 Subject: [PATCH 08/51] Drop pregenerated modules --- api/src/schema.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/api/src/schema.rs b/api/src/schema.rs index d573cec..1cd0a5c 100644 --- a/api/src/schema.rs +++ b/api/src/schema.rs @@ -1,71 +1,41 @@ pub use capnpc::schema_capnp; -#[cfg(feature = "generated")] pub mod authenticationsystem_capnp { include!(concat!(env!("OUT_DIR"), "/authenticationsystem_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod authenticationsystem_capnp; -#[cfg(feature = "generated")] pub mod connection_capnp { include!(concat!(env!("OUT_DIR"), "/connection_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod connection_capnp; -#[cfg(feature = "generated")] pub mod general_capnp { include!(concat!(env!("OUT_DIR"), "/general_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod general_capnp; -#[cfg(feature = "generated")] pub mod machine_capnp { include!(concat!(env!("OUT_DIR"), "/machine_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod machine_capnp; -#[cfg(feature = "generated")] pub mod machinesystem_capnp { include!(concat!(env!("OUT_DIR"), "/machinesystem_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod machinesystem_capnp; -#[cfg(feature = "generated")] pub mod permissionsystem_capnp { include!(concat!(env!("OUT_DIR"), "/permissionsystem_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod permissionsystem_capnp; -#[cfg(feature = "generated")] pub mod role_capnp { include!(concat!(env!("OUT_DIR"), "/role_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod role_capnp; -#[cfg(feature = "generated")] pub mod space_capnp { include!(concat!(env!("OUT_DIR"), "/space_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod space_capnp; -#[cfg(feature = "generated")] pub mod user_capnp { include!(concat!(env!("OUT_DIR"), "/user_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod user_capnp; -#[cfg(feature = "generated")] pub mod usersystem_capnp { include!(concat!(env!("OUT_DIR"), "/usersystem_capnp.rs")); } -#[cfg(not(feature = "generated"))] -pub mod usersystem_capnp; From 78bd75ae0507eddec91991f91b993a4bfed4345e Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 19:26:01 +0200 Subject: [PATCH 09/51] Drop git tracked pregenerated code --- api/src/schema/.gitkeep | 0 api/src/schema/authenticationsystem_capnp.rs | 996 --- api/src/schema/connection_capnp.rs | 1351 --- api/src/schema/general_capnp.rs | 699 -- api/src/schema/machine_capnp.rs | 7382 ----------------- api/src/schema/machinesystem_capnp.rs | 756 -- api/src/schema/permissionsystem_capnp.rs | 572 -- .../programming_language/csharp_capnp.rs | 29 - .../schema/programming_language/rust_capnp.rs | 4 - api/src/schema/role_capnp.rs | 139 - api/src/schema/space_capnp.rs | 186 - api/src/schema/user_capnp.rs | 3862 --------- api/src/schema/usersystem_capnp.rs | 1672 ---- 13 files changed, 17648 deletions(-) delete mode 100644 api/src/schema/.gitkeep delete mode 100644 api/src/schema/authenticationsystem_capnp.rs delete mode 100644 api/src/schema/connection_capnp.rs delete mode 100644 api/src/schema/general_capnp.rs delete mode 100644 api/src/schema/machine_capnp.rs delete mode 100644 api/src/schema/machinesystem_capnp.rs delete mode 100644 api/src/schema/permissionsystem_capnp.rs delete mode 100644 api/src/schema/programming_language/csharp_capnp.rs delete mode 100644 api/src/schema/programming_language/rust_capnp.rs delete mode 100644 api/src/schema/role_capnp.rs delete mode 100644 api/src/schema/space_capnp.rs delete mode 100644 api/src/schema/user_capnp.rs delete mode 100644 api/src/schema/usersystem_capnp.rs diff --git a/api/src/schema/.gitkeep b/api/src/schema/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/api/src/schema/authenticationsystem_capnp.rs b/api/src/schema/authenticationsystem_capnp.rs deleted file mode 100644 index 5af6eb9..0000000 --- a/api/src/schema/authenticationsystem_capnp.rs +++ /dev/null @@ -1,996 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: authenticationsystem.capnp - - -pub mod response { - pub use self::Which::{Failed,Challenge,Successful}; - - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - pub fn has_challenge(&self) -> bool { - if self.reader.get_data_field::(1) != 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::(1) { - 0 => { - ::core::result::Result::Ok(Failed( - ::capnp::traits::FromStructReader::new(self.reader) - )) - } - 1 => { - ::core::result::Result::Ok(Challenge( - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - )) - } - 2 => { - ::core::result::Result::Ok(Successful( - ::capnp::traits::FromStructReader::new(self.reader) - )) - } - 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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn init_failed(self, ) -> crate::schema::authenticationsystem_capnp::response::failed::Builder<'a> { - self.builder.set_data_field::(1, 0); - self.builder.set_data_field::(0, 0u16); - self.builder.get_pointer_field(0).clear(); - ::capnp::traits::FromStructBuilder::new(self.builder) - } - #[inline] - pub fn set_challenge(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.set_data_field::(1, 1); - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_challenge(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.set_data_field::(1, 1); - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_challenge(&self) -> bool { - if self.builder.get_data_field::(1) != 1 { return false; } - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn init_successful(self, ) -> crate::schema::authenticationsystem_capnp::response::successful::Builder<'a> { - self.builder.set_data_field::(1, 2); - self.builder.get_pointer_field(0).clear(); - self.builder.get_pointer_field(1).clear(); - ::capnp::traits::FromStructBuilder::new(self.builder) - } - #[inline] - pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { - match self.builder.get_data_field::(1) { - 0 => { - ::core::result::Result::Ok(Failed( - ::capnp::traits::FromStructBuilder::new(self.builder) - )) - } - 1 => { - ::core::result::Result::Ok(Challenge( - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - )) - } - 2 => { - ::core::result::Result::Ok(Successful( - ::capnp::traits::FromStructBuilder::new(self.builder) - )) - } - 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) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 2 }; - pub const TYPE_ID: u64 = 0xe76b_4158_bdde_4934; - } - pub enum Which { - Failed(A0), - Challenge(A1), - Successful(A2), - } - pub type WhichReader<'a,> = Which,::capnp::Result<::capnp::data::Reader<'a>>,crate::schema::authenticationsystem_capnp::response::successful::Reader<'a>>; - pub type WhichBuilder<'a,> = Which,::capnp::Result<::capnp::data::Builder<'a>>,crate::schema::authenticationsystem_capnp::response::successful::Builder<'a>>; - - #[repr(u16)] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum Error { - Aborted = 0, - BadMechanism = 1, - InvalidCredentials = 2, - Failed = 3, - } - impl ::capnp::traits::FromU16 for Error { - #[inline] - fn from_u16(value: u16) -> ::core::result::Result { - match value { - 0 => ::core::result::Result::Ok(Error::Aborted), - 1 => ::core::result::Result::Ok(Error::BadMechanism), - 2 => ::core::result::Result::Ok(Error::InvalidCredentials), - 3 => ::core::result::Result::Ok(Error::Failed), - n => ::core::result::Result::Err(::capnp::NotInSchema(n)), - } - } - } - impl ::capnp::traits::ToU16 for Error { - #[inline] - fn to_u16(self) -> u16 { self as u16 } - } - impl ::capnp::traits::HasTypeId for Error { - #[inline] - fn type_id() -> u64 { 0xe87e_ae86_8b88_cfc1u64 } - } - - pub mod failed { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_code(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.reader.get_data_field::(0)) - } - #[inline] - pub fn get_additional_data(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_additional_data(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_code(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.builder.get_data_field::(0)) - } - #[inline] - pub fn set_code(&mut self, value: crate::schema::authenticationsystem_capnp::response::Error) { - self.builder.set_data_field::(0, value as u16) - } - #[inline] - pub fn get_additional_data(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_additional_data(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_additional_data(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_additional_data(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 2 }; - pub const TYPE_ID: u64 = 0xd726_d467_66b2_fd0c; - } - } - - pub mod successful { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_session(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_session(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_additional_data(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_additional_data(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_session(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_session(&mut self, value: crate::schema::connection_capnp::session::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_session(self, ) -> crate::schema::connection_capnp::session::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_session(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_additional_data(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn set_additional_data(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(1).set_data(value); - } - #[inline] - pub fn init_additional_data(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(1).init_data(size) - } - pub fn has_additional_data(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_session(&self) -> crate::schema::connection_capnp::session::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 2 }; - pub const TYPE_ID: u64 = 0xbf3b_c966_6eea_ffa0; - } - } -} - - -pub mod authentication { - #![allow(unused_variables)] - pub type StepParams<> = ::capnp::capability::Params; - pub type StepResults<> = ::capnp::capability::Results; - pub type AbortParams<> = ::capnp::capability::Params; - pub type AbortResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn step_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn abort_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - } - pub trait Server<> { - fn step(&mut self, _: StepParams<>, _: StepResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn abort(&mut self, _: AbortParams<>, _: AbortResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.step(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.abort(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xe657_e27e_b5ff_b1ad; - } - - pub mod step_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_data(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_data(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_data(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_data(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_data(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_data(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xcb98_01a0_63fb_684e; - } - } - - pub mod abort_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9dbb_e5bb_dcce_a62c; - } - } - - pub mod abort_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xce2f_5a64_8658_0299; - } - } -} diff --git a/api/src/schema/connection_capnp.rs b/api/src/schema/connection_capnp.rs deleted file mode 100644 index a66946d..0000000 --- a/api/src/schema/connection_capnp.rs +++ /dev/null @@ -1,1351 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: connection.capnp - -pub const API_VERSION_MAJOR: i32 = 0; -pub const API_VERSION_MINOR: i32 = 3; -pub const API_VERSION_PATCH: i32 = 0; - -pub mod version { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_major(self) -> i32 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_minor(self) -> i32 { - self.reader.get_data_field::(1) - } - #[inline] - pub fn get_patch(self) -> i32 { - self.reader.get_data_field::(2) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_major(self) -> i32 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_major(&mut self, value: i32) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_minor(self) -> i32 { - self.builder.get_data_field::(1) - } - #[inline] - pub fn set_minor(&mut self, value: i32) { - self.builder.set_data_field::(1, value); - } - #[inline] - pub fn get_patch(self) -> i32 { - self.builder.get_data_field::(2) - } - #[inline] - pub fn set_patch(&mut self, value: i32) { - self.builder.set_data_field::(2, value); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 2, pointers: 0 }; - pub const TYPE_ID: u64 = 0xaf7d_ddb9_6f98_68de; - } -} - - -pub mod bootstrap { - #![allow(unused_variables)] - pub type GetAPIVersionParams<> = ::capnp::capability::Params; - pub type GetAPIVersionResults<> = ::capnp::capability::Results; - pub type GetServerReleaseParams<> = ::capnp::capability::Params; - pub type GetServerReleaseResults<> = ::capnp::capability::Results; - pub type MechanismsParams<> = ::capnp::capability::Params; - pub type MechanismsResults<> = ::capnp::capability::Results; - pub type CreateSessionParams<> = ::capnp::capability::Params; - pub type CreateSessionResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_a_p_i_version_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn get_server_release_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn mechanisms_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - pub fn create_session_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 3, None) - } - } - pub trait Server<> { - fn get_a_p_i_version(&mut self, _: GetAPIVersionParams<>, _: GetAPIVersionResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_server_release(&mut self, _: GetServerReleaseParams<>, _: GetServerReleaseResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn mechanisms(&mut self, _: MechanismsParams<>, _: MechanismsResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn create_session(&mut self, _: CreateSessionParams<>, _: CreateSessionResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_a_p_i_version(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.get_server_release(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.mechanisms(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 3 => server.create_session(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xeac8_d340_bf0b_c1fe; - } - - pub mod get_a_p_i_version_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x83fb_333a_86c0_0444; - } - } - - pub mod get_server_release_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf90f_318c_27b5_1024; - } - } - - pub mod get_server_release_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_name(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_release(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_release(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_name(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_name(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_name(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_name(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_release(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_release(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_release(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_release(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xd8de_c362_5eec_4ac9; - } - } - - pub mod mechanisms_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xc459_5a71_42a3_f678; - } - } - - pub mod mechanisms_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_mechs(self) -> ::capnp::Result<::capnp::text_list::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_mechs(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_mechs(self) -> ::capnp::Result<::capnp::text_list::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_mechs(&mut self, value: ::capnp::text_list::Reader<'a>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_mechs(self, size: u32) -> ::capnp::text_list::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_mechs(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x9ff8_ec16_d36a_543e; - } - } - - pub mod create_session_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_mechanism(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_mechanism(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_mechanism(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_mechanism(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_mechanism(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_mechanism(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x8df4_36ee_00bc_a623; - } - } - - pub mod create_session_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_authentication(self) -> ::capnp::Result { - match self.reader.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_authentication(self) -> ::capnp::Result { - match self.builder.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_authentication(&mut self, value: crate::schema::authenticationsystem_capnp::authentication::Client) { - self.builder.get_pointer_field(0).set_capability(value.client.hook); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_authentication(&self) -> crate::schema::authenticationsystem_capnp::authentication::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(0).as_cap()) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xc14e_a8ad_0ea9_17b6; - } - } -} - -pub mod session { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_machine_system(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_machine_system(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_user_system(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_user_system(&self) -> bool { - !self.reader.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_permission_system(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) - } - pub fn has_permission_system(&self) -> bool { - !self.reader.get_pointer_field(2).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_machine_system(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_machine_system(&mut self, value: crate::schema::machinesystem_capnp::machine_system::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_machine_system(self, ) -> crate::schema::machinesystem_capnp::machine_system::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_machine_system(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_user_system(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn set_user_system(&mut self, value: crate::schema::usersystem_capnp::user_system::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(1), value, false) - } - #[inline] - pub fn init_user_system(self, ) -> crate::schema::usersystem_capnp::user_system::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) - } - pub fn has_user_system(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_permission_system(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) - } - #[inline] - pub fn set_permission_system(&mut self, value: crate::schema::permissionsystem_capnp::permission_system::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(2), value, false) - } - #[inline] - pub fn init_permission_system(self, ) -> crate::schema::permissionsystem_capnp::permission_system::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(2), 0) - } - pub fn has_permission_system(&self) -> bool { - !self.builder.get_pointer_field(2).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_machine_system(&self) -> crate::schema::machinesystem_capnp::machine_system::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - pub fn get_user_system(&self) -> crate::schema::usersystem_capnp::user_system::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) - } - pub fn get_permission_system(&self) -> crate::schema::permissionsystem_capnp::permission_system::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(2)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 3 }; - pub const TYPE_ID: u64 = 0x9347_ab18_2906_b9ca; - } -} diff --git a/api/src/schema/general_capnp.rs b/api/src/schema/general_capnp.rs deleted file mode 100644 index 5f91076..0000000 --- a/api/src/schema/general_capnp.rs +++ /dev/null @@ -1,699 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: general.capnp - - -pub mod u_u_i_d { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_uuid0(self) -> u64 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_uuid1(self) -> u64 { - self.reader.get_data_field::(1) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_uuid0(self) -> u64 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_uuid0(&mut self, value: u64) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_uuid1(self) -> u64 { - self.builder.get_data_field::(1) - } - #[inline] - pub fn set_uuid1(&mut self, value: u64) { - 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) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 2, pointers: 0 }; - pub const TYPE_ID: u64 = 0xb01b_03d4_f827_7597; - } -} - -pub mod key_value_pair { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_key(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_key(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_value(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_value(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_key(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_key(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_key(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_key(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_value(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_value(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_value(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_value(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xfb54_3b21_ce63_7bf1; - } -} - -pub mod optional { /* T */ - pub use self::Which::{Nothing,Just}; - - #[derive(Copy, Clone)] - pub struct Owned { - _phantom: ::core::marker::PhantomData - } - impl <'a, T> ::capnp::traits::Owned<'a> for Owned where T: for<'c> ::capnp::traits::Owned<'c> { type Reader = Reader<'a, T>; type Builder = Builder<'a, T>; } - impl <'a, T> ::capnp::traits::OwnedStruct<'a> for Owned where T: for<'c> ::capnp::traits::Owned<'c> { type Reader = Reader<'a, T>; type Builder = Builder<'a, T>; } - impl ::capnp::traits::Pipelined for Owned where T: for<'c> ::capnp::traits::Owned<'c> { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - reader: ::capnp::private::layout::StructReader<'a>, - _phantom: ::core::marker::PhantomData - } - - impl <'a,T> ::capnp::traits::HasTypeId for Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,T> ::capnp::traits::FromStructReader<'a> for Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,T> { - Reader { reader, _phantom: ::core::marker::PhantomData, } - } - } - - impl <'a,T> ::capnp::traits::FromPointerReader<'a> for Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - impl <'a,T> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,T> ::capnp::traits::Imbue<'a> for Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,T> Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - pub fn reborrow(&self) -> Reader<'_,T> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - pub fn has_just(&self) -> bool { - if self.reader.get_data_field::(0) != 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::(0) { - 0 => { - ::core::result::Result::Ok(Nothing( - () - )) - } - 1 => { - ::core::result::Result::Ok(Just( - ::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,T> where T: for<'c> ::capnp::traits::Owned<'c> { - builder: ::capnp::private::layout::StructBuilder<'a>, - _phantom: ::core::marker::PhantomData - } - impl <'a,T> ::capnp::traits::HasStructSize for Builder<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,T> ::capnp::traits::HasTypeId for Builder<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,T> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, T> { - Builder { builder, _phantom: ::core::marker::PhantomData, } - } - } - - impl <'a,T> ::capnp::traits::ImbueMut<'a> for Builder<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - 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,T> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Builder<'a,T> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,T> ::capnp::traits::SetPointerBuilder for Reader<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,T>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,T> Builder<'a,T> where T: for<'c> ::capnp::traits::Owned<'c> { - pub fn into_reader(self) -> Reader<'a,T> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,T> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,T> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn set_nothing(&mut self, _value: ()) { - self.builder.set_data_field::(0, 0); - } - #[inline] - pub fn initn_just(self, length: u32) -> >::Builder { - self.builder.set_data_field::(0, 1); - ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).initn_as(length) - } - #[inline] - pub fn set_just(&mut self, value: >::Reader) -> ::capnp::Result<()> { - self.builder.set_data_field::(0, 1); - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_just(self, ) -> >::Builder { - self.builder.set_data_field::(0, 1); - ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).init_as() - } - pub fn has_just(&self) -> bool { - if self.builder.get_data_field::(0) != 1 { return false; } - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { - match self.builder.get_data_field::(0) { - 0 => { - ::core::result::Result::Ok(Nothing( - () - )) - } - 1 => { - ::core::result::Result::Ok(Just( - ::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, - _phantom: ::core::marker::PhantomData - } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, _phantom: ::core::marker::PhantomData, } - } - } - impl Pipeline where T: ::capnp::traits::Pipelined, ::Pipeline: ::capnp::capability::FromTypelessPipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd77e_cca2_05b0_6927; - } - pub enum Which { - Nothing(()), - Just(A0), - } - pub type WhichReader<'a,T> = Which<::capnp::Result<>::Reader>>; - pub type WhichBuilder<'a,T> = Which<::capnp::Result<>::Builder>>; -} - -pub mod fallible { /* T,E */ - pub use self::Which::{Failed,Successful}; - - #[derive(Copy, Clone)] - pub struct Owned { - _phantom: ::core::marker::PhantomData<(T,E)> - } - impl <'a, T,E> ::capnp::traits::Owned<'a> for Owned where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { type Reader = Reader<'a, T,E>; type Builder = Builder<'a, T,E>; } - impl <'a, T,E> ::capnp::traits::OwnedStruct<'a> for Owned where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { type Reader = Reader<'a, T,E>; type Builder = Builder<'a, T,E>; } - impl ::capnp::traits::Pipelined for Owned where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - reader: ::capnp::private::layout::StructReader<'a>, - _phantom: ::core::marker::PhantomData<(T,E)> - } - - impl <'a,T,E> ::capnp::traits::HasTypeId for Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,T,E> ::capnp::traits::FromStructReader<'a> for Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,T,E> { - Reader { reader, _phantom: ::core::marker::PhantomData, } - } - } - - impl <'a,T,E> ::capnp::traits::FromPointerReader<'a> for Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - impl <'a,T,E> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { - self.reader - } - } - - impl <'a,T,E> ::capnp::traits::Imbue<'a> for Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { - self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) - } - } - - impl <'a,T,E> Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - pub fn reborrow(&self) -> Reader<'_,T,E> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - pub fn has_failed(&self) -> bool { - if self.reader.get_data_field::(0) != 0 { return false; } - !self.reader.get_pointer_field(0).is_null() - } - pub fn has_successful(&self) -> bool { - if self.reader.get_data_field::(0) != 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::(0) { - 0 => { - ::core::result::Result::Ok(Failed( - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - )) - } - 1 => { - ::core::result::Result::Ok(Successful( - ::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,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - builder: ::capnp::private::layout::StructBuilder<'a>, - _phantom: ::core::marker::PhantomData<(T,E)> - } - impl <'a,T,E> ::capnp::traits::HasStructSize for Builder<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,T,E> ::capnp::traits::HasTypeId for Builder<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,T,E> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, T,E> { - Builder { builder, _phantom: ::core::marker::PhantomData, } - } - } - - impl <'a,T,E> ::capnp::traits::ImbueMut<'a> for Builder<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - 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,T,E> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Builder<'a,T,E> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,T,E> ::capnp::traits::SetPointerBuilder for Reader<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,T,E>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,T,E> Builder<'a,T,E> where T: for<'c> ::capnp::traits::Owned<'c>, E: for<'c> ::capnp::traits::Owned<'c> { - pub fn into_reader(self) -> Reader<'a,T,E> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,T,E> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,T,E> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn initn_failed(self, length: u32) -> >::Builder { - self.builder.set_data_field::(0, 0); - ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).initn_as(length) - } - #[inline] - pub fn set_failed(&mut self, value: >::Reader) -> ::capnp::Result<()> { - self.builder.set_data_field::(0, 0); - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_failed(self, ) -> >::Builder { - self.builder.set_data_field::(0, 0); - ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).init_as() - } - pub fn has_failed(&self) -> bool { - if self.builder.get_data_field::(0) != 0 { return false; } - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn initn_successful(self, length: u32) -> >::Builder { - self.builder.set_data_field::(0, 1); - ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).initn_as(length) - } - #[inline] - pub fn set_successful(&mut self, value: >::Reader) -> ::capnp::Result<()> { - self.builder.set_data_field::(0, 1); - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_successful(self, ) -> >::Builder { - self.builder.set_data_field::(0, 1); - ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).init_as() - } - pub fn has_successful(&self) -> bool { - if self.builder.get_data_field::(0) != 1 { return false; } - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { - match self.builder.get_data_field::(0) { - 0 => { - ::core::result::Result::Ok(Failed( - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - )) - } - 1 => { - ::core::result::Result::Ok(Successful( - ::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, - _phantom: ::core::marker::PhantomData<(T,E)> - } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, _phantom: ::core::marker::PhantomData, } - } - } - impl Pipeline where T: ::capnp::traits::Pipelined, ::Pipeline: ::capnp::capability::FromTypelessPipeline, E: ::capnp::traits::Pipelined, ::Pipeline: ::capnp::capability::FromTypelessPipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 1 }; - pub const TYPE_ID: u64 = 0xf477_aafa_9205_11aa; - } - pub enum Which { - Failed(A0), - Successful(A1), - } - pub type WhichReader<'a,T,E> = Which<::capnp::Result<>::Reader>,::capnp::Result<>::Reader>>; - pub type WhichBuilder<'a,T,E> = Which<::capnp::Result<>::Builder>,::capnp::Result<>::Builder>>; -} diff --git a/api/src/schema/machine_capnp.rs b/api/src/schema/machine_capnp.rs deleted file mode 100644 index 855ea7b..0000000 --- a/api/src/schema/machine_capnp.rs +++ /dev/null @@ -1,7382 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: machine.capnp - - -pub mod machine { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_id(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_space(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_space(&self) -> bool { - !self.reader.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) - } - pub fn has_name(&self) -> bool { - !self.reader.get_pointer_field(2).is_null() - } - #[inline] - pub fn get_description(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(3), ::core::option::Option::None) - } - pub fn has_description(&self) -> bool { - !self.reader.get_pointer_field(3).is_null() - } - #[inline] - pub fn get_state(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.reader.get_data_field::(0)) - } - #[inline] - pub fn get_manager(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(4), ::core::option::Option::None) - } - pub fn has_manager(&self) -> bool { - !self.reader.get_pointer_field(4).is_null() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.reader.get_pointer_field(5).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_use(self) -> ::capnp::Result { - match self.reader.get_pointer_field(6).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_inuse(self) -> ::capnp::Result { - match self.reader.get_pointer_field(7).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_takeover(self) -> ::capnp::Result { - match self.reader.get_pointer_field(8).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_check(self) -> ::capnp::Result { - match self.reader.get_pointer_field(9).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.reader.get_pointer_field(10).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_admin(self) -> ::capnp::Result { - match self.reader.get_pointer_field(11).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_wiki(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(12), ::core::option::Option::None) - } - pub fn has_wiki(&self) -> bool { - !self.reader.get_pointer_field(12).is_null() - } - #[inline] - pub fn get_urn(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(13), ::core::option::Option::None) - } - pub fn has_urn(&self) -> bool { - !self.reader.get_pointer_field(13).is_null() - } - #[inline] - pub fn get_category(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(14), ::core::option::Option::None) - } - pub fn has_category(&self) -> bool { - !self.reader.get_pointer_field(14).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_id(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_id(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_id(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_id(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_space(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn set_space(&mut self, value: crate::schema::space_capnp::space::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(1), value, false) - } - #[inline] - pub fn init_space(self, ) -> crate::schema::space_capnp::space::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) - } - pub fn has_space(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_name(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) - } - #[inline] - pub fn set_name(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(2).set_text(value); - } - #[inline] - pub fn init_name(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(2).init_text(size) - } - pub fn has_name(&self) -> bool { - !self.builder.get_pointer_field(2).is_null() - } - #[inline] - pub fn get_description(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(3), ::core::option::Option::None) - } - #[inline] - pub fn set_description(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(3).set_text(value); - } - #[inline] - pub fn init_description(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(3).init_text(size) - } - pub fn has_description(&self) -> bool { - !self.builder.get_pointer_field(3).is_null() - } - #[inline] - pub fn get_state(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.builder.get_data_field::(0)) - } - #[inline] - pub fn set_state(&mut self, value: crate::schema::machine_capnp::machine::MachineState) { - self.builder.set_data_field::(0, value as u16) - } - #[inline] - pub fn get_manager(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(4), ::core::option::Option::None) - } - #[inline] - pub fn set_manager(&mut self, value: crate::schema::general_capnp::optional::Reader<'_,crate::schema::user_capnp::user::Owned>) -> ::capnp::Result<()> { - as ::capnp::traits::SetPointerBuilder>::set_pointer_builder(self.builder.get_pointer_field(4), value, false) - } - #[inline] - pub fn init_manager(self, ) -> crate::schema::general_capnp::optional::Builder<'a,crate::schema::user_capnp::user::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(4), 0) - } - pub fn has_manager(&self) -> bool { - !self.builder.get_pointer_field(4).is_null() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.builder.get_pointer_field(5).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_info(&mut self, value: crate::schema::machine_capnp::machine::info::Client) { - self.builder.get_pointer_field(5).set_capability(value.client.hook); - } - #[inline] - pub fn get_use(self) -> ::capnp::Result { - match self.builder.get_pointer_field(6).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_use(&mut self, value: crate::schema::machine_capnp::machine::use_::Client) { - self.builder.get_pointer_field(6).set_capability(value.client.hook); - } - #[inline] - pub fn get_inuse(self) -> ::capnp::Result { - match self.builder.get_pointer_field(7).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_inuse(&mut self, value: crate::schema::machine_capnp::machine::in_use::Client) { - self.builder.get_pointer_field(7).set_capability(value.client.hook); - } - #[inline] - pub fn get_takeover(self) -> ::capnp::Result { - match self.builder.get_pointer_field(8).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_takeover(&mut self, value: crate::schema::machine_capnp::machine::takeover::Client) { - self.builder.get_pointer_field(8).set_capability(value.client.hook); - } - #[inline] - pub fn get_check(self) -> ::capnp::Result { - match self.builder.get_pointer_field(9).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_check(&mut self, value: crate::schema::machine_capnp::machine::check::Client) { - self.builder.get_pointer_field(9).set_capability(value.client.hook); - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.builder.get_pointer_field(10).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_manage(&mut self, value: crate::schema::machine_capnp::machine::manage::Client) { - self.builder.get_pointer_field(10).set_capability(value.client.hook); - } - #[inline] - pub fn get_admin(self) -> ::capnp::Result { - match self.builder.get_pointer_field(11).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_admin(&mut self, value: crate::schema::machine_capnp::machine::admin::Client) { - self.builder.get_pointer_field(11).set_capability(value.client.hook); - } - #[inline] - pub fn get_wiki(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(12), ::core::option::Option::None) - } - #[inline] - pub fn set_wiki(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(12).set_text(value); - } - #[inline] - pub fn init_wiki(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(12).init_text(size) - } - pub fn has_wiki(&self) -> bool { - !self.builder.get_pointer_field(12).is_null() - } - #[inline] - pub fn get_urn(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(13), ::core::option::Option::None) - } - #[inline] - pub fn set_urn(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(13).set_text(value); - } - #[inline] - pub fn init_urn(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(13).init_text(size) - } - pub fn has_urn(&self) -> bool { - !self.builder.get_pointer_field(13).is_null() - } - #[inline] - pub fn get_category(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(14), ::core::option::Option::None) - } - #[inline] - pub fn set_category(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(14).set_text(value); - } - #[inline] - pub fn init_category(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(14).init_text(size) - } - pub fn has_category(&self) -> bool { - !self.builder.get_pointer_field(14).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_space(&self) -> crate::schema::space_capnp::space::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) - } - pub fn get_manager(&self) -> crate::schema::general_capnp::optional::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(4)) - } - pub fn get_info(&self) -> crate::schema::machine_capnp::machine::info::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(5).as_cap()) - } - pub fn get_use(&self) -> crate::schema::machine_capnp::machine::use_::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(6).as_cap()) - } - pub fn get_inuse(&self) -> crate::schema::machine_capnp::machine::in_use::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(7).as_cap()) - } - pub fn get_takeover(&self) -> crate::schema::machine_capnp::machine::takeover::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(8).as_cap()) - } - pub fn get_check(&self) -> crate::schema::machine_capnp::machine::check::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(9).as_cap()) - } - pub fn get_manage(&self) -> crate::schema::machine_capnp::machine::manage::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(10).as_cap()) - } - pub fn get_admin(&self) -> crate::schema::machine_capnp::machine::admin::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(11).as_cap()) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 15 }; - pub const TYPE_ID: u64 = 0xa95c_2ea0_98a4_34ee; - } - - #[repr(u16)] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum MachineState { - Free = 0, - InUse = 1, - ToCheck = 2, - Blocked = 3, - Disabled = 4, - Reserved = 5, - Totakeover = 6, - } - impl ::capnp::traits::FromU16 for MachineState { - #[inline] - fn from_u16(value: u16) -> ::core::result::Result { - match value { - 0 => ::core::result::Result::Ok(MachineState::Free), - 1 => ::core::result::Result::Ok(MachineState::InUse), - 2 => ::core::result::Result::Ok(MachineState::ToCheck), - 3 => ::core::result::Result::Ok(MachineState::Blocked), - 4 => ::core::result::Result::Ok(MachineState::Disabled), - 5 => ::core::result::Result::Ok(MachineState::Reserved), - 6 => ::core::result::Result::Ok(MachineState::Totakeover), - n => ::core::result::Result::Err(::capnp::NotInSchema(n)), - } - } - } - impl ::capnp::traits::ToU16 for MachineState { - #[inline] - fn to_u16(self) -> u16 { self as u16 } - } - impl ::capnp::traits::HasTypeId for MachineState { - #[inline] - fn type_id() -> u64 { 0xc6b5_f6a5_8024_3939u64 } - } - - pub mod machine_info_extended { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_current_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_current_user(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_last_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_last_user(&self) -> bool { - !self.reader.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_instructor_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) - } - pub fn has_instructor_user(&self) -> bool { - !self.reader.get_pointer_field(2).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_current_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_current_user(&mut self, value: crate::schema::general_capnp::optional::Reader<'_,crate::schema::user_capnp::user::Owned>) -> ::capnp::Result<()> { - as ::capnp::traits::SetPointerBuilder>::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_current_user(self, ) -> crate::schema::general_capnp::optional::Builder<'a,crate::schema::user_capnp::user::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_current_user(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_last_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn set_last_user(&mut self, value: crate::schema::general_capnp::optional::Reader<'_,crate::schema::user_capnp::user::Owned>) -> ::capnp::Result<()> { - as ::capnp::traits::SetPointerBuilder>::set_pointer_builder(self.builder.get_pointer_field(1), value, false) - } - #[inline] - pub fn init_last_user(self, ) -> crate::schema::general_capnp::optional::Builder<'a,crate::schema::user_capnp::user::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) - } - pub fn has_last_user(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_instructor_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) - } - #[inline] - pub fn set_instructor_user(&mut self, value: crate::schema::general_capnp::optional::Reader<'_,crate::schema::user_capnp::user::Owned>) -> ::capnp::Result<()> { - as ::capnp::traits::SetPointerBuilder>::set_pointer_builder(self.builder.get_pointer_field(2), value, false) - } - #[inline] - pub fn init_instructor_user(self, ) -> crate::schema::general_capnp::optional::Builder<'a,crate::schema::user_capnp::user::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(2), 0) - } - pub fn has_instructor_user(&self) -> bool { - !self.builder.get_pointer_field(2).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_current_user(&self) -> crate::schema::general_capnp::optional::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - pub fn get_last_user(&self) -> crate::schema::general_capnp::optional::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) - } - pub fn get_instructor_user(&self) -> crate::schema::general_capnp::optional::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(2)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 3 }; - pub const TYPE_ID: u64 = 0xc7d1_8e03_df4b_bcec; - } - } - - pub mod reservation { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_user(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_start(self) -> u64 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_end(self) -> u64 { - self.reader.get_data_field::(1) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_user(&mut self, value: crate::schema::user_capnp::user::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_user(self, ) -> crate::schema::user_capnp::user::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_user(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_start(self) -> u64 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_start(&mut self, value: u64) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_end(self) -> u64 { - self.builder.get_data_field::(1) - } - #[inline] - pub fn set_end(&mut self, value: u64) { - 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) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_user(&self) -> crate::schema::user_capnp::user::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 2, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd089_e744_5c1b_58b0; - } - } - - - pub mod info { - #![allow(unused_variables)] - pub type GetPropertyListParams<> = ::capnp::capability::Params; - pub type GetPropertyListResults<> = ::capnp::capability::Results; - pub type GetReservationListParams<> = ::capnp::capability::Params; - pub type GetReservationListResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_property_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn get_reservation_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - } - pub trait Server<> { - fn get_property_list(&mut self, _: GetPropertyListParams<>, _: GetPropertyListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_reservation_list(&mut self, _: GetReservationListParams<>, _: GetReservationListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_property_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.get_reservation_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xe8f7_64db_4c9d_7004; - } - - pub mod get_property_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xae03_6df5_03fb_4bcd; - } - } - - pub mod get_property_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_property_list(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::general_capnp::key_value_pair::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_property_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_property_list(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::general_capnp::key_value_pair::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_property_list(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::general_capnp::key_value_pair::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_property_list(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::general_capnp::key_value_pair::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_property_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd7cd_da5a_467b_979c; - } - } - - pub mod get_reservation_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xea43_7a99_ebde_8df5; - } - } - - pub mod get_reservation_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_reservation_list(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::machine_capnp::machine::reservation::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_reservation_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_reservation_list(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::machine_capnp::machine::reservation::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_reservation_list(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::machine_capnp::machine::reservation::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_reservation_list(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::machine_capnp::machine::reservation::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_reservation_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xa29e_1b2e_6f6b_9692; - } - } - } - - - pub mod use_ { - #![allow(unused_variables)] - pub type UseParams<> = ::capnp::capability::Params; - pub type UseResults<> = ::capnp::capability::Results; - pub type ReserveParams<> = ::capnp::capability::Params; - pub type ReserveResults<> = ::capnp::capability::Results; - pub type ReservetoParams<> = ::capnp::capability::Params; - pub type ReservetoResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn use_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn reserve_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn reserveto_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - } - pub trait Server<> { - fn use_(&mut self, _: UseParams<>, _: UseResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn reserve(&mut self, _: ReserveParams<>, _: ReserveResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn reserveto(&mut self, _: ReservetoParams<>, _: ReservetoResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.use_(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.reserve(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.reserveto(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0x9d2a_528b_982f_8c98; - } - - pub mod use_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xa425_aba8_4527_d19a; - } - } - - pub mod use_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xd1d9_fd34_50e2_5f74; - } - } - - pub mod reserve_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf7e8_8dd9_7db7_8cc5; - } - } - - pub mod reserve_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9ecd_9108_710f_db8a; - } - } - - pub mod reserveto_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_start(self) -> u64 { - self.reader.get_data_field::(0) - } - #[inline] - pub fn get_end(self) -> u64 { - self.reader.get_data_field::(1) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_start(self) -> u64 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_start(&mut self, value: u64) { - self.builder.set_data_field::(0, value); - } - #[inline] - pub fn get_end(self) -> u64 { - self.builder.get_data_field::(1) - } - #[inline] - pub fn set_end(&mut self, value: u64) { - 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) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 2, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9bac_1518_a129_61b4; - } - } - - pub mod reserveto_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x82ba_1cc9_a96e_e5bb; - } - } - } - - - pub mod in_use { - #![allow(unused_variables)] - pub type GiveBackParams<> = ::capnp::capability::Params; - pub type GiveBackResults<> = ::capnp::capability::Results; - pub type SendRawDataParams<> = ::capnp::capability::Params; - pub type SendRawDataResults<> = ::capnp::capability::Results; - pub type ReleasefortakeoverParams<> = ::capnp::capability::Params; - pub type ReleasefortakeoverResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn give_back_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn send_raw_data_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn releasefortakeover_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - } - pub trait Server<> { - fn give_back(&mut self, _: GiveBackParams<>, _: GiveBackResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn send_raw_data(&mut self, _: SendRawDataParams<>, _: SendRawDataResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn releasefortakeover(&mut self, _: ReleasefortakeoverParams<>, _: ReleasefortakeoverResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.give_back(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.send_raw_data(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.releasefortakeover(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0x9d1f_185e_659f_c4cd; - } - - pub mod give_back_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xa003_297c_6278_9ced; - } - } - - pub mod give_back_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xa587_6144_26ce_5331; - } - } - - pub mod send_raw_data_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_data(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_data(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_data(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_data(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_data(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_data(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd20f_8de5_bc5f_5844; - } - } - - pub mod send_raw_data_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf98d_376d_fd87_c053; - } - } - - pub mod releasefortakeover_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xc879_cdaf_2d97_3e6f; - } - } - - pub mod releasefortakeover_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xd03d_ce6f_ea05_2e50; - } - } - } - - - pub mod takeover { - #![allow(unused_variables)] - pub type AcceptParams<> = ::capnp::capability::Params; - pub type AcceptResults<> = ::capnp::capability::Results; - pub type RejectParams<> = ::capnp::capability::Params; - pub type RejectResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn accept_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn reject_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - } - pub trait Server<> { - fn accept(&mut self, _: AcceptParams<>, _: AcceptResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn reject(&mut self, _: RejectParams<>, _: RejectResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.accept(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.reject(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xa196_61b8_da10_e217; - } - - pub mod accept_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xef71_cc3e_6515_a9f4; - } - } - - pub mod accept_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xcee2_85e4_bf08_9b34; - } - } - - pub mod reject_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xae3f_7198_268b_3971; - } - } - - pub mod reject_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xed6f_7794_abd1_ffa6; - } - } - } - - - pub mod check { - #![allow(unused_variables)] - pub type CheckParams<> = ::capnp::capability::Params; - pub type CheckResults<> = ::capnp::capability::Results; - pub type RejectParams<> = ::capnp::capability::Params; - pub type RejectResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn check_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn reject_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - } - pub trait Server<> { - fn check(&mut self, _: CheckParams<>, _: CheckResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn reject(&mut self, _: RejectParams<>, _: RejectResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.check(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.reject(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0x8226_479e_fa91_9a74; - } - - pub mod check_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf050_b12c_d712_2ee4; - } - } - - pub mod check_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x8754_f41b_83aa_b55c; - } - } - - pub mod reject_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9c53_e9aa_193d_fb99; - } - } - - pub mod reject_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf632_c9c0_64ad_fdeb; - } - } - } - - - pub mod manage { - #![allow(unused_variables)] - pub type GetMachineInfoExtendedParams<> = ::capnp::capability::Params; - pub type GetMachineInfoExtendedResults<> = ::capnp::capability::Results; - pub type SetPropertyParams<> = ::capnp::capability::Params; - pub type SetPropertyResults<> = ::capnp::capability::Results; - pub type RemovePropertyParams<> = ::capnp::capability::Params; - pub type RemovePropertyResults<> = ::capnp::capability::Results; - pub type ForceUseParams<> = ::capnp::capability::Params; - pub type ForceUseResults<> = ::capnp::capability::Results; - pub type ForceFreeParams<> = ::capnp::capability::Params; - pub type ForceFreeResults<> = ::capnp::capability::Results; - pub type ForceTransferParams<> = ::capnp::capability::Params; - pub type ForceTransferResults<> = ::capnp::capability::Results; - pub type BlockParams<> = ::capnp::capability::Params; - pub type BlockResults<> = ::capnp::capability::Results; - pub type DisabledParams<> = ::capnp::capability::Params; - pub type DisabledResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_machine_info_extended_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn set_property_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn remove_property_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - pub fn force_use_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 3, None) - } - pub fn force_free_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 4, None) - } - pub fn force_transfer_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 5, None) - } - pub fn block_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 6, None) - } - pub fn disabled_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 7, None) - } - } - pub trait Server<> { - fn get_machine_info_extended(&mut self, _: GetMachineInfoExtendedParams<>, _: GetMachineInfoExtendedResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn set_property(&mut self, _: SetPropertyParams<>, _: SetPropertyResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn remove_property(&mut self, _: RemovePropertyParams<>, _: RemovePropertyResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn force_use(&mut self, _: ForceUseParams<>, _: ForceUseResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn force_free(&mut self, _: ForceFreeParams<>, _: ForceFreeResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn force_transfer(&mut self, _: ForceTransferParams<>, _: ForceTransferResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn block(&mut self, _: BlockParams<>, _: BlockResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn disabled(&mut self, _: DisabledParams<>, _: DisabledResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_machine_info_extended(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.set_property(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.remove_property(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 3 => server.force_use(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 4 => server.force_free(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 5 => server.force_transfer(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 6 => server.block(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 7 => server.disabled(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xe161_da96_ca4f_0966; - } - - pub mod get_machine_info_extended_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9d80_14b2_02cd_9214; - } - } - - pub mod set_property_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_property(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_property(&mut self, value: crate::schema::general_capnp::key_value_pair::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_property(self, ) -> crate::schema::general_capnp::key_value_pair::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_property(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_property(&self) -> crate::schema::general_capnp::key_value_pair::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xe065_5192_54e2_9c14; - } - } - - pub mod set_property_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x90bc_fd6c_287d_7cdc; - } - } - - pub mod remove_property_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_property(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_property(&mut self, value: crate::schema::general_capnp::key_value_pair::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_property(self, ) -> crate::schema::general_capnp::key_value_pair::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_property(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_property(&self) -> crate::schema::general_capnp::key_value_pair::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xbc9c_3a92_ccc1_0e33; - } - } - - pub mod remove_property_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x8d41_672d_742c_6cee; - } - } - - pub mod force_use_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9e7c_c6f8_1a92_d0e7; - } - } - - pub mod force_use_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xc379_51e5_aafd_8f8b; - } - } - - pub mod force_free_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xa20d_d1ae_75d8_8d46; - } - } - - pub mod force_free_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xcfed_3718_5807_4fa4; - } - } - - pub mod force_transfer_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_user(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_user(&mut self, value: crate::schema::user_capnp::user::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_user(self, ) -> crate::schema::user_capnp::user::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_user(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_user(&self) -> crate::schema::user_capnp::user::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xdf2c_3a53_4354_5982; - } - } - - pub mod force_transfer_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9ed9_4944_c1ee_37ae; - } - } - - pub mod block_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xb01b_5d6e_fac2_600a; - } - } - - pub mod block_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xbb5f_d351_1b68_9e52; - } - } - - pub mod disabled_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xa86e_ea6c_17ce_48ab; - } - } - - pub mod disabled_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x8457_ab8d_d3cb_2d64; - } - } - } - - - pub mod admin { - #![allow(unused_variables)] - pub type ForceSetStateParams<> = ::capnp::capability::Params; - pub type ForceSetStateResults<> = ::capnp::capability::Results; - pub type ForceSetUserParams<> = ::capnp::capability::Params; - pub type ForceSetUserResults<> = ::capnp::capability::Results; - pub type GetAdminPropertyListParams<> = ::capnp::capability::Params; - pub type GetAdminPropertyListResults<> = ::capnp::capability::Results; - pub type SetAdminPropertyParams<> = ::capnp::capability::Params; - pub type SetAdminPropertyResults<> = ::capnp::capability::Results; - pub type RemoveAdminPropertyParams<> = ::capnp::capability::Params; - pub type RemoveAdminPropertyResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn force_set_state_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn force_set_user_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn get_admin_property_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - pub fn set_admin_property_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 3, None) - } - pub fn remove_admin_property_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 4, None) - } - } - pub trait Server<> { - fn force_set_state(&mut self, _: ForceSetStateParams<>, _: ForceSetStateResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn force_set_user(&mut self, _: ForceSetUserParams<>, _: ForceSetUserResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_admin_property_list(&mut self, _: GetAdminPropertyListParams<>, _: GetAdminPropertyListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn set_admin_property(&mut self, _: SetAdminPropertyParams<>, _: SetAdminPropertyResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn remove_admin_property(&mut self, _: RemoveAdminPropertyParams<>, _: RemoveAdminPropertyResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.force_set_state(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.force_set_user(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.get_admin_property_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 3 => server.set_admin_property(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 4 => server.remove_admin_property(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xd66e_d2ed_974a_1025; - } - - pub mod force_set_state_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_state(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.reader.get_data_field::(0)) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_state(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.builder.get_data_field::(0)) - } - #[inline] - pub fn set_state(&mut self, value: crate::schema::machine_capnp::machine::MachineState) { - 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) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 0 }; - pub const TYPE_ID: u64 = 0x8228_7a58_359d_10ff; - } - } - - pub mod force_set_state_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xfbe9_4788_8ec5_b330; - } - } - - pub mod force_set_user_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_user(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_user(&mut self, value: crate::schema::user_capnp::user::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_user(self, ) -> crate::schema::user_capnp::user::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_user(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_user(&self) -> crate::schema::user_capnp::user::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd852_9b3d_9c34_e7dd; - } - } - - pub mod force_set_user_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf542_5a44_49e5_b39a; - } - } - - pub mod get_admin_property_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x93f4_7713_bc9e_269f; - } - } - - pub mod get_admin_property_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_property_list(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::general_capnp::key_value_pair::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_property_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_property_list(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::general_capnp::key_value_pair::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_property_list(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::general_capnp::key_value_pair::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_property_list(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::general_capnp::key_value_pair::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_property_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xcc04_f506_31e0_df3d; - } - } - - pub mod set_admin_property_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_property(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_property(&mut self, value: crate::schema::general_capnp::key_value_pair::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_property(self, ) -> crate::schema::general_capnp::key_value_pair::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_property(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_property(&self) -> crate::schema::general_capnp::key_value_pair::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xc65a_7226_66cf_f72a; - } - } - - pub mod set_admin_property_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xe490_6225_e1b6_2499; - } - } - - pub mod remove_admin_property_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_property(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_property(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_property(&mut self, value: crate::schema::general_capnp::key_value_pair::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_property(self, ) -> crate::schema::general_capnp::key_value_pair::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_property(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_property(&self) -> crate::schema::general_capnp::key_value_pair::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xa081_e268_7491_d30d; - } - } - - pub mod remove_admin_property_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xc3ce_ab56_772e_a39d; - } - } - } -} diff --git a/api/src/schema/machinesystem_capnp.rs b/api/src/schema/machinesystem_capnp.rs deleted file mode 100644 index d002d58..0000000 --- a/api/src/schema/machinesystem_capnp.rs +++ /dev/null @@ -1,756 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: machinesystem.capnp - - -pub mod machine_system { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.reader.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.builder.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_info(&mut self, value: crate::schema::machinesystem_capnp::machine_system::info::Client) { - self.builder.get_pointer_field(0).set_capability(value.client.hook); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_info(&self) -> crate::schema::machinesystem_capnp::machine_system::info::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(0).as_cap()) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x8771_90c7_e487_ddb6; - } - - - pub mod info { - #![allow(unused_variables)] - pub type GetMachineListParams<> = ::capnp::capability::Params; - pub type GetMachineListResults<> = ::capnp::capability::Results; - pub type GetMachineParams<> = ::capnp::capability::Params; - pub type GetMachineResults<> = ::capnp::capability::Results>; - pub type GetMachineURNParams<> = ::capnp::capability::Params; - pub type GetMachineURNResults<> = ::capnp::capability::Results>; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_machine_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn get_machine_request(&self) -> ::capnp::capability::Request> { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn get_machine_u_r_n_request(&self) -> ::capnp::capability::Request> { - self.client.new_call(_private::TYPE_ID, 2, None) - } - } - pub trait Server<> { - fn get_machine_list(&mut self, _: GetMachineListParams<>, _: GetMachineListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_machine(&mut self, _: GetMachineParams<>, _: GetMachineResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_machine_u_r_n(&mut self, _: GetMachineURNParams<>, _: GetMachineURNResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_machine_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.get_machine(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.get_machine_u_r_n(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xf8a1_a0ce_79e3_a4ae; - } - - pub mod get_machine_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xae72_5a44_381c_cb81; - } - } - - pub mod get_machine_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_machine_list(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::machine_capnp::machine::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_machine_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_machine_list(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::machine_capnp::machine::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_machine_list(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::machine_capnp::machine::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_machine_list(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::machine_capnp::machine::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_machine_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x9964_3fc1_40c0_b2c1; - } - } - - pub mod get_machine_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_id(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_id(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_id(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_id(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xe315_5a06_09f4_4bed; - } - } - - pub mod get_machine_u_r_n_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_urn(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_urn(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_urn(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_urn(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_urn(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_urn(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xeb9d_c2e7_8963_51aa; - } - } - } -} diff --git a/api/src/schema/permissionsystem_capnp.rs b/api/src/schema/permissionsystem_capnp.rs deleted file mode 100644 index 48ecfca..0000000 --- a/api/src/schema/permissionsystem_capnp.rs +++ /dev/null @@ -1,572 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: permissionsystem.capnp - - -pub mod permission_system { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.reader.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.reader.get_pointer_field(1).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.builder.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_info(&mut self, value: crate::schema::permissionsystem_capnp::permission_system::info::Client) { - self.builder.get_pointer_field(0).set_capability(value.client.hook); - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.builder.get_pointer_field(1).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_manage(&mut self, value: crate::schema::permissionsystem_capnp::permission_system::manage::Client) { - self.builder.get_pointer_field(1).set_capability(value.client.hook); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_info(&self) -> crate::schema::permissionsystem_capnp::permission_system::info::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(0).as_cap()) - } - pub fn get_manage(&self) -> crate::schema::permissionsystem_capnp::permission_system::manage::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(1).as_cap()) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xcafb_f059_d7a0_0c3b; - } - - - pub mod info { - #![allow(unused_variables)] - pub type GetRoleListParams<> = ::capnp::capability::Params; - pub type GetRoleListResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_role_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - } - pub trait Server<> { - fn get_role_list(&mut self, _: GetRoleListParams<>, _: GetRoleListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_role_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xdff7_7e8f_ec2d_a43b; - } - - pub mod get_role_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xd5b5_fb0f_7259_c89b; - } - } - - pub mod get_role_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_role_list(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::role_capnp::role::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_role_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_role_list(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::role_capnp::role::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_role_list(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::role_capnp::role::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_role_list(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::role_capnp::role::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_role_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xc506_980d_e52d_5ab2; - } - } - } - - - pub mod manage { - #![allow(unused_variables)] - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - } - pub trait Server<> { - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xfd2c_0c85_d50a_57e6; - } - } -} diff --git a/api/src/schema/programming_language/csharp_capnp.rs b/api/src/schema/programming_language/csharp_capnp.rs deleted file mode 100644 index 7a3b37c..0000000 --- a/api/src/schema/programming_language/csharp_capnp.rs +++ /dev/null @@ -1,29 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: programming_language/csharp.capnp - - -#[repr(u16)] -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum TypeVisibility { - Public = 0, - Internal = 1, -} -impl ::capnp::traits::FromU16 for TypeVisibility { - #[inline] - fn from_u16(value: u16) -> ::core::result::Result { - match value { - 0 => ::core::result::Result::Ok(TypeVisibility::Public), - 1 => ::core::result::Result::Ok(TypeVisibility::Internal), - n => ::core::result::Result::Err(::capnp::NotInSchema(n)), - } - } -} -impl ::capnp::traits::ToU16 for TypeVisibility { - #[inline] - fn to_u16(self) -> u16 { self as u16 } -} -impl ::capnp::traits::HasTypeId for TypeVisibility { - #[inline] - fn type_id() -> u64 { 0xeb0d_8316_68c6_eda5u64 } -} diff --git a/api/src/schema/programming_language/rust_capnp.rs b/api/src/schema/programming_language/rust_capnp.rs deleted file mode 100644 index 00506e6..0000000 --- a/api/src/schema/programming_language/rust_capnp.rs +++ /dev/null @@ -1,4 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: programming_language/rust.capnp - diff --git a/api/src/schema/role_capnp.rs b/api/src/schema/role_capnp.rs deleted file mode 100644 index 80ae0b4..0000000 --- a/api/src/schema/role_capnp.rs +++ /dev/null @@ -1,139 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: role.capnp - - -pub mod role { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_name(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_name(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_name(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_name(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_name(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd53a_c00e_04e0_4b2d; - } -} diff --git a/api/src/schema/space_capnp.rs b/api/src/schema/space_capnp.rs deleted file mode 100644 index 66dbafe..0000000 --- a/api/src/schema/space_capnp.rs +++ /dev/null @@ -1,186 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: space.capnp - - -pub mod space { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_id(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_name(&self) -> bool { - !self.reader.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) - } - pub fn has_info(&self) -> bool { - !self.reader.get_pointer_field(2).is_null() - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_id(&mut self, value: crate::schema::general_capnp::u_u_i_d::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_id(self, ) -> crate::schema::general_capnp::u_u_i_d::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_id(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_name(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_name(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_name(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_name(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) - } - #[inline] - pub fn set_info(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(2).set_text(value); - } - #[inline] - pub fn init_info(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(2).init_text(size) - } - pub fn has_info(&self) -> bool { - !self.builder.get_pointer_field(2).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_id(&self) -> crate::schema::general_capnp::u_u_i_d::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 3 }; - pub const TYPE_ID: u64 = 0x9e5f_9a6a_0528_b772; - } -} diff --git a/api/src/schema/user_capnp.rs b/api/src/schema/user_capnp.rs deleted file mode 100644 index d1f5f20..0000000 --- a/api/src/schema/user_capnp.rs +++ /dev/null @@ -1,3862 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: user.capnp - - -pub mod user { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_id(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_username(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_username(&self) -> bool { - !self.reader.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_space(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) - } - pub fn has_space(&self) -> bool { - !self.reader.get_pointer_field(2).is_null() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.reader.get_pointer_field(3).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.reader.get_pointer_field(4).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_admin(self) -> ::capnp::Result { - match self.reader.get_pointer_field(5).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_card_d_e_s_fire_e_v2(self) -> ::capnp::Result { - match self.reader.get_pointer_field(6).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_id(&mut self, value: crate::schema::general_capnp::u_u_i_d::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_id(self, ) -> crate::schema::general_capnp::u_u_i_d::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_id(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_username(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_username(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_username(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_username(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - #[inline] - pub fn get_space(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) - } - #[inline] - pub fn set_space(&mut self, value: crate::schema::space_capnp::space::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(2), value, false) - } - #[inline] - pub fn init_space(self, ) -> crate::schema::space_capnp::space::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(2), 0) - } - pub fn has_space(&self) -> bool { - !self.builder.get_pointer_field(2).is_null() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.builder.get_pointer_field(3).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_info(&mut self, value: crate::schema::user_capnp::user::info::Client) { - self.builder.get_pointer_field(3).set_capability(value.client.hook); - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.builder.get_pointer_field(4).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_manage(&mut self, value: crate::schema::user_capnp::user::manage::Client) { - self.builder.get_pointer_field(4).set_capability(value.client.hook); - } - #[inline] - pub fn get_admin(self) -> ::capnp::Result { - match self.builder.get_pointer_field(5).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_admin(&mut self, value: crate::schema::user_capnp::user::admin::Client) { - self.builder.get_pointer_field(5).set_capability(value.client.hook); - } - #[inline] - pub fn get_card_d_e_s_fire_e_v2(self) -> ::capnp::Result { - match self.builder.get_pointer_field(6).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_card_d_e_s_fire_e_v2(&mut self, value: crate::schema::user_capnp::user::card_d_e_s_fire_e_v2::Client) { - self.builder.get_pointer_field(6).set_capability(value.client.hook); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_id(&self) -> crate::schema::general_capnp::u_u_i_d::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - pub fn get_space(&self) -> crate::schema::space_capnp::space::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(2)) - } - pub fn get_info(&self) -> crate::schema::user_capnp::user::info::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(3).as_cap()) - } - pub fn get_manage(&self) -> crate::schema::user_capnp::user::manage::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(4).as_cap()) - } - pub fn get_admin(&self) -> crate::schema::user_capnp::user::admin::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(5).as_cap()) - } - pub fn get_card_d_e_s_fire_e_v2(&self) -> crate::schema::user_capnp::user::card_d_e_s_fire_e_v2::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(6).as_cap()) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 7 }; - pub const TYPE_ID: u64 = 0xd008_5d91_9d1b_c1bc; - } - - pub mod user_info_extended { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_id(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_name(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_name(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_id(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_id(&mut self, value: crate::schema::general_capnp::u_u_i_d::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_id(self, ) -> crate::schema::general_capnp::u_u_i_d::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_id(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_name(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_name(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_name(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_name(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_id(&self) -> crate::schema::general_capnp::u_u_i_d::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xafce_e817_6b90_e2eb; - } - } - - - pub mod info { - #![allow(unused_variables)] - pub type ListRolesParams<> = ::capnp::capability::Params; - pub type ListRolesResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn list_roles_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - } - pub trait Server<> { - fn list_roles(&mut self, _: ListRolesParams<>, _: ListRolesResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.list_roles(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xe1c9_a275_c390_a471; - } - - pub mod list_roles_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xb46a_75d4_f4fd_a984; - } - } - - pub mod list_roles_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_roles(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::role_capnp::role::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_roles(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_roles(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::role_capnp::role::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_roles(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::role_capnp::role::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_roles(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::role_capnp::role::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_roles(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xb07c_4efd_05ff_3dd2; - } - } - } - - - pub mod manage { - #![allow(unused_variables)] - pub type PwdParams<> = ::capnp::capability::Params; - pub type PwdResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn pwd_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - } - pub trait Server<> { - fn pwd(&mut self, _: PwdParams<>, _: PwdResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.pwd(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xd8b1_93f5_9551_2046; - } - - pub mod pwd_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_old_pwd(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_old_pwd(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_new_pwd(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_new_pwd(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_old_pwd(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_old_pwd(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_old_pwd(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_old_pwd(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_new_pwd(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_new_pwd(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_new_pwd(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_new_pwd(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xa309_a2b7_9e4f_7240; - } - } - - pub mod pwd_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xb1bd_053b_ad86_56a5; - } - } - } - - - pub mod admin { - #![allow(unused_variables)] - pub type GetUserInfoExtendedParams<> = ::capnp::capability::Params; - pub type GetUserInfoExtendedResults<> = ::capnp::capability::Results; - pub type AddRoleParams<> = ::capnp::capability::Params; - pub type AddRoleResults<> = ::capnp::capability::Results; - pub type RemoveRoleParams<> = ::capnp::capability::Params; - pub type RemoveRoleResults<> = ::capnp::capability::Results; - pub type PwdParams<> = ::capnp::capability::Params; - pub type PwdResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_user_info_extended_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn add_role_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn remove_role_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - pub fn pwd_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 3, None) - } - } - pub trait Server<> { - fn get_user_info_extended(&mut self, _: GetUserInfoExtendedParams<>, _: GetUserInfoExtendedResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn add_role(&mut self, _: AddRoleParams<>, _: AddRoleResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn remove_role(&mut self, _: RemoveRoleParams<>, _: RemoveRoleResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn pwd(&mut self, _: PwdParams<>, _: PwdResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_user_info_extended(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.add_role(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.remove_role(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 3 => server.pwd(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0x86a1_3c7f_6714_5be2; - } - - pub mod get_user_info_extended_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xe06c_9e8e_3aae_8242; - } - } - - pub mod get_user_info_extended_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_user_info_extended(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_user_info_extended(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_user_info_extended(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_user_info_extended(&mut self, value: crate::schema::user_capnp::user::user_info_extended::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_user_info_extended(self, ) -> crate::schema::user_capnp::user::user_info_extended::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_user_info_extended(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_user_info_extended(&self) -> crate::schema::user_capnp::user::user_info_extended::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xc702_28b2_8c53_38af; - } - } - - pub mod add_role_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_role(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_role(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_role(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_role(&mut self, value: crate::schema::role_capnp::role::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_role(self, ) -> crate::schema::role_capnp::role::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_role(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_role(&self) -> crate::schema::role_capnp::role::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x81bc_0d98_3ab5_2633; - } - } - - pub mod add_role_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xcab9_842c_2282_70b7; - } - } - - pub mod remove_role_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_role(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_role(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_role(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_role(&mut self, value: crate::schema::role_capnp::role::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_role(self, ) -> crate::schema::role_capnp::role::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_role(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_role(&self) -> crate::schema::role_capnp::role::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xbe3a_478b_2a46_3872; - } - } - - pub mod remove_role_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xe367_35ab_f311_abbb; - } - } - - pub mod pwd_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_new_pwd(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_new_pwd(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_new_pwd(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_new_pwd(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_new_pwd(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_new_pwd(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x9e03_1aba_fa0c_56c9; - } - } - - pub mod pwd_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9bca_039b_8a25_c736; - } - } - } - - - pub mod card_d_e_s_fire_e_v2 { - #![allow(unused_variables)] - pub type GetTokenListParams<> = ::capnp::capability::Params; - pub type GetTokenListResults<> = ::capnp::capability::Results; - pub type BindParams<> = ::capnp::capability::Params; - pub type BindResults<> = ::capnp::capability::Results; - pub type UnbindParams<> = ::capnp::capability::Params; - pub type UnbindResults<> = ::capnp::capability::Results; - pub type GenCardTokenParams<> = ::capnp::capability::Params; - pub type GenCardTokenResults<> = ::capnp::capability::Results; - pub type GetMetaInfoParams<> = ::capnp::capability::Params; - pub type GetMetaInfoResults<> = ::capnp::capability::Results; - pub type GetSpaceInfoParams<> = ::capnp::capability::Params; - pub type GetSpaceInfoResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_token_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn bind_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn unbind_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - pub fn gen_card_token_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 3, None) - } - pub fn get_meta_info_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 4, None) - } - pub fn get_space_info_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 5, None) - } - } - pub trait Server<> { - fn get_token_list(&mut self, _: GetTokenListParams<>, _: GetTokenListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn bind(&mut self, _: BindParams<>, _: BindResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn unbind(&mut self, _: UnbindParams<>, _: UnbindResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn gen_card_token(&mut self, _: GenCardTokenParams<>, _: GenCardTokenResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_meta_info(&mut self, _: GetMetaInfoParams<>, _: GetMetaInfoResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn get_space_info(&mut self, _: GetSpaceInfoParams<>, _: GetSpaceInfoResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_token_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.bind(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.unbind(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 3 => server.gen_card_token(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 4 => server.get_meta_info(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 5 => server.get_space_info(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xfccb_884f_8d28_ab46; - } - - pub mod get_token_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xe802_93c9_5217_3575; - } - } - - pub mod get_token_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_token_list(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_token_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_token_list(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_token_list(&mut self, value: ::capnp::data_list::Reader<'a>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_token_list(self, size: u32) -> ::capnp::data_list::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_token_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xc3d8_c650_2e28_0fa4; - } - } - - pub mod bind_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_token(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_token(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_auth_key(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_auth_key(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_token(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_token(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_token(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_token(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_auth_key(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) - } - #[inline] - pub fn set_auth_key(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(1).set_data(value); - } - #[inline] - pub fn init_auth_key(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(1).init_data(size) - } - pub fn has_auth_key(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xcef7_0aed_42d9_2b7f; - } - } - - pub mod bind_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x8c43_69ae_ddf6_6882; - } - } - - pub mod unbind_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_token(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_token(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_token(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_token(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_token(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_token(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xed33_c3cf_5593_945e; - } - } - - pub mod unbind_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf04d_b80d_e84e_46d7; - } - } - - pub mod gen_card_token_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xde16_1d81_9b5a_9205; - } - } - - pub mod gen_card_token_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_token(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_token(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_token(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_token(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_token(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_token(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xfc2a_ed58_eda2_2ff2; - } - } - - pub mod get_meta_info_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xe68e_2344_9770_c1ad; - } - } - - pub mod get_meta_info_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_bytes(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_bytes(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_bytes(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_bytes(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_bytes(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_bytes(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x8674_be66_3032_10ce; - } - } - - pub mod get_space_info_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf363_23db_6c11_ef19; - } - } - - pub mod get_space_info_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_bytes(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_bytes(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_bytes(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_bytes(&mut self, value: ::capnp::data::Reader<'_>) { - self.builder.get_pointer_field(0).set_data(value); - } - #[inline] - pub fn init_bytes(self, size: u32) -> ::capnp::data::Builder<'a> { - self.builder.get_pointer_field(0).init_data(size) - } - pub fn has_bytes(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x9f6d_66f8_ee0a_515d; - } - } - } -} diff --git a/api/src/schema/usersystem_capnp.rs b/api/src/schema/usersystem_capnp.rs deleted file mode 100644 index ee40cf4..0000000 --- a/api/src/schema/usersystem_capnp.rs +++ /dev/null @@ -1,1672 +0,0 @@ -// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. -// DO NOT EDIT. -// source: usersystem.capnp - - -pub mod user_system { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.reader.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.reader.get_pointer_field(1).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn get_search(self) -> ::capnp::Result { - match self.reader.get_pointer_field(2).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_info(self) -> ::capnp::Result { - match self.builder.get_pointer_field(0).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_info(&mut self, value: crate::schema::usersystem_capnp::user_system::info::Client) { - self.builder.get_pointer_field(0).set_capability(value.client.hook); - } - #[inline] - pub fn get_manage(self) -> ::capnp::Result { - match self.builder.get_pointer_field(1).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_manage(&mut self, value: crate::schema::usersystem_capnp::user_system::manage::Client) { - self.builder.get_pointer_field(1).set_capability(value.client.hook); - } - #[inline] - pub fn get_search(self) -> ::capnp::Result { - match self.builder.get_pointer_field(2).get_capability() { ::core::result::Result::Ok(c) => ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(c)), ::core::result::Result::Err(e) => ::core::result::Result::Err(e)} - } - #[inline] - pub fn set_search(&mut self, value: crate::schema::usersystem_capnp::user_system::search::Client) { - self.builder.get_pointer_field(2).set_capability(value.client.hook); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_info(&self) -> crate::schema::usersystem_capnp::user_system::info::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(0).as_cap()) - } - pub fn get_manage(&self) -> crate::schema::usersystem_capnp::user_system::manage::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(1).as_cap()) - } - pub fn get_search(&self) -> crate::schema::usersystem_capnp::user_system::search::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(2).as_cap()) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 3 }; - pub const TYPE_ID: u64 = 0xdabf_c8b5_9d3c_0019; - } - - - pub mod info { - #![allow(unused_variables)] - pub type GetUserSelfParams<> = ::capnp::capability::Params; - pub type GetUserSelfResults<> = ::capnp::capability::Results; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_user_self_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - } - pub trait Server<> { - fn get_user_self(&mut self, _: GetUserSelfParams<>, _: GetUserSelfResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_user_self(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0xbb4f_681e_4f75_53d9; - } - - pub mod get_user_self_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0x9f81_544f_0c89_4070; - } - } - } - - - pub mod search { - #![allow(unused_variables)] - pub type GetUserByNameParams<> = ::capnp::capability::Params; - pub type GetUserByNameResults<> = ::capnp::capability::Results>; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_user_by_name_request(&self) -> ::capnp::capability::Request> { - self.client.new_call(_private::TYPE_ID, 0, None) - } - } - pub trait Server<> { - fn get_user_by_name(&mut self, _: GetUserByNameParams<>, _: GetUserByNameResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_user_by_name(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0x9d17_e40c_2f40_05fd; - } - - pub mod get_user_by_name_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_username(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_username(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_username(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_username(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_username(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_username(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xd850_6330_6f45_65ca; - } - } - } - - - pub mod manage { - #![allow(unused_variables)] - pub type GetUserListParams<> = ::capnp::capability::Params; - pub type GetUserListResults<> = ::capnp::capability::Results; - pub type AddUserParams<> = ::capnp::capability::Params; - pub type AddUserResults<> = ::capnp::capability::Results; - pub type RemoveUserParams<> = ::capnp::capability::Params; - pub type RemoveUserResults<> = ::capnp::capability::Results; - pub type AddUserFallibleParams<> = ::capnp::capability::Params; - pub type AddUserFallibleResults<> = ::capnp::capability::Results>; - - pub struct Client { - pub client: ::capnp::capability::Client, - } - impl ::capnp::capability::FromClientHook for Client { - fn new(hook: Box) -> Client { - Client { client: ::capnp::capability::Client::new(hook), } - } - } - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Client; type Builder = Client; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Client; } - impl <'a,> ::capnp::traits::FromPointerReader<'a> for Client<> { - fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(reader.get_capability()?)) - } - } - impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Client<> { - fn init_pointer(_builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Client<> { - unimplemented!() - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::capability::FromClientHook::new(builder.get_capability()?)) - } - } - - impl <> ::capnp::traits::SetPointerBuilder for Client<> { - fn set_pointer_builder(pointer: ::capnp::private::layout::PointerBuilder<'_>, from: Client<>, _canonicalize: bool) -> ::capnp::Result<()> { - pointer.set_capability(from.client.hook); - ::core::result::Result::Ok(()) - } - } - impl ::capnp::traits::HasTypeId for Client { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } - } - } - impl Client { - pub fn get_user_list_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn add_user_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) - } - pub fn remove_user_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 2, None) - } - pub fn add_user_fallible_request(&self) -> ::capnp::capability::Request> { - self.client.new_call(_private::TYPE_ID, 3, None) - } - } - pub trait Server<> { - fn get_user_list(&mut self, _: GetUserListParams<>, _: GetUserListResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn add_user(&mut self, _: AddUserParams<>, _: AddUserResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn remove_user(&mut self, _: RemoveUserParams<>, _: RemoveUserResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn add_user_fallible(&mut self, _: AddUserFallibleParams<>, _: AddUserFallibleResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - } - pub struct ServerDispatch<_T,> { - pub server: _T, - } - impl <_S: Server + 'static, > ::capnp::capability::FromServer<_S> for Client { - type Dispatch = ServerDispatch<_S, >; - fn from_server(s: _S) -> ServerDispatch<_S, > { - ServerDispatch { server: s, } - } - } - impl <_T: Server> ::core::ops::Deref for ServerDispatch<_T> { - type Target = _T; - fn deref(&self) -> &_T { &self.server} - } - impl <_T: Server> ::core::ops::DerefMut for ServerDispatch<_T> { - fn deref_mut(&mut self) -> &mut _T { &mut self.server} - } - impl <_T: Server> ::capnp::capability::Server for ServerDispatch<_T> { - fn dispatch_call(&mut self, interface_id: u64, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match interface_id { - _private::TYPE_ID => ServerDispatch::<_T, >::dispatch_call_internal(&mut self.server, method_id, params, results), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - impl <_T :Server> ServerDispatch<_T> { - pub fn dispatch_call_internal(server: &mut _T, method_id: u16, params: ::capnp::capability::Params<::capnp::any_pointer::Owned>, results: ::capnp::capability::Results<::capnp::any_pointer::Owned>) -> ::capnp::capability::Promise<(), ::capnp::Error> { - match method_id { - 0 => server.get_user_list(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.add_user(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 2 => server.remove_user(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 3 => server.add_user_fallible(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - _ => { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("Method not implemented.".to_string())) } - } - } - } - pub mod _private { - pub const TYPE_ID: u64 = 0x9971_b909_6e1d_868c; - } - - pub mod add_user_error { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_error(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.reader.get_data_field::(0)) - } - } - - pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } - impl <'a,> ::capnp::traits::HasStructSize for Builder<'a,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_error(self) -> ::core::result::Result { - ::capnp::traits::FromU16::from_u16(self.builder.get_data_field::(0)) - } - #[inline] - pub fn set_error(&mut self, value: crate::schema::usersystem_capnp::user_system::manage::add_user_error::AddUserError) { - 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) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 1, pointers: 0 }; - pub const TYPE_ID: u64 = 0xf892_55fa_c5eb_df90; - } - - #[repr(u16)] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum AddUserError { - AlreadyExists = 0, - UsernameInvalid = 1, - PasswordInvalid = 2, - } - impl ::capnp::traits::FromU16 for AddUserError { - #[inline] - fn from_u16(value: u16) -> ::core::result::Result { - match value { - 0 => ::core::result::Result::Ok(AddUserError::AlreadyExists), - 1 => ::core::result::Result::Ok(AddUserError::UsernameInvalid), - 2 => ::core::result::Result::Ok(AddUserError::PasswordInvalid), - n => ::core::result::Result::Err(::capnp::NotInSchema(n)), - } - } - } - impl ::capnp::traits::ToU16 for AddUserError { - #[inline] - fn to_u16(self) -> u16 { self as u16 } - } - impl ::capnp::traits::HasTypeId for AddUserError { - #[inline] - fn type_id() -> u64 { 0x9623_12d4_e9d7_4876u64 } - } - } - - pub mod get_user_list_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xd6d7_a896_67be_ee51; - } - } - - pub mod get_user_list_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_user_list(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema::user_capnp::user::Owned>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_user_list(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_user_list(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema::user_capnp::user::Owned>> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_user_list(&mut self, value: ::capnp::struct_list::Reader<'a,crate::schema::user_capnp::user::Owned>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_user_list(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema::user_capnp::user::Owned> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), size) - } - pub fn has_user_list(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0x8bdb_48e2_cf16_f429; - } - } - - pub mod add_user_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_username(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_username(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_password(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_password(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_username(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_username(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_username(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_username(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_password(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_password(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_password(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_password(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xb4df_74b4_836c_cdca; - } - } - - pub mod remove_user_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_user(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_user(self) -> ::capnp::Result> { - ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) - } - #[inline] - pub fn set_user(&mut self, value: crate::schema::user_capnp::user::Reader<'_>) -> ::capnp::Result<()> { - ::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false) - } - #[inline] - pub fn init_user(self, ) -> crate::schema::user_capnp::user::Builder<'a> { - ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) - } - pub fn has_user(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - pub fn get_user(&self) -> crate::schema::user_capnp::user::Pipeline { - ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) - } - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 }; - pub const TYPE_ID: u64 = 0xf372_72f8_16fd_0b97; - } - } - - pub mod remove_user_results { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 0 }; - pub const TYPE_ID: u64 = 0xdfb7_a55c_6d34_06be; - } - } - - pub mod add_user_fallible_params { - #[derive(Copy, Clone)] - pub struct Owned(()); - impl <'a> ::capnp::traits::Owned<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl <'a> ::capnp::traits::OwnedStruct<'a> for Owned { type Reader = Reader<'a>; type Builder = Builder<'a>; } - impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } - - #[derive(Clone, Copy)] - pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } - - impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { - Reader { reader, } - } - } - - 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(::capnp::traits::FromStructReader::new(reader.get_struct(default)?)) - } - } - - 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<'_,> { - Reader { .. *self } - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.reader.total_size() - } - #[inline] - pub fn get_username(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) - } - pub fn has_username(&self) -> bool { - !self.reader.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_password(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { - ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) - } - pub fn has_password(&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,> { - #[inline] - fn struct_size() -> ::capnp::private::layout::StructSize { _private::STRUCT_SIZE } - } - impl <'a,> ::capnp::traits::HasTypeId for Builder<'a,> { - #[inline] - fn type_id() -> u64 { _private::TYPE_ID } - } - impl <'a,> ::capnp::traits::FromStructBuilder<'a> for Builder<'a,> { - fn new(builder: ::capnp::private::layout::StructBuilder<'a>) -> Builder<'a, > { - Builder { builder, } - } - } - - 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) -> Builder<'a,> { - ::capnp::traits::FromStructBuilder::new(builder.init_struct(_private::STRUCT_SIZE)) - } - fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { - ::core::result::Result::Ok(::capnp::traits::FromStructBuilder::new(builder.get_struct(_private::STRUCT_SIZE, default)?)) - } - } - - impl <'a,> ::capnp::traits::SetPointerBuilder for Reader<'a,> { - fn set_pointer_builder<'b>(pointer: ::capnp::private::layout::PointerBuilder<'b>, value: Reader<'a,>, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } - } - - impl <'a,> Builder<'a,> { - pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - pub fn reborrow(&mut self) -> Builder<'_,> { - Builder { .. *self } - } - pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) - } - - pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { - self.builder.into_reader().total_size() - } - #[inline] - pub fn get_username(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_username(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(0).set_text(value); - } - #[inline] - pub fn init_username(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(0).init_text(size) - } - pub fn has_username(&self) -> bool { - !self.builder.get_pointer_field(0).is_null() - } - #[inline] - pub fn get_password(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_password(&mut self, value: ::capnp::text::Reader<'_>) { - self.builder.get_pointer_field(1).set_text(value); - } - #[inline] - pub fn init_password(self, size: u32) -> ::capnp::text::Builder<'a> { - self.builder.get_pointer_field(1).init_text(size) - } - pub fn has_password(&self) -> bool { - !self.builder.get_pointer_field(1).is_null() - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline { - Pipeline { _typeless: typeless, } - } - } - impl Pipeline { - } - mod _private { - use capnp::private::layout; - pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; - pub const TYPE_ID: u64 = 0xf5bf_a6eb_aa16_f44c; - } - } - } -} From cd052fcaf02940a9d1997fc493c41ea5de69ce32 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 19:29:03 +0200 Subject: [PATCH 10/51] Update build.rs to not output to tracked dir --- api/build.rs | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/api/build.rs b/api/build.rs index 7d87c77..8aa65bd 100644 --- a/api/build.rs +++ b/api/build.rs @@ -8,8 +8,7 @@ fn is_hidden(entry: &DirEntry) -> bool { .unwrap_or(false) } -#[cfg(not(feature = "gen_static"))] -fn main() { +fn generate_api() { println!("cargo:rerun-if-changed=schema"); let mut compile_command = ::capnpc::CompilerCommand::new(); compile_command @@ -38,34 +37,6 @@ fn main() { compile_command.run().expect("Failed to generate API code"); } -#[cfg(feature = "gen_static")] fn main() { - println!("cargo:rerun-if-changed=schema"); - let mut compile_command = ::capnpc::CompilerCommand::new(); - compile_command - .src_prefix("schema") - .output_path("src/schema") - .default_parent_module(vec!["schema".to_string()]); - - for entry in WalkDir::new("schema") - .max_depth(2) - .into_iter() - .filter_entry(|e| !is_hidden(e)) - .filter_map(Result::ok) // Filter all entries that access failed on - .filter(|e| !e.file_type().is_dir()) // Filter directories - // Filter non-schema files - .filter(|e| { - e.file_name() - .to_str() - .map(|s| s.ends_with(".capnp")) - .unwrap_or(false) - }) - { - println!("Collecting schema file {}", entry.path().display()); - compile_command.file(entry.path()); - } - - compile_command - .run() - .expect("Failed to generate extra API code"); + generate_api(); } From 0f264bed0e4ea6e75a993dcb0eab8cad5c702182 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 19:29:21 +0200 Subject: [PATCH 11/51] Update api version --- api/Cargo.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/Cargo.toml b/api/Cargo.toml index 2c0b50e..3584279 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -1,10 +1,9 @@ [package] name = "api" -version = "0.3.1" +version = "0.3.2" edition = "2021" build = "build.rs" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +publish = false [features] generated = [] @@ -17,4 +16,4 @@ capnpc = "0.14.4" [build-dependencies] capnpc = "0.14.4" # Used in build.rs to iterate over all files in schema/ -walkdir = "2.3.2" +walkdir = "2.3.2" \ No newline at end of file From 360d6bfcedb0fa55bd371a8c6883901c2441d1b8 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 19:34:48 +0200 Subject: [PATCH 12/51] Update api dependency in Cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 87b54fc..42b1dfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,7 +72,7 @@ checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" [[package]] name = "api" -version = "0.3.1" +version = "0.3.2" dependencies = [ "capnp", "capnpc", From 50b4394cfdf5d330b4cfa7a2ae6a87f73dd0266a Mon Sep 17 00:00:00 2001 From: Kai Jan Kriegel Date: Tue, 24 May 2022 23:41:42 +0200 Subject: [PATCH 13/51] update fabfire desfire appid --- bffhd/authentication/fabfire/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bffhd/authentication/fabfire/server.rs b/bffhd/authentication/fabfire/server.rs index c9c45f2..636850c 100644 --- a/bffhd/authentication/fabfire/server.rs +++ b/bffhd/authentication/fabfire/server.rs @@ -160,7 +160,7 @@ impl FabFire { card_info: None, key_info: None, auth_info: None, - app_id: 1, + app_id: 0x464142, local_urn: "urn:fabaccess:lab:innovisionlab".to_string(), desfire: Desfire { card: None, From 7861568ca1e3e52ccdfd861f518e342cf7c2a767 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 31 May 2022 11:54:46 +0200 Subject: [PATCH 14/51] Cross-compilation docs --- .cargo/config.toml | 2 -- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ INSTALL.md | 13 ++++++++++--- 3 files changed, 47 insertions(+), 5 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index d5135e9..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -rustflags = ["-C", "target-cpu=native"] \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5495986..ffa76e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,6 +75,43 @@ When you want feedback on your current progress or are ready to have it merged u request. Don't worry we don't bite! ^^ +# Development Setup + +## Cross-compilation + +If you want to cross-compile you need both a C-toolchain for your target +and install the Rust stdlib for said target. + +As an example for the target `aarch64-unknown-linux-gnu` (64-bit ARMv8 +running Linux with the glibc, e.g. a Raspberry Pi 3 or later with a 64-bit +Debian Linux installation): + +1. Install C-toolchain using your distro package manager: + - On Archlinux: `pacman -S aarch64-unknown-linux-gnu-gcc` +2. Install the Rust stdlib: + - using rustup: `rustup target add aarch64-unknown-linux-gnu` +3. Configure your cargo config: + +### Configuring cargo + +You need to tell Cargo to use your C-toolchain. For this you need to have +a block in [your cargo config](https://doc.rust-lang.org/cargo/reference/config.html) setting at +least the paths to the gcc as `linker` and ar as `ar`: + +```toml +[target.aarch64-unknown-linux-gnu] +# You must set the gcc as linker since a lot of magic must happen here. +linker = "aarch64-linux-gnu-gcc" +ar = "aarch64-linux-gnu-ar" +``` + +To actually compile for the given triple you need to call `cargo build` +with the `--target` flag: + +``` +$ cargo build --release --target=aarch64-unknown-linux-gnu +``` + ## Tests Sadly, still very much `// TODO:`. We're working on it! :/ diff --git a/INSTALL.md b/INSTALL.md index 0be015f..bab36ef 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,4 +1,4 @@ -## Installation +# Installation Currently there are no distribution packages available. However installation is reasonably straight-forward, since Diflouroborane compiles into a single @@ -7,7 +7,7 @@ mostly static binary with few dependencies. At the moment only Linux is supported. If you managed to compile Diflouroborane please open an issue outlining your steps or add a merge request expanding this part. Thanks! -### Requirements +## Requirements General requirements; scroll down for distribution-specific instructions @@ -24,7 +24,7 @@ General requirements; scroll down for distribution-specific instructions $ pacman -S gsasl rust capnproto ``` -### Compiling from source +## Compiling from source Diflouroborane uses Cargo, so compilation boils down to: @@ -33,3 +33,10 @@ $ cargo build --release ``` The compiled binary can then be found in `./target/release/diflouroborane` + +### Cross-compiling + +If you need to compile for a different CPU target than your own (e.g. you want +to use BFFH on a raspberry pi but compile on your desktop PC), you need to +setup a cross-compilation toolchain and configure your Cargo correctly. +[The `CONTRIBUTING.md` has a section on how to setup a cross-compilation system.](CONTRIBUTING.md#cross-compilation) From e7828cd7f5ba65d25e3e96e362adc60adc81039f Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 31 May 2022 12:19:58 +0200 Subject: [PATCH 15/51] Add note to CONTRIBUTING about user cargo config --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffa76e6..9836afd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,7 +95,7 @@ Debian Linux installation): ### Configuring cargo You need to tell Cargo to use your C-toolchain. For this you need to have -a block in [your cargo config](https://doc.rust-lang.org/cargo/reference/config.html) setting at +a block in [your user cargo config](https://doc.rust-lang.org/cargo/reference/config.html) setting at least the paths to the gcc as `linker` and ar as `ar`: ```toml @@ -105,6 +105,10 @@ linker = "aarch64-linux-gnu-gcc" ar = "aarch64-linux-gnu-ar" ``` +This block should be added to your **user** cargo config (usually +`~/.cargo/config.toml`), since these values can differ between distros and +users. + To actually compile for the given triple you need to call `cargo build` with the `--target` flag: From 84a4e9791e16b7a040f88d152b4ff20d20d1f39e Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 31 May 2022 13:08:14 +0200 Subject: [PATCH 16/51] INSTALL docs on running the bin --- INSTALL.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index bab36ef..3b667d0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -32,7 +32,7 @@ Diflouroborane uses Cargo, so compilation boils down to: $ cargo build --release ``` -The compiled binary can then be found in `./target/release/diflouroborane` +The compiled binary can then be found in `./target/release/bffhd` ### Cross-compiling @@ -40,3 +40,14 @@ If you need to compile for a different CPU target than your own (e.g. you want to use BFFH on a raspberry pi but compile on your desktop PC), you need to setup a cross-compilation toolchain and configure your Cargo correctly. [The `CONTRIBUTING.md` has a section on how to setup a cross-compilation system.](CONTRIBUTING.md#cross-compilation) + +# Running bffhd + +The server can be ran either using `cargo`, which will also compile the binary if necessary, or directly. + +When running using `cargo` you need to pass arguments to bffh after a `--`, so +e.g. `cargo run --release -- --help` or `cargo run --release -- -c examples/bffh.toml`. + +When running directly the `bffhd` binary can be copied anywhere. + +A list of arguments for the server is found in the help, so `bffhd --help` or `cargo run --release -- --help`. From a43c38c118c6b705c757b47a88c0a573ebd80682 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 31 May 2022 13:11:48 +0200 Subject: [PATCH 17/51] Better errors when the db directory is missing --- bffhd/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 8aeecc8..33e4549 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -84,7 +84,8 @@ impl Diflouroborane { let executor = Executor::new(); - let env = StateDB::open_env(&config.db_path)?; + let env = StateDB::open_env(&config.db_path) + .context("Failed to create state DB env. Does the parent directory for `db_path` exist?")?; let statedb = StateDB::create_with_env(env.clone()).context("Failed to open state DB file")?; From 17fd08b7e57a9267472046286dc60f45e444fb4b Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 31 May 2022 13:45:51 +0200 Subject: [PATCH 18/51] More trace output of role checking --- bffhd/authorization/roles.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bffhd/authorization/roles.rs b/bffhd/authorization/roles.rs index 25f924b..9dc76bf 100644 --- a/bffhd/authorization/roles.rs +++ b/bffhd/authorization/roles.rs @@ -67,17 +67,20 @@ impl Roles { role_id: &String, perm: &Permission, ) -> bool { + let _guard = tracing::debug_span!("tally", %role_id, perm=perm.as_str()); if let Some(role) = self.get(role_id) { // Only check and tally parents of a role at the role itself if it's the first time we // see it if !roles.contains(role_id) { for perm_rule in role.permissions.iter() { if perm_rule.match_perm(perm) { + tracing::debug!("Permission granted by direct role"); return true; } } for parent in role.parents.iter() { if self.permitted_tally(roles, parent, perm) { + tracing::debug!(%parent, "Permission granted by parent role"); return true; } } @@ -86,10 +89,13 @@ impl Roles { } } + tracing::trace!(%role_id, "Permission not granted by role"); false } pub fn is_permitted(&self, user: &UserData, perm: impl AsRef) -> bool { + let perm = perm.as_ref(); + tracing::debug!(perm=perm.as_str(), "Checking permission"); let mut seen = HashSet::new(); for role_id in user.roles.iter() { if self.permitted_tally(&mut seen, role_id, perm.as_ref()) { From 5f2214abe9aa9d4d3a7c7974b933b1f8c4a5c061 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 2 Jun 2022 17:46:26 +0200 Subject: [PATCH 19/51] Switch out anyhow for miette --- Cargo.lock | 190 +++++++++++++++++++++++++++++++++-- Cargo.toml | 4 +- bffhd/actors/mod.rs | 11 +- bffhd/authentication/mod.rs | 10 +- bffhd/authorization/roles.rs | 2 +- bffhd/capnp/mod.rs | 2 +- bffhd/db/mod.rs | 76 +++++++++++++- bffhd/db/raw.rs | 1 + bffhd/db/typed.rs | 4 +- bffhd/error.rs | 160 ++++++++++++++++++----------- bffhd/lib.rs | 26 ++--- bffhd/resources/state/db.rs | 43 ++++++-- bffhd/tls.rs | 22 ++-- bffhd/users/db.rs | 10 +- bffhd/users/mod.rs | 18 ++-- bin/bffhd/main.rs | 2 +- 16 files changed, 454 insertions(+), 127 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42b1dfa..e5717db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,6 +23,21 @@ dependencies = [ "pretty", ] +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aes" version = "0.7.5" @@ -46,6 +61,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + [[package]] name = "annotate-snippets" version = "0.9.1" @@ -64,12 +88,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "anyhow" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" - [[package]] name = "api" version = "0.3.2" @@ -275,6 +293,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.0" @@ -800,13 +833,13 @@ dependencies = [ name = "diflouroborane" version = "0.4.2" dependencies = [ - "anyhow", "api", "async-channel", "async-compat", "async-net", "async-oneshot", "async-trait", + "backtrace", "capnp", "capnp-rpc", "chrono", @@ -826,6 +859,7 @@ dependencies = [ "libc", "linkme", "lmdb-rkv", + "miette", "nix", "once_cell", "pin-utils", @@ -847,6 +881,7 @@ dependencies = [ "signal-hook", "signal-hook-async-std", "tempfile", + "thiserror", "toml", "tracing", "tracing-futures", @@ -1195,6 +1230,12 @@ dependencies = [ "syn", ] +[[package]] +name = "gimli" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" + [[package]] name = "git2" version = "0.14.4" @@ -1328,6 +1369,12 @@ dependencies = [ "syn", ] +[[package]] +name = "is_ci" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" + [[package]] name = "is_debug" version = "1.0.1" @@ -1543,6 +1590,46 @@ dependencies = [ "autocfg", ] +[[package]] +name = "miette" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" +dependencies = [ + "atty", + "backtrace", + "miette-derive", + "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap 0.15.0", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "miniz_oxide" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.1" @@ -1639,6 +1726,15 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.28.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.10.0" @@ -1678,6 +1774,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "owo-colors" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b" + [[package]] name = "parking" version = "2.0.0" @@ -1973,6 +2075,8 @@ version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ + "aho-corasick", + "memchr", "regex-syntax", ] @@ -2134,6 +2238,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + [[package]] name = "rustc_version" version = "0.4.0" @@ -2429,6 +2539,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +[[package]] +name = "smawk" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" + [[package]] name = "socket2" version = "0.4.4" @@ -2473,6 +2589,34 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "supports-color" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4872ced36b91d47bae8a214a683fe54e7078875b399dfa251df346c9b547d1f9" +dependencies = [ + "atty", + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406" +dependencies = [ + "atty", +] + +[[package]] +name = "supports-unicode" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2" +dependencies = [ + "atty", +] + [[package]] name = "syn" version = "1.0.88" @@ -2507,6 +2651,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -2521,21 +2675,26 @@ name = "textwrap" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", @@ -2773,6 +2932,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +[[package]] +name = "unicode-linebreak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f" +dependencies = [ + "regex", +] + [[package]] name = "unicode-normalization" version = "0.1.19" diff --git a/Cargo.toml b/Cargo.toml index d50d460..86e0029 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,9 @@ pin-utils = "0.1.0" futures-util = "0.3" futures-lite = "1.12.0" async-net = "1.6.1" -anyhow = "1.0.56" +backtrace = "0.3.65" +miette = { version = "4.7.1", features = ["fancy"] } +thiserror = "1.0.31" toml = "0.5.8" # Well-known paths/dirs for e.g. cache diff --git a/bffhd/actors/mod.rs b/bffhd/actors/mod.rs index 701cd70..d91da4a 100644 --- a/bffhd/actors/mod.rs +++ b/bffhd/actors/mod.rs @@ -12,6 +12,7 @@ use std::future::Future; use std::pin::Pin; +use miette::IntoDiagnostic; use std::task::{Context, Poll}; use std::time::Duration; @@ -110,11 +111,11 @@ static ROOT_CERTS: Lazy = Lazy::new(|| { store }); -pub fn load(executor: Executor, config: &Config, resources: ResourcesHandle) -> anyhow::Result<()> { +pub fn load(executor: Executor, config: &Config, resources: ResourcesHandle) -> miette::Result<()> { let span = tracing::info_span!("loading actors"); let _guard = span; - let mqtt_url = Url::parse(config.mqtt_url.as_str())?; + let mqtt_url = Url::parse(config.mqtt_url.as_str()).into_diagnostic()?; let (transport, default_port) = match mqtt_url.scheme() { "mqtts" | "ssl" => ( rumqttc::Transport::tls_with_config( @@ -131,12 +132,12 @@ pub fn load(executor: Executor, config: &Config, resources: ResourcesHandle) -> scheme => { tracing::error!(%scheme, "MQTT url uses invalid scheme"); - anyhow::bail!("invalid config"); + miette::bail!("invalid config"); } }; let host = mqtt_url.host_str().ok_or_else(|| { tracing::error!("MQTT url must contain a hostname"); - anyhow::anyhow!("invalid config") + miette::miette!("invalid config") })?; let port = mqtt_url.port().unwrap_or(default_port); @@ -167,7 +168,7 @@ pub fn load(executor: Executor, config: &Config, resources: ResourcesHandle) -> } Err(error) => { tracing::error!(?error, "MQTT connection failed"); - anyhow::bail!("mqtt connection failed") + miette::bail!("mqtt connection failed") } } diff --git a/bffhd/authentication/mod.rs b/bffhd/authentication/mod.rs index da32036..f486cf1 100644 --- a/bffhd/authentication/mod.rs +++ b/bffhd/authentication/mod.rs @@ -1,4 +1,5 @@ use crate::users::Users; +use miette::{Context, IntoDiagnostic}; use rsasl::error::SessionError; use rsasl::mechname::Mechname; use rsasl::property::{AuthId, Password}; @@ -127,8 +128,13 @@ impl AuthenticationHandle { } } - pub fn start(&self, mechanism: &Mechname) -> anyhow::Result { - Ok(self.inner.rsasl.server_start(mechanism)?) + pub fn start(&self, mechanism: &Mechname) -> miette::Result { + Ok(self + .inner + .rsasl + .server_start(mechanism) + .into_diagnostic() + .wrap_err("Failed to start a SASL authentication with the given mechanism")?) } pub fn list_available_mechs(&self) -> impl IntoIterator { diff --git a/bffhd/authorization/roles.rs b/bffhd/authorization/roles.rs index 9dc76bf..0885eca 100644 --- a/bffhd/authorization/roles.rs +++ b/bffhd/authorization/roles.rs @@ -95,7 +95,7 @@ impl Roles { pub fn is_permitted(&self, user: &UserData, perm: impl AsRef) -> bool { let perm = perm.as_ref(); - tracing::debug!(perm=perm.as_str(), "Checking permission"); + tracing::debug!(perm = perm.as_str(), "Checking permission"); let mut seen = HashSet::new(); for role_id in user.roles.iter() { if self.permitted_tally(&mut seen, role_id, perm.as_ref()) { diff --git a/bffhd/capnp/mod.rs b/bffhd/capnp/mod.rs index 465a10f..d19ac28 100644 --- a/bffhd/capnp/mod.rs +++ b/bffhd/capnp/mod.rs @@ -60,7 +60,7 @@ impl APIServer { acceptor: TlsAcceptor, sessionmanager: SessionManager, authentication: AuthenticationHandle, - ) -> anyhow::Result { + ) -> miette::Result { let span = tracing::info_span!("binding API listen sockets"); let _guard = span.enter(); diff --git a/bffhd/db/mod.rs b/bffhd/db/mod.rs index bc43071..36a5690 100644 --- a/bffhd/db/mod.rs +++ b/bffhd/db/mod.rs @@ -1,7 +1,81 @@ +use thiserror::Error; + mod raw; + +use miette::{Diagnostic, LabeledSpan, Severity, SourceCode}; pub use raw::RawDB; +use std::fmt::{Debug, Display, Formatter}; mod typed; pub use typed::{Adapter, AlignedAdapter, ArchivedValue, DB}; -pub type Error = lmdb::Error; +pub type ErrorO = lmdb::Error; + +pub type Result = std::result::Result; + +#[repr(transparent)] +#[derive(Debug, Error)] +#[error(transparent)] +pub struct Error(#[from] lmdb::Error); + +impl Diagnostic for Error { + fn code<'a>(&'a self) -> Option> { + Some(Box::new(match self.0 { + lmdb::Error::KeyExist => "bffh::db::raw::key_exists".to_string(), + lmdb::Error::NotFound => "bffh::db::raw::not_found".to_string(), + lmdb::Error::PageNotFound => "bffh::db::raw::page_not_found".to_string(), + lmdb::Error::Corrupted => "bffh::db::raw::corrupted".to_string(), + lmdb::Error::Panic => "bffh::db::raw::panic".to_string(), + lmdb::Error::VersionMismatch => "bffh::db::raw::version_mismatch".to_string(), + lmdb::Error::Invalid => "bffh::db::raw::invalid".to_string(), + lmdb::Error::MapFull => "bffh::db::raw::map_full".to_string(), + lmdb::Error::DbsFull => "bffh::db::raw::dbs_full".to_string(), + lmdb::Error::ReadersFull => "bffh::db::raw::readers_full".to_string(), + lmdb::Error::TlsFull => "bffh::db::raw::tls_full".to_string(), + lmdb::Error::TxnFull => "bffh::db::raw::txn_full".to_string(), + lmdb::Error::CursorFull => "bffh::db::raw::cursor_full".to_string(), + lmdb::Error::PageFull => "bffh::db::raw::page_full".to_string(), + lmdb::Error::MapResized => "bffh::db::raw::map_resized".to_string(), + lmdb::Error::Incompatible => "bffh::db::raw::incompatible".to_string(), + lmdb::Error::BadRslot => "bffh::db::raw::bad_rslot".to_string(), + lmdb::Error::BadTxn => "bffh::db::raw::bad_txn".to_string(), + lmdb::Error::BadValSize => "bffh::db::raw::bad_val_size".to_string(), + lmdb::Error::BadDbi => "bffh::db::raw::bad_dbi".to_string(), + lmdb::Error::Other(n) => format!("bffh::db::raw::e{}", n), + })) + } + + fn severity(&self) -> Option { + Some(Severity::Error) + } + + fn help<'a>(&'a self) -> Option> { + match self.0 { + lmdb::Error::KeyExist => Some(Box::new("The provided key already exists in the database")), + lmdb::Error::NotFound => Some(Box::new("The requested key was not found in the database")), + lmdb::Error::PageNotFound => Some(Box::new("The requested page was not found. This usually indicates corruption.")), + lmdb::Error::Corrupted => None, + lmdb::Error::Panic => None, + lmdb::Error::VersionMismatch => None, + lmdb::Error::Invalid => None, + lmdb::Error::MapFull => None, + lmdb::Error::DbsFull => None, + lmdb::Error::ReadersFull => None, + lmdb::Error::TlsFull => None, + lmdb::Error::TxnFull => None, + lmdb::Error::CursorFull => None, + lmdb::Error::PageFull => None, + lmdb::Error::MapResized => None, + lmdb::Error::Incompatible => None, + lmdb::Error::BadRslot => Some(Box::new("This usually indicates that the operation can't complete because an incompatible transaction is still open.")), + lmdb::Error::BadTxn => None, + lmdb::Error::BadValSize => None, + lmdb::Error::BadDbi => None, + lmdb::Error::Other(_) => None, + } + } + + fn url<'a>(&'a self) -> Option> { + None + } +} diff --git a/bffhd/db/raw.rs b/bffhd/db/raw.rs index fc24f40..9ec84dd 100644 --- a/bffhd/db/raw.rs +++ b/bffhd/db/raw.rs @@ -1,3 +1,4 @@ +use super::Result; use lmdb::{DatabaseFlags, Environment, RwTransaction, Transaction, WriteFlags}; #[derive(Debug, Clone)] diff --git a/bffhd/db/typed.rs b/bffhd/db/typed.rs index 96c8ed0..6de8a7c 100644 --- a/bffhd/db/typed.rs +++ b/bffhd/db/typed.rs @@ -142,11 +142,11 @@ impl DB { } pub fn del(&self, txn: &mut RwTransaction, key: &impl AsRef<[u8]>) -> Result<(), db::Error> { - self.db.del::<_, &[u8]>(txn, key, None) + Ok(self.db.del::<_, &[u8]>(txn, key, None)?) } pub fn clear(&self, txn: &mut RwTransaction) -> Result<(), db::Error> { - self.db.clear(txn) + Ok(self.db.clear(txn)?) } pub fn get_all<'txn, T: Transaction>( diff --git a/bffhd/error.rs b/bffhd/error.rs index 747ebcc..61db8a2 100644 --- a/bffhd/error.rs +++ b/bffhd/error.rs @@ -1,74 +1,116 @@ +use thiserror::Error; + use crate::db; use rsasl::error::SessionError; +use std::any::TypeId; +use std::error::Error as StdError; use std::fmt; +use std::fmt::Display; use std::io; -type DBError = db::Error; +use crate::resources::state::db::StateDBError; +use backtrace::{Backtrace, BacktraceFmt, PrintFmt}; +use miette::{Diagnostic, LabeledSpan, Severity, SourceCode}; #[derive(Debug)] +pub struct TracedError { + pub inner: E, + pub backtrace: Backtrace, +} + +impl fmt::Display for TracedError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "Error: {}", self.inner)?; + + let cwd = std::env::current_dir(); + let mut print_path = + move |fmt: &mut fmt::Formatter<'_>, path: backtrace::BytesOrWideString<'_>| { + let path = path.into_path_buf(); + if let Ok(cwd) = &cwd { + if let Ok(suffix) = path.strip_prefix(cwd) { + return fmt::Display::fmt(&suffix.display(), fmt); + } + } + fmt::Display::fmt(&path.display(), fmt) + }; + let mut bf = BacktraceFmt::new(f, PrintFmt::Short, &mut print_path); + bf.add_context()?; + + Ok(()) + } +} + +impl StdError for TracedError { + fn source(&self) -> Option<&(dyn StdError + 'static)> { + self.inner.source() + } +} + +impl Diagnostic for TracedError { + #[inline(always)] + fn code<'a>(&'a self) -> Option> { + self.inner.code() + } + + #[inline(always)] + fn severity(&self) -> Option { + self.inner.severity() + } + + #[inline(always)] + fn help<'a>(&'a self) -> Option> { + self.inner.help() + } + + #[inline(always)] + fn url<'a>(&'a self) -> Option> { + self.inner.url() + } + + #[inline(always)] + fn source_code(&self) -> Option<&dyn SourceCode> { + self.inner.source_code() + } + + #[inline(always)] + fn labels(&self) -> Option + '_>> { + self.inner.labels() + } + + #[inline(always)] + fn related<'a>(&'a self) -> Option + 'a>> { + self.inner.related() + } + + #[inline(always)] + fn diagnostic_source(&self) -> Option<&dyn Diagnostic> { + self.inner.diagnostic_source() + } +} + +#[derive(Debug, Error, Diagnostic)] /// Shared error type -pub enum Error { +pub enum BffhError { + #[error("SASL error: {0:?}")] SASL(SessionError), - IO(io::Error), - Boxed(Box), - Capnp(capnp::Error), - DB(DBError), + #[error("IO error: {0}")] + IO(#[from] io::Error), + #[error("IO error: {0}")] + Boxed(#[from] Box), + #[error("IO error: {0}")] + Capnp(#[from] capnp::Error), + #[error("IO error: {0}")] + DB(#[from] db::Error), + #[error("You do not have the permission required to do that.")] Denied, + #[error("State DB operation failed")] + StateDB(#[from] StateDBError), } -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Error::SASL(e) => { - write!(f, "SASL Error: {}", e) - } - Error::IO(e) => { - write!(f, "IO Error: {}", e) - } - Error::Boxed(e) => { - write!(f, "{}", e) - } - Error::Capnp(e) => { - write!(f, "Cap'n Proto Error: {}", e) - } - Error::DB(e) => { - write!(f, "DB Error: {:?}", e) - } - Error::Denied => { - write!(f, "You do not have the permission required to do that.") - } - } +impl From for BffhError { + fn from(e: SessionError) -> Self { + Self::SASL(e) } } -impl From for Error { - fn from(e: SessionError) -> Error { - Error::SASL(e) - } -} - -impl From for Error { - fn from(e: io::Error) -> Error { - Error::IO(e) - } -} - -impl From> for Error { - fn from(e: Box) -> Error { - Error::Boxed(e) - } -} - -impl From for Error { - fn from(e: capnp::Error) -> Error { - Error::Capnp(e) - } -} - -impl From for Error { - fn from(e: DBError) -> Error { - Error::DB(e) - } -} - -pub type Result = std::result::Result; +pub type Result = std::result::Result; diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 33e4549..3c34192 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -42,9 +42,8 @@ mod tls; use std::sync::Arc; -use anyhow::Context; - use futures_util::StreamExt; +use miette::{Context, IntoDiagnostic, Report}; use once_cell::sync::OnceCell; use crate::audit::AuditLog; @@ -75,7 +74,7 @@ pub struct Diflouroborane { pub static RESOURCES: OnceCell = OnceCell::new(); impl Diflouroborane { - pub fn new(config: Config) -> anyhow::Result { + pub fn new(config: Config) -> miette::Result { logging::init(&config.logging); tracing::info!(version = env::VERSION, "Starting BFFH"); @@ -84,15 +83,16 @@ impl Diflouroborane { let executor = Executor::new(); - let env = StateDB::open_env(&config.db_path) - .context("Failed to create state DB env. Does the parent directory for `db_path` exist?")?; - let statedb = - StateDB::create_with_env(env.clone()).context("Failed to open state DB file")?; + let env = StateDB::open_env(&config.db_path)?; - let users = Users::new(env.clone()).context("Failed to open users DB file")?; + let statedb = StateDB::create_with_env(env.clone())?; + + let users = Users::new(env.clone())?; let roles = Roles::new(config.roles.clone()); - let _audit_log = AuditLog::new(&config).context("Failed to initialize audit log")?; + let _audit_log = AuditLog::new(&config) + .into_diagnostic() + .wrap_err("Failed to initialize audit log")?; let resources = ResourcesHandle::new(config.machines.iter().map(|(id, desc)| { Resource::new(Arc::new(resources::Inner::new( @@ -113,13 +113,15 @@ impl Diflouroborane { }) } - pub fn run(&mut self) -> anyhow::Result<()> { + pub fn run(&mut self) -> miette::Result<()> { let mut signals = signal_hook_async_std::Signals::new(&[SIGINT, SIGQUIT, SIGTERM]) - .context("Failed to construct signal handler")?; + .into_diagnostic() + .wrap_err("Failed to construct signal handler")?; actors::load(self.executor.clone(), &self.config, self.resources.clone())?; - let tlsconfig = TlsConfig::new(self.config.tlskeylog.as_ref(), !self.config.is_quiet())?; + let tlsconfig = TlsConfig::new(self.config.tlskeylog.as_ref(), !self.config.is_quiet()) + .into_diagnostic()?; let acceptor = tlsconfig.make_tls_acceptor(&self.config.tlsconfig)?; let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone()); diff --git a/bffhd/resources/state/db.rs b/bffhd/resources/state/db.rs index d3674c3..3abc0df 100644 --- a/bffhd/resources/state/db.rs +++ b/bffhd/resources/state/db.rs @@ -1,6 +1,12 @@ +use thiserror::Error; + use crate::db; use crate::db::{AlignedAdapter, ArchivedValue, RawDB, DB}; use lmdb::{DatabaseFlags, Environment, EnvironmentFlags, Transaction, WriteFlags}; +use miette::{Diagnostic, LabeledSpan, Severity, SourceCode}; +use std::any::TypeId; +use std::error::Error; +use std::fmt::{Debug, Display, Formatter}; use std::{path::Path, sync::Arc}; use crate::resources::state::State; @@ -11,8 +17,24 @@ pub struct StateDB { db: DB>, } +#[derive(Debug, Error, Diagnostic)] +pub enum StateDBError { + #[error("opening the state db environment failed")] + #[diagnostic( + code(bffh::db::state::open_env), + help("does the parent directory for state_db exist?") + )] + OpenEnv(#[source] db::Error), + #[error("opening the state db failed")] + #[diagnostic(code(bffh::db::state::open))] + Open(#[source] db::Error), + #[error("creating the state db failed")] + #[diagnostic(code(bffh::db::state::create))] + Create(#[source] db::Error), +} + impl StateDB { - pub fn open_env>(path: P) -> lmdb::Result> { + pub fn open_env>(path: P) -> Result, StateDBError> { Environment::new() .set_flags( EnvironmentFlags::WRITE_MAP @@ -23,6 +45,7 @@ impl StateDB { .set_max_dbs(8) .open(path.as_ref()) .map(Arc::new) + .map_err(|e| StateDBError::OpenEnv(e.into())) } fn new(env: Arc, db: RawDB) -> Self { @@ -30,30 +53,32 @@ impl StateDB { Self { env, db } } - pub fn open_with_env(env: Arc) -> lmdb::Result { - let db = unsafe { RawDB::open(&env, Some("state"))? }; + pub fn open_with_env(env: Arc) -> Result { + let db = unsafe { RawDB::open(&env, Some("state")) }; + let db = db.map_err(|e| StateDBError::Open(e.into()))?; Ok(Self::new(env, db)) } - pub fn open>(path: P) -> lmdb::Result { + pub fn open>(path: P) -> Result { let env = Self::open_env(path)?; Self::open_with_env(env) } - pub fn create_with_env(env: Arc) -> lmdb::Result { + pub fn create_with_env(env: Arc) -> Result { let flags = DatabaseFlags::empty(); - let db = unsafe { RawDB::create(&env, Some("state"), flags)? }; + let db = unsafe { RawDB::create(&env, Some("state"), flags) }; + let db = db.map_err(|e| StateDBError::Create(e.into()))?; Ok(Self::new(env, db)) } - pub fn create>(path: P) -> lmdb::Result { + pub fn create>(path: P) -> Result { let env = Self::open_env(path)?; Self::create_with_env(env) } pub fn begin_ro_txn(&self) -> Result { - self.env.begin_ro_txn() + self.env.begin_ro_txn().map_err(db::Error::from) } pub fn get(&self, key: impl AsRef<[u8]>) -> Result>, db::Error> { @@ -72,7 +97,7 @@ impl StateDB { let mut txn = self.env.begin_rw_txn()?; let flags = WriteFlags::empty(); self.db.put(&mut txn, key, val, flags)?; - txn.commit() + Ok(txn.commit()?) } } diff --git a/bffhd/tls.rs b/bffhd/tls.rs index b0d7fc7..bc327cf 100644 --- a/bffhd/tls.rs +++ b/bffhd/tls.rs @@ -6,6 +6,7 @@ use std::sync::Arc; use crate::capnp::TlsListen; use futures_rustls::TlsAcceptor; +use miette::IntoDiagnostic; use rustls::version::{TLS12, TLS13}; use rustls::{Certificate, PrivateKey, ServerConfig, SupportedCipherSuite}; use tracing::Level; @@ -74,26 +75,27 @@ impl TlsConfig { } } - pub fn make_tls_acceptor(&self, config: &TlsListen) -> anyhow::Result { + pub fn make_tls_acceptor(&self, config: &TlsListen) -> miette::Result { let span = tracing::debug_span!("tls"); let _guard = span.enter(); tracing::debug!(path = %config.certfile.as_path().display(), "reading certificates"); - let mut certfp = BufReader::new(File::open(config.certfile.as_path())?); - let certs = rustls_pemfile::certs(&mut certfp)? + let mut certfp = BufReader::new(File::open(config.certfile.as_path()).into_diagnostic()?); + let certs = rustls_pemfile::certs(&mut certfp) + .into_diagnostic()? .into_iter() .map(Certificate) .collect(); tracing::debug!(path = %config.keyfile.as_path().display(), "reading private key"); - let mut keyfp = BufReader::new(File::open(config.keyfile.as_path())?); - let key = match rustls_pemfile::read_one(&mut keyfp)? { + let mut keyfp = BufReader::new(File::open(config.keyfile.as_path()).into_diagnostic()?); + let key = match rustls_pemfile::read_one(&mut keyfp).into_diagnostic()? { Some(rustls_pemfile::Item::PKCS8Key(key) | rustls_pemfile::Item::RSAKey(key)) => { PrivateKey(key) } _ => { tracing::error!("private key file invalid"); - anyhow::bail!("private key file must contain a PEM-encoded private key") + miette::bail!("private key file must contain a PEM-encoded private key") } }; @@ -105,15 +107,17 @@ impl TlsConfig { match min.as_str() { "tls12" => tls_builder.with_protocol_versions(&[&TLS12]), "tls13" => tls_builder.with_protocol_versions(&[&TLS13]), - x => anyhow::bail!("TLS version {} is invalid", x), + x => miette::bail!("TLS version {} is invalid", x), } } else { tls_builder.with_safe_default_protocol_versions() - }?; + } + .into_diagnostic()?; let mut tls_config = tls_builder .with_no_client_auth() - .with_single_cert(certs, key)?; + .with_single_cert(certs, key) + .into_diagnostic()?; if let Some(keylog) = &self.keylog { tls_config.key_log = keylog.clone(); diff --git a/bffhd/users/db.rs b/bffhd/users/db.rs index c1da213..ffd9816 100644 --- a/bffhd/users/db.rs +++ b/bffhd/users/db.rs @@ -2,7 +2,7 @@ use lmdb::{DatabaseFlags, Environment, RwTransaction, Transaction, WriteFlags}; use rkyv::Infallible; use std::collections::HashMap; -use anyhow::Context; +use miette::{Context, IntoDiagnostic}; use std::sync::Arc; use crate::db; @@ -28,9 +28,11 @@ pub struct User { } impl User { - pub fn check_password(&self, pwd: &[u8]) -> anyhow::Result { + pub fn check_password(&self, pwd: &[u8]) -> miette::Result { if let Some(ref encoded) = self.userdata.passwd { - argon2::verify_encoded(encoded, pwd).context("Stored password is an invalid string") + argon2::verify_encoded(encoded, pwd) + .into_diagnostic() + .wrap_err("Stored password is an invalid string") } else { Ok(false) } @@ -109,7 +111,7 @@ impl UserDB { // TODO: Make an userdb-specific Transaction newtype to make this safe pub unsafe fn get_rw_txn(&self) -> Result { // The returned transaction is only valid for *this* environment. - self.env.begin_rw_txn() + Ok(self.env.begin_rw_txn()?) } pub unsafe fn new(env: Arc, db: RawDB) -> Self { diff --git a/bffhd/users/mod.rs b/bffhd/users/mod.rs index d938426..98d4b54 100644 --- a/bffhd/users/mod.rs +++ b/bffhd/users/mod.rs @@ -1,10 +1,10 @@ -use anyhow::Context; use lmdb::{Environment, Transaction}; use once_cell::sync::OnceCell; use rkyv::{Archive, Deserialize, Infallible, Serialize}; use std::collections::HashMap; use std::fmt::{Display, Formatter, Write}; +use miette::{Context, IntoDiagnostic}; use std::path::Path; use std::sync::Arc; @@ -65,7 +65,7 @@ pub struct Users { } impl Users { - pub fn new(env: Arc) -> anyhow::Result { + pub fn new(env: Arc) -> miette::Result { let span = tracing::debug_span!("users", ?env, "Creating Users handle"); let _guard = span.enter(); @@ -74,7 +74,7 @@ impl Users { tracing::debug!("Global resource not yet initialized, initializing…"); unsafe { UserDB::create(env) } }) - .context("Failed to open userdb")?; + .wrap_err("Failed to open userdb")?; Ok(Self { userdb }) } @@ -90,19 +90,19 @@ impl Users { }) } - pub fn put_user(&self, uid: &str, user: &db::User) -> Result<(), lmdb::Error> { + pub fn put_user(&self, uid: &str, user: &db::User) -> Result<(), crate::db::Error> { tracing::trace!(uid, ?user, "Updating user"); self.userdb.put(uid, user) } - pub fn del_user(&self, uid: &str) -> Result<(), lmdb::Error> { + pub fn del_user(&self, uid: &str) -> Result<(), crate::db::Error> { tracing::trace!(uid, "Deleting user"); self.userdb.delete(uid) } - pub fn load_file>(&self, path: P) -> anyhow::Result<()> { - let f = std::fs::read(path)?; - let map: HashMap = toml::from_slice(&f)?; + pub fn load_file>(&self, path: P) -> miette::Result<()> { + let f = std::fs::read(path).into_diagnostic()?; + let map: HashMap = toml::from_slice(&f).into_diagnostic()?; let mut txn = unsafe { self.userdb.get_rw_txn()? }; @@ -132,7 +132,7 @@ impl Users { } } - txn.commit()?; + txn.commit().map_err(crate::db::Error::from)?; Ok(()) } } diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 6c4dd02..27b9146 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -6,7 +6,7 @@ use std::{env, io, io::Write, path::PathBuf}; use nix::NixPath; -fn main() -> anyhow::Result<()> { +fn main() -> miette::Result<()> { // Argument parsing // values for the name, description and version are pulled from `Cargo.toml`. let matches = Command::new(clap::crate_name!()) From 6d8d1384d94ef421750b6f820c7962798dd8c7a4 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 7 Jun 2022 14:05:46 +0200 Subject: [PATCH 20/51] Reimplement the dummy initiator --- Cargo.lock | 5 +- Cargo.toml | 1 + bffhd/initiators/dummy.rs | 118 +++++++++++++++++ bffhd/initiators/mod.rs | 266 ++++++++++++++++++-------------------- bffhd/lib.rs | 14 +- bffhd/resources/mod.rs | 3 +- 6 files changed, 262 insertions(+), 145 deletions(-) create mode 100644 bffhd/initiators/dummy.rs diff --git a/Cargo.lock b/Cargo.lock index e5717db..d8cc667 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "async-io" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" dependencies = [ "concurrent-queue", "futures-lite", @@ -836,6 +836,7 @@ dependencies = [ "api", "async-channel", "async-compat", + "async-io", "async-net", "async-oneshot", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 86e0029..a082ad7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ pin-utils = "0.1.0" futures-util = "0.3" futures-lite = "1.12.0" async-net = "1.6.1" +async-io = "1.7.0" backtrace = "0.3.65" miette = { version = "4.7.1", features = ["fancy"] } thiserror = "1.0.31" diff --git a/bffhd/initiators/dummy.rs b/bffhd/initiators/dummy.rs new file mode 100644 index 0000000..1fd2a3e --- /dev/null +++ b/bffhd/initiators/dummy.rs @@ -0,0 +1,118 @@ +use miette::{miette, Diagnostic}; +use thiserror::Error; + +use super::Initiator; +use crate::initiators::InitiatorCallbacks; +use crate::resources::modules::fabaccess::Status; +use crate::session::SessionHandle; +use crate::users::UserRef; +use async_io::Timer; +use futures_util::future::BoxFuture; +use futures_util::ready; +use lmdb::Stat; +use std::collections::HashMap; +use std::future::Future; +use std::mem; +use std::pin::Pin; +use std::task::{Context, Poll}; +use std::time::{Duration, Instant}; + +pub struct Dummy { + callbacks: InitiatorCallbacks, + session: SessionHandle, + state: DummyState, +} + +enum DummyState { + Empty, + Sleeping(Timer, Option), + Updating(BoxFuture<'static, Status>), +} + +impl Dummy { + fn timer() -> Timer { + Timer::after(Duration::from_secs(2)) + } + + fn flip(&self, status: Status) -> BoxFuture<'static, Status> { + let session = self.session.clone(); + let mut callbacks = self.callbacks.clone(); + Box::pin(async move { + let next = match &status { + Status::Free => Status::InUse(session.get_user_ref()), + Status::InUse(_) => Status::Free, + _ => Status::Free, + }; + callbacks.try_update(session, status).await; + + next + }) + } +} + +#[derive(Debug, Error, Diagnostic)] +pub enum DummyError {} + +impl Future for Dummy { + type Output = (); + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + let span = tracing::debug_span!("Dummy initiator poll"); + let _guard = span.enter(); + tracing::trace!("polling Dummy initiator"); + loop { + match &mut self.state { + DummyState::Empty => { + tracing::trace!("Dummy initiator is empty, initializing…"); + mem::replace( + &mut self.state, + DummyState::Sleeping(Self::timer(), Some(Status::Free)), + ); + } + DummyState::Sleeping(timer, next) => { + tracing::trace!("Sleep timer exists, polling it."); + + let _: Instant = ready!(Pin::new(timer).poll(cx)); + + tracing::trace!("Timer has fired, poking out an update!"); + + let status = next.take().unwrap(); + let f = self.flip(status); + mem::replace(&mut self.state, DummyState::Updating(f)); + } + DummyState::Updating(f) => { + tracing::trace!("Update future exists, polling it ."); + + let next = ready!(Pin::new(f).poll(cx)); + + tracing::trace!("Update future completed, sleeping!"); + + mem::replace( + &mut self.state, + DummyState::Sleeping(Self::timer(), Some(next)), + ); + } + } + } + } +} + +impl Initiator for Dummy { + fn new(params: &HashMap, callbacks: InitiatorCallbacks) -> miette::Result + where + Self: Sized, + { + let uid = params + .get("uid") + .ok_or_else(|| miette!("Dummy initiator configured without an UID"))?; + let session = callbacks + .open_session(uid) + .ok_or_else(|| miette!("The configured user for the dummy initiator does not exist"))?; + + Ok(Self { + callbacks, + session, + state: DummyState::Empty, + }) + } +} diff --git a/bffhd/initiators/mod.rs b/bffhd/initiators/mod.rs index 59d58e7..7597cd8 100644 --- a/bffhd/initiators/mod.rs +++ b/bffhd/initiators/mod.rs @@ -1,161 +1,149 @@ +use crate::initiators::dummy::Dummy; +use crate::resources::modules::fabaccess::Status; +use crate::session::SessionHandle; +use crate::{ + AuthenticationHandle, Config, MachineState, Resource, ResourcesHandle, SessionManager, +}; +use async_compat::CompatExt; +use executor::prelude::Executor; +use futures_util::ready; +use miette::IntoDiagnostic; +use rumqttc::ConnectReturnCode::Success; +use rumqttc::{AsyncClient, ConnectionError, Event, Incoming, MqttOptions}; +use std::collections::HashMap; +use std::fmt::Display; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; -use async_channel as channel; -use async_oneshot as oneshot; -use futures_signals::signal::Signal; -use futures_util::future::BoxFuture; -use crate::resources::claim::{ResourceID, UserID}; -use crate::resources::state::State; +use std::time::Duration; +use url::Url; -pub enum UpdateError { - /// We're not connected to anything anymore. You can't do anything about this error and the - /// only reason why you even get it is because your future was called a last time before - /// being shelved so best way to handle this error is to just return from your loop entirely, - /// cleaning up any state that doesn't survive a freeze. - Closed, +mod dummy; - Denied, - - Other(Box), -} - -pub trait InitiatorError: std::error::Error + Send { -} - -pub trait Initiator { - fn start_for(&mut self, machine: ResourceID) - -> BoxFuture<'static, Result<(), Box>>; - - fn run(&mut self, request: &mut UpdateSink) - -> BoxFuture<'static, Result<(), Box>>; +pub trait Initiator: Future { + fn new(params: &HashMap, callbacks: InitiatorCallbacks) -> miette::Result + where + Self: Sized; + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<()> { + ::poll(self, cx) + } } #[derive(Clone)] -pub struct UpdateSink { - tx: channel::Sender<(Option, State)>, - rx: channel::Receiver>, +pub struct InitiatorCallbacks { + resource: Resource, + sessions: SessionManager, +} +impl InitiatorCallbacks { + pub fn new(resource: Resource, sessions: SessionManager) -> Self { + Self { resource, sessions } + } + + pub async fn try_update(&mut self, session: SessionHandle, status: Status) { + self.resource.try_update(session, status).await + } + + pub fn open_session(&self, uid: &str) -> Option { + self.sessions.open(uid) + } } -impl UpdateSink { - fn new(tx: channel::Sender<(Option, State)>, - rx: channel::Receiver>) - -> Self +pub struct InitiatorDriver { + name: String, + initiator: Box, +} + +impl InitiatorDriver { + pub fn new( + name: String, + params: &HashMap, + resource: Resource, + sessions: SessionManager, + ) -> miette::Result + where + I: 'static + Initiator + Unpin + Send, { - Self { tx, rx } - } - - async fn send(&mut self, userid: Option, state: State) - -> Result<(), UpdateError> - { - if let Err(_e) = self.tx.send((userid, state)).await { - return Err(UpdateError::Closed); - } - - match self.rx.recv().await { - Ok(Ok(())) => Ok(()), - Ok(Err(Error::Denied)) => Err(UpdateError::Denied), - Ok(Err(Error::Internal(e))) => Err(UpdateError::Other(e)), - // RecvError is send only when the channel is closed - Err(_) => Err(UpdateError::Closed), - } + let callbacks = InitiatorCallbacks::new(resource, sessions); + let initiator = Box::new(I::new(params, callbacks)?); + Ok(Self { name, initiator }) } } -struct Resource; -pub struct InitiatorDriver { - // TODO: make this a static reference to the resources because it's much easier and we don't - // need to replace resources at runtime at the moment. - resource_signal: S, - resource: Option>, - - // TODO: Initiators should instead - error_channel: Option>, - - initiator: I, - initiator_future: Option>>>, - update_sink: UpdateSink, - initiator_req_rx: channel::Receiver<(Option, State)>, - initiator_reply_tx: channel::Sender>, -} - -pub struct ResourceSink { - pub id: ResourceID, - pub state_sink: channel::Sender, -} - -impl, I: Initiator> InitiatorDriver { - pub fn new(resource_signal: S, initiator: I) -> Self { - let (initiator_reply_tx, initiator_reply_rx) = channel::bounded(1); - let (initiator_req_tx, initiator_req_rx) = async_channel::bounded(1); - let update_sink = UpdateSink::new(initiator_req_tx, initiator_reply_rx); - Self { - resource: None, - resource_signal, - error_channel: None, - - initiator, - initiator_future: None, - update_sink, - initiator_req_rx, - initiator_reply_tx, - } - } -} - -impl + Unpin, I: Initiator + Unpin> Future for InitiatorDriver { +impl Future for InitiatorDriver { type Output = (); fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - match Pin::new(&mut self.resource_signal).poll_change(cx) { - Poll::Ready(Some(resource)) => { - self.resource = Some(resource.state_sink); - self.error_channel = None; - let f = Box::pin(self.initiator.start_for(resource.id)); - self.initiator_future.replace(f); - }, - Poll::Ready(None) => self.resource = None, - Poll::Pending => {} - } + let _guard = tracing::info_span!("initiator poll", initiator=%self.name); + tracing::trace!(initiator=%self.name, "polling initiator"); - // do while there is work to do - while { - // First things first: - // If we've send an update to the resources in question we have error channel set, so - // we poll that first to determine if the resources has acted on it yet. - if let Some(ref mut errchan) = self.error_channel { - match Pin::new(errchan).poll(cx) { - // In case there's an ongoing - Poll::Pending => return Poll::Pending, - Poll::Ready(Ok(error)) => { - self.error_channel = None; - self.initiator_reply_tx.send(Err(error)); - } - Poll::Ready(Err(_closed)) => { - // Error channel was dropped which means there was no error - self.error_channel = None; - self.initiator_reply_tx.send(Ok(())); - } - } - } + ready!(Pin::new(&mut self.initiator).poll(cx)); - if let Some(ref mut init_fut) = self.initiator_future { - match init_fut.as_mut().poll(cx) { - Poll::Pending => return Poll::Pending, - Poll::Ready(Ok(())) => {}, - Poll::Ready(Err(_e)) => { - // TODO: Log initiator error here - } - } - } else if let Some(ref mut _resource) = self.resource { - let mut s = self.update_sink.clone(); - let f = self.initiator.run(&mut s); - self.initiator_future.replace(f); - } - - self.error_channel.is_some() - } {} + tracing::warn!(initiator=%self.name, "an initiator module ran to completion!"); Poll::Ready(()) } -} \ No newline at end of file +} + +pub fn load( + executor: Executor, + config: &Config, + resources: ResourcesHandle, + sessions: SessionManager, + authentication: AuthenticationHandle, +) -> miette::Result<()> { + let span = tracing::info_span!("loading initiators"); + let _guard = span.enter(); + + let mut initiator_map: HashMap = config + .init_connections + .iter() + .filter_map(|(k, v)| { + if let Some(resource) = resources.get_by_id(v) { + Some((k.clone(), resource.clone())) + } else { + tracing::error!(initiator=%k, machine=%v, + "Machine configured for initiator not found!"); + None + } + }) + .collect(); + + for (name, cfg) in config.initiators.iter() { + if let Some(resource) = initiator_map.remove(name) { + if let Some(driver) = load_single(name, &cfg.module, &cfg.params, resource, &sessions) { + tracing::debug!(module_name=%cfg.module, %name, "starting initiator task"); + executor.spawn(driver); + } else { + tracing::error!(module_name=%cfg.module, %name, "Initiator module could not be configured"); + } + } else { + tracing::warn!(actor=%name, ?config, "Initiator has no machine configured. Skipping!"); + } + } + + Ok(()) +} + +fn load_single( + name: &String, + module_name: &String, + params: &HashMap, + resource: Resource, + sessions: &SessionManager, +) -> Option { + tracing::info!(%name, %module_name, ?params, "Loading initiator"); + let o = match module_name.as_ref() { + "Dummy" => Some(InitiatorDriver::new::( + name.clone(), + params, + resource, + sessions.clone(), + )), + _ => None, + }; + + o.transpose().unwrap_or_else(|error| { + tracing::error!(%error, "failed to configure initiator"); + None + }) +} diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 3c34192..21ff90c 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -24,6 +24,7 @@ pub mod users; pub mod resources; pub mod actors; +pub mod initiators; pub mod sensors; @@ -118,15 +119,22 @@ impl Diflouroborane { .into_diagnostic() .wrap_err("Failed to construct signal handler")?; + let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone()); + let authentication = AuthenticationHandle::new(self.users.clone()); + + initiators::load( + self.executor.clone(), + &self.config, + self.resources.clone(), + sessionmanager.clone(), + authentication.clone(), + ); actors::load(self.executor.clone(), &self.config, self.resources.clone())?; let tlsconfig = TlsConfig::new(self.config.tlskeylog.as_ref(), !self.config.is_quiet()) .into_diagnostic()?; let acceptor = tlsconfig.make_tls_acceptor(&self.config.tlsconfig)?; - let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone()); - let authentication = AuthenticationHandle::new(self.users.clone()); - let apiserver = self.executor.run(APIServer::bind( self.executor.clone(), &self.config.listens, diff --git a/bffhd/resources/mod.rs b/bffhd/resources/mod.rs index 3a7fc10..c222467 100644 --- a/bffhd/resources/mod.rs +++ b/bffhd/resources/mod.rs @@ -25,6 +25,7 @@ pub mod modules; pub struct PermissionDenied; +#[derive(Debug)] pub(crate) struct Inner { id: String, db: StateDB, @@ -94,7 +95,7 @@ impl Inner { } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Resource { inner: Arc, } From a66303566aa964ad3490fedbb7a2b1c3ea3daace Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sat, 18 Jun 2022 16:52:22 +0200 Subject: [PATCH 21/51] Process initiator working --- Cargo.lock | 18 +++ Cargo.toml | 1 + bffhd/initiators/mod.rs | 10 +- bffhd/initiators/process.rs | 166 +++++++++++++++++++++++++++ bffhd/resources/modules/fabaccess.rs | 7 +- bffhd/utils/linebuffer.rs | 60 ++++++++++ bffhd/utils/mod.rs | 2 + examples/init.py | 13 +++ 8 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 bffhd/initiators/process.rs create mode 100644 bffhd/utils/linebuffer.rs create mode 100755 examples/init.py diff --git a/Cargo.lock b/Cargo.lock index d8cc667..1a9d6f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -226,6 +226,23 @@ dependencies = [ "futures-micro", ] +[[package]] +name = "async-process" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" +dependencies = [ + "async-io", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "libc", + "once_cell", + "signal-hook", + "winapi", +] + [[package]] name = "async-std" version = "1.10.0" @@ -839,6 +856,7 @@ dependencies = [ "async-io", "async-net", "async-oneshot", + "async-process", "async-trait", "backtrace", "capnp", diff --git a/Cargo.toml b/Cargo.toml index a082ad7..a50d54c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ futures-util = "0.3" futures-lite = "1.12.0" async-net = "1.6.1" async-io = "1.7.0" +async-process = "1.4.0" backtrace = "0.3.65" miette = { version = "4.7.1", features = ["fancy"] } thiserror = "1.0.31" diff --git a/bffhd/initiators/mod.rs b/bffhd/initiators/mod.rs index 7597cd8..e4c9714 100644 --- a/bffhd/initiators/mod.rs +++ b/bffhd/initiators/mod.rs @@ -1,4 +1,5 @@ use crate::initiators::dummy::Dummy; +use crate::initiators::process::Process; use crate::resources::modules::fabaccess::Status; use crate::session::SessionHandle; use crate::{ @@ -19,6 +20,7 @@ use std::time::Duration; use url::Url; mod dummy; +mod process; pub trait Initiator: Future { fn new(params: &HashMap, callbacks: InitiatorCallbacks) -> miette::Result @@ -78,7 +80,7 @@ impl Future for InitiatorDriver { ready!(Pin::new(&mut self.initiator).poll(cx)); - tracing::warn!(initiator=%self.name, "an initiator module ran to completion!"); + tracing::warn!(initiator=%self.name, "initiator module ran to completion!"); Poll::Ready(()) } @@ -139,6 +141,12 @@ fn load_single( resource, sessions.clone(), )), + "Process" => Some(InitiatorDriver::new::( + name.clone(), + params, + resource, + sessions.clone(), + )), _ => None, }; diff --git a/bffhd/initiators/process.rs b/bffhd/initiators/process.rs new file mode 100644 index 0000000..74de4f5 --- /dev/null +++ b/bffhd/initiators/process.rs @@ -0,0 +1,166 @@ +use super::Initiator; +use super::InitiatorCallbacks; +use crate::resources::state::State; +use crate::utils::linebuffer::LineBuffer; +use async_process::{Child, ChildStdout, Command, Stdio}; +use futures_lite::{ready, AsyncRead}; +use miette::{miette, IntoDiagnostic}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::future::Future; +use std::io; +use std::pin::Pin; +use std::task::{Context, Poll}; + +#[derive(Debug, Serialize, Deserialize)] +pub enum InputMessage { + #[serde(rename = "state")] + SetState(State), +} + +#[derive(Serialize, Deserialize)] +pub struct OutputLine {} + +pub struct Process { + pub cmd: String, + pub args: Vec, + state: Option, + buffer: LineBuffer, + callbacks: InitiatorCallbacks, +} + +impl Process { + fn spawn(&mut self) -> io::Result<()> { + let mut child = Command::new(&self.cmd) + .args(&self.args) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn()?; + self.state = Some(ProcessState::new( + child + .stdout + .take() + .expect("Child just spawned with piped stdout has no stdout"), + child, + )); + Ok(()) + } +} + +struct ProcessState { + pub child: Child, + pub stdout: ChildStdout, +} + +impl ProcessState { + pub fn new(stdout: ChildStdout, child: Child) -> Self { + Self { stdout, child } + } + + fn try_process(&mut self, buffer: &[u8], callbacks: &mut InitiatorCallbacks) -> usize { + tracing::trace!("trying to process current buffer"); + + let mut end = 0; + + while let Some(idx) = buffer[end..].iter().position(|b| *b == b'\n') { + if idx == 0 { + end += 1; + continue; + } + let line = &buffer[end..(end + idx)]; + self.process_line(line, callbacks); + end = idx; + } + + end + } + + fn process_line(&mut self, line: &[u8], callbacks: &mut InitiatorCallbacks) { + match serde_json::from_slice::(line) { + Ok(state) => { + tracing::trace!(?state, "got new state for process initiator"); + } + Err(error) => tracing::warn!(%error, "process initiator did not send a valid line"), + } + } +} + +impl Future for Process { + type Output = (); + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + if let Process { + state: Some(state), + buffer, + callbacks, + .. + } = self.get_mut() + { + match state.child.try_status() { + Err(error) => { + tracing::error!(%error, "checking child exit code returned an error"); + return Poll::Ready(()); + } + Ok(Some(exitcode)) => { + tracing::warn!(%exitcode, "child process exited"); + return Poll::Ready(()); + } + Ok(None) => { + tracing::trace!("process initiator checking on process"); + + let stdout = &mut state.stdout; + + loop { + let buf = buffer.get_mut_write(512); + match AsyncRead::poll_read(Pin::new(stdout), cx, buf) { + Poll::Pending => break, + Poll::Ready(Ok(read)) => { + buffer.advance_valid(read); + continue; + } + Poll::Ready(Err(error)) => { + tracing::warn!(%error, "reading from child stdout errored"); + return Poll::Ready(()); + } + } + } + + let processed = state.try_process(buffer, callbacks); + buffer.consume(processed); + + return Poll::Pending; + } + } + } else { + tracing::warn!("process initiator has no process attached!"); + } + + Poll::Ready(()) + } +} + +impl Initiator for Process { + fn new(params: &HashMap, callbacks: InitiatorCallbacks) -> miette::Result + where + Self: Sized, + { + let cmd = params + .get("cmd") + .ok_or(miette!("Process initiator requires a `cmd` parameter."))? + .clone(); + let args = params + .get("args") + .map(|argv| argv.split_whitespace().map(|s| s.to_string()).collect()) + .unwrap_or_else(Vec::new); + let mut this = Self { + cmd, + args, + state: None, + buffer: LineBuffer::new(), + callbacks, + }; + this.spawn().into_diagnostic()?; + Ok(this) + } +} diff --git a/bffhd/resources/modules/fabaccess.rs b/bffhd/resources/modules/fabaccess.rs index 1863aab..b50e9b6 100644 --- a/bffhd/resources/modules/fabaccess.rs +++ b/bffhd/resources/modules/fabaccess.rs @@ -1,9 +1,9 @@ +use crate::config::deser_option; use crate::utils::oid::ObjectIdentifier; use once_cell::sync::Lazy; use rkyv::{Archive, Archived, Deserialize, Infallible}; use std::fmt; use std::fmt::Write; - use std::str::FromStr; //use crate::oidvalue; @@ -54,6 +54,11 @@ pub enum Status { /// The status of the machine pub struct MachineState { pub state: Status, + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" + )] pub previous: Option, } diff --git a/bffhd/utils/linebuffer.rs b/bffhd/utils/linebuffer.rs new file mode 100644 index 0000000..87d6559 --- /dev/null +++ b/bffhd/utils/linebuffer.rs @@ -0,0 +1,60 @@ +use std::ops::{Deref, DerefMut}; + +pub struct LineBuffer { + buffer: Vec, + valid: usize, +} + +impl LineBuffer { + pub fn new() -> Self { + Self { + buffer: Vec::new(), + valid: 0, + } + } + + /// Resize the internal Vec so that buffer.len() == buffer.capacity() + fn resize(&mut self) { + // SAFETY: Whatever is in memory is always valid as u8. + unsafe { self.buffer.set_len(self.buffer.capacity()) } + } + + /// Get an (initialized but empty) writeable buffer of at least `atleast` bytes + pub fn get_mut_write(&mut self, atleast: usize) -> &mut [u8] { + let avail = self.buffer.len() - self.valid; + if avail < atleast { + self.buffer.reserve(atleast - avail); + self.resize() + } + &mut self.buffer[self.valid..] + } + + pub fn advance_valid(&mut self, amount: usize) { + self.valid += amount + } + + /// Mark `amount` bytes as 'consumed' + /// + /// This will move any remaining data to the start of the buffer for future processing + pub fn consume(&mut self, amount: usize) { + assert!(amount <= self.valid); + + if amount < self.valid { + self.buffer.copy_within(amount..self.valid, 0); + } + self.valid -= amount; + } +} + +impl Deref for LineBuffer { + type Target = [u8]; + + fn deref(&self) -> &Self::Target { + &self.buffer[0..self.valid] + } +} +impl DerefMut for LineBuffer { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.buffer[0..self.valid] + } +} diff --git a/bffhd/utils/mod.rs b/bffhd/utils/mod.rs index c14ec8f..d65f75c 100644 --- a/bffhd/utils/mod.rs +++ b/bffhd/utils/mod.rs @@ -8,3 +8,5 @@ pub mod varint; pub mod l10nstring; pub mod uuid; + +pub mod linebuffer; diff --git a/examples/init.py b/examples/init.py new file mode 100755 index 0000000..73ed4e2 --- /dev/null +++ b/examples/init.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import sys +import time + +while True: + print('{ "state": { "1.3.6.1.4.1.48398.612.2.4": { "state": "Free" } } }') + sys.stdout.flush() + time.sleep(2) + + print('{ "state": { "1.3.6.1.4.1.48398.612.2.4": { "state": { "InUse": { "id": "Testuser" } } } } }') + sys.stdout.flush() + time.sleep(2) From 58f40d98ed3c4f97ac0f274bbdc63765b5f5a958 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Mon, 20 Jun 2022 15:19:25 +0200 Subject: [PATCH 22/51] Implement PermissionSystem::getRoleList() Closes: #62 --- bffhd/authorization/roles.rs | 4 ++++ bffhd/capnp/permissionsystem.rs | 35 ++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/bffhd/authorization/roles.rs b/bffhd/authorization/roles.rs index 0885eca..ef9cb38 100644 --- a/bffhd/authorization/roles.rs +++ b/bffhd/authorization/roles.rs @@ -27,6 +27,10 @@ impl Roles { self.roles.get(roleid) } + pub fn list(&self) -> impl Iterator { + self.roles.keys() + } + /// Tally a role dependency tree into a set /// /// A Default implementation exists which adapter may overwrite with more efficient diff --git a/bffhd/capnp/permissionsystem.rs b/bffhd/capnp/permissionsystem.rs index bad3582..199e5c0 100644 --- a/bffhd/capnp/permissionsystem.rs +++ b/bffhd/capnp/permissionsystem.rs @@ -1,13 +1,38 @@ -use api::permissionsystem_capnp::permission_system::info::Server as PermissionSystem; +use crate::authorization::roles::Role; +use crate::Roles; +use api::permissionsystem_capnp::permission_system::info::{ + GetRoleListParams, GetRoleListResults, Server as PermissionSystem, +}; +use capnp::capability::Promise; +use capnp::Error; use crate::session::SessionHandle; -pub struct Permissions; +pub struct Permissions { + roles: Roles, +} impl Permissions { - pub fn new(_session: SessionHandle) -> Self { - Self + pub fn new(session: SessionHandle) -> Self { + Self { + roles: session.roles, + } } } -impl PermissionSystem for Permissions {} +impl PermissionSystem for Permissions { + fn get_role_list( + &mut self, + _: GetRoleListParams, + mut results: GetRoleListResults, + ) -> Promise<(), Error> { + let roles = self.roles.list().collect::>(); + let mut builder = results.get(); + let mut b = builder.init_role_list(roles.len() as u32); + for (i, role) in roles.into_iter().enumerate() { + let mut role_builder = b.reborrow().get(i as u32); + role_builder.set_name(role); + } + Promise::ok(()) + } +} From df7bd80d06587d173179df6e0e7c0bbe8bfcb726 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Jun 2022 13:06:12 +0200 Subject: [PATCH 23/51] Start on the runtime console subscriber --- Cargo.toml | 2 +- runtime/console/Cargo.toml | 10 +++++ runtime/console/src/callsites.rs | 75 ++++++++++++++++++++++++++++++++ runtime/console/src/lib.rs | 10 +++++ 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 runtime/console/Cargo.toml create mode 100644 runtime/console/src/callsites.rs create mode 100644 runtime/console/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index a50d54c..21b74fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,4 +123,4 @@ tempfile = "3.2" shadow-rs = "0.11" [workspace] -members = ["modules/*", "api"] +members = ["runtime/*", "modules/*", "api"] diff --git a/runtime/console/Cargo.toml b/runtime/console/Cargo.toml new file mode 100644 index 0000000..45d09e9 --- /dev/null +++ b/runtime/console/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "console" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +console-api = "0.3" +tracing = "0.1" \ No newline at end of file diff --git a/runtime/console/src/callsites.rs b/runtime/console/src/callsites.rs new file mode 100644 index 0000000..d10c395 --- /dev/null +++ b/runtime/console/src/callsites.rs @@ -0,0 +1,75 @@ +use std::fmt; +use std::fmt::Formatter; +use std::ptr; +use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; +use tracing::Metadata; + +pub(crate) struct Callsites { + array: [AtomicPtr>; MAX_CALLSITES], + len: AtomicUsize, +} + +impl Callsites { + pub(crate) fn insert(&self, callsite: &'static Metadata<'static>) { + if self.contains(callsite) { + return; + } + + let idx = self.len.fetch_add(1, Ordering::AcqRel); + if idx <= MAX_CALLSITES { + self.array[idx] + .compare_exchange( + ptr::null_mut(), + callsite as *const _ as *mut _, + Ordering::AcqRel, + Ordering::Acquire, + ) + .expect("would have clobbered callsite array"); + } else { + todo!("Need to spill callsite over into backup storage"); + } + } + + pub(crate) fn contains(&self, callsite: &'static Metadata<'static>) -> bool { + let mut idx = 0; + let mut end = self.len.load(Ordering::Acquire); + while { + for cs in &self.array[idx..end] { + let ptr = cs.load(Ordering::Acquire); + let meta = unsafe { ptr as *const _ as &'static Metadata<'static> }; + if meta.callsite() == callsite.callsite() { + return true; + } + } + + idx = end; + + // Check if new callsites were added since we iterated + end = self.len.load(Ordering::Acquire); + end > idx + } {} + + false + } +} + +impl Default for Callsites { + fn default() -> Self { + const NULLPTR: AtomicPtr<_> = AtomicPtr::new(ptr::null_mut()); + Self { + array: [NULLPTR; MAX_CALLSITES], + len: AtomicUsize::new(0), + } + } +} + +impl fmt::Debug for Callsites { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + let len = self.len.load(Ordering::Acquire); + f.debug_struct("Callsites") + .field("MAX_CALLSITES", &MAX_CALLSITES) + .field("array", &&self.array[..len]) + .field("len", &len) + .finish() + } +} diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs new file mode 100644 index 0000000..b02b962 --- /dev/null +++ b/runtime/console/src/lib.rs @@ -0,0 +1,10 @@ +mod callsites; + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + let result = 2 + 2; + assert_eq!(result, 4); + } +} From 8a35818b4f819fb47463608494782d15d28a207f Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Jun 2022 16:20:44 +0200 Subject: [PATCH 24/51] More console implementation stuff --- Cargo.lock | 371 ++++++++++++++++++++++++++++++- runtime/console/Cargo.toml | 8 +- runtime/console/src/aggregate.rs | 12 + runtime/console/src/callsites.rs | 6 +- runtime/console/src/event.rs | 5 + runtime/console/src/lib.rs | 160 +++++++++++++ runtime/console/src/server.rs | 95 ++++++++ runtime/console/src/stack.rs | 64 ++++++ 8 files changed, 715 insertions(+), 6 deletions(-) create mode 100644 runtime/console/src/aggregate.rs create mode 100644 runtime/console/src/event.rs create mode 100644 runtime/console/src/server.rs create mode 100644 runtime/console/src/stack.rs diff --git a/Cargo.lock b/Cargo.lock index 1a9d6f4..d815106 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,6 +88,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + [[package]] name = "api" version = "0.3.2" @@ -270,6 +276,27 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "async-stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-task" version = "4.2.0" @@ -310,6 +337,49 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "axum" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4af7447fc1214c1f3a1ace861d0216a6c8bb13965b64bbad9650f375b67689a" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa 1.0.1", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde", + "sync_wrapper", + "tokio", + "tower", + "tower-http", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bdc19781b16e32f8a7200368a336fa4509d4b72ef15dd4e41df5290855ee1e6" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", +] + [[package]] name = "backtrace" version = "0.3.65" @@ -596,6 +666,32 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "console" +version = "0.1.0" +dependencies = [ + "console-api", + "crossbeam-channel", + "hyper", + "thread_local", + "tonic", + "tracing", + "tracing-core", + "tracing-subscriber 0.3.9", +] + +[[package]] +name = "console-api" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c5fd425783d81668ed68ec98408a80498fb4ae2fd607797539e1a9dfa3618f" +dependencies = [ + "prost", + "prost-types", + "tonic", + "tracing-core", +] + [[package]] name = "const_format" version = "0.2.23" @@ -1286,6 +1382,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "h2" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "1.8.2" @@ -1336,6 +1451,71 @@ dependencies = [ "itoa 1.0.1", ] +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" + +[[package]] +name = "httparse" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.1", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "idna" version = "0.2.3" @@ -1594,6 +1774,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "matchit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" + [[package]] name = "memchr" version = "2.4.1" @@ -1640,6 +1826,12 @@ dependencies = [ "syn", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + [[package]] name = "miniz_oxide" version = "0.5.3" @@ -1985,6 +2177,39 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "prost" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +dependencies = [ + "anyhow", + "itertools 0.10.3", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +dependencies = [ + "bytes", + "prost", +] + [[package]] name = "ptr_meta" version = "0.1.4" @@ -2647,6 +2872,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "sync_wrapper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" + [[package]] name = "tempfile" version = "3.3.0" @@ -2766,20 +2997,31 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.17.0" +version = "1.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" +checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" dependencies = [ "bytes", "libc", "memchr", "mio", + "once_cell", "pin-project-lite", "socket2", "tokio-macros", "winapi", ] +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-macros" version = "1.7.0" @@ -2802,6 +3044,31 @@ dependencies = [ "webpki", ] +[[package]] +name = "tokio-stream" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.8" @@ -2811,6 +3078,89 @@ dependencies = [ "serde", ] +[[package]] +name = "tonic" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9d60db39854b30b835107500cf0aca0b0d14d6e1c3de124217c23a29c2ddb" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.32" @@ -2818,6 +3168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2913,6 +3264,12 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "trybuild" version = "1.0.56" @@ -3054,6 +3411,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/runtime/console/Cargo.toml b/runtime/console/Cargo.toml index 45d09e9..592b083 100644 --- a/runtime/console/Cargo.toml +++ b/runtime/console/Cargo.toml @@ -7,4 +7,10 @@ edition = "2021" [dependencies] console-api = "0.3" -tracing = "0.1" \ No newline at end of file +tonic = { version = "0.7.2", default_features = false, features = [] } +hyper = { version = "0.14", default_features = false, features = ["http2", "server", "stream"] } +thread_local = "1.1" +tracing = "0.1" +tracing-core = "0.1" +tracing-subscriber = { version = "0.3", default_features = false, features = ["registry"] } +crossbeam-channel = "0.5" \ No newline at end of file diff --git a/runtime/console/src/aggregate.rs b/runtime/console/src/aggregate.rs new file mode 100644 index 0000000..1c0a5a1 --- /dev/null +++ b/runtime/console/src/aggregate.rs @@ -0,0 +1,12 @@ +use crate::Event; +use crossbeam_channel::Receiver; + +pub(crate) struct Aggregator { + events: Receiver, +} + +impl Aggregator { + pub fn new(events: Receiver) -> Self { + Self { events } + } +} diff --git a/runtime/console/src/callsites.rs b/runtime/console/src/callsites.rs index d10c395..35a0da4 100644 --- a/runtime/console/src/callsites.rs +++ b/runtime/console/src/callsites.rs @@ -30,13 +30,13 @@ impl Callsites { } } - pub(crate) fn contains(&self, callsite: &'static Metadata<'static>) -> bool { + pub(crate) fn contains(&self, callsite: &Metadata<'static>) -> bool { let mut idx = 0; let mut end = self.len.load(Ordering::Acquire); while { for cs in &self.array[idx..end] { let ptr = cs.load(Ordering::Acquire); - let meta = unsafe { ptr as *const _ as &'static Metadata<'static> }; + let meta = unsafe { ptr as *const _ as &Metadata<'static> }; if meta.callsite() == callsite.callsite() { return true; } @@ -55,7 +55,7 @@ impl Callsites { impl Default for Callsites { fn default() -> Self { - const NULLPTR: AtomicPtr<_> = AtomicPtr::new(ptr::null_mut()); + const NULLPTR: AtomicPtr> = AtomicPtr::new(ptr::null_mut()); Self { array: [NULLPTR; MAX_CALLSITES], len: AtomicUsize::new(0), diff --git a/runtime/console/src/event.rs b/runtime/console/src/event.rs new file mode 100644 index 0000000..65b316f --- /dev/null +++ b/runtime/console/src/event.rs @@ -0,0 +1,5 @@ +use tracing_core::Metadata; + +pub(crate) enum Event { + Metadata(&'static Metadata<'static>), +} diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index b02b962..b0b8688 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -1,4 +1,164 @@ +use crossbeam_channel::{Sender, TrySendError}; +use std::any::TypeId; +use std::cell::RefCell; +use std::net::IpAddr; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::Arc; +use thread_local::ThreadLocal; +use tracing_core::span::{Attributes, Id, Record}; +use tracing_core::{Interest, LevelFilter, Metadata, Subscriber}; +use tracing_subscriber::filter::Filtered; +use tracing_subscriber::layer::{Context, Filter, Layered}; +use tracing_subscriber::registry::LookupSpan; +use tracing_subscriber::Layer; + +mod aggregate; mod callsites; +mod event; +mod server; +mod stack; + +use crate::aggregate::Aggregator; +use crate::callsites::Callsites; +use event::Event; +pub use server::Server; +use stack::SpanStack; + +pub struct ConsoleLayer { + current_spans: ThreadLocal>, + + tx: Sender, + shared: Arc, + + spawn_callsites: Callsites<8>, + waker_callsites: Callsites<8>, +} + +#[derive(Debug)] +pub struct Builder { + /// Network Address the console server will listen on + server_addr: IpAddr, + /// Network Port the console server will listen on + server_port: u16, + + /// Number of events that can be buffered before events are dropped. + /// + /// A smaller number will reduce the memory footprint but may lead to more events being dropped + /// during activity bursts. + event_buffer_capacity: usize, +} +impl Builder { + pub fn build(self) -> (ConsoleLayer, Server) { + ConsoleLayer::build(self) + } +} +impl Default for Builder { + fn default() -> Self { + Self { + // Listen on `::1` (aka localhost) by default + server_addr: Server::DEFAULT_ADDR, + server_port: Server::DEFAULT_PORT, + event_buffer_capacity: ConsoleLayer::DEFAULT_EVENT_BUFFER_CAPACITY, + } + } +} + +#[derive(Debug, Default)] +struct Shared { + dropped_tasks: AtomicUsize, + dropped_resources: AtomicUsize, +} + +impl ConsoleLayer { + pub fn new() -> (Self, Server) { + Self::builder().build() + } + pub fn builder() -> Builder { + Builder::default() + } + fn build(config: Builder) -> (Self, Server) { + tracing::debug!( + ?config.server_addr, + config.event_buffer_capacity, + "configured console subscriber" + ); + + let (tx, events) = crossbeam_channel::bounded(config.event_buffer_capacity); + let shared = Arc::new(Shared::default()); + let aggregator = Aggregator::new(events); + let server = Server::new(aggregator); + let layer = Self { + current_spans: ThreadLocal::new(), + tx, + shared, + spawn_callsites: Callsites::default(), + waker_callsites: Callsites::default(), + }; + + (layer, server) + } +} + +impl ConsoleLayer { + const DEFAULT_EVENT_BUFFER_CAPACITY: usize = 1024; + const DEFAULT_CLIENT_BUFFER_CAPACITY: usize = 1024; + + fn is_spawn(&self, metadata: &Metadata<'static>) -> bool { + self.spawn_callsites.contains(metadata) + } + + fn is_waker(&self, metadata: &Metadata<'static>) -> bool { + self.waker_callsites.contains(metadata) + } + + fn send_stats( + &self, + dropped: &AtomicUsize, + mkEvent: impl FnOnce() -> (Event, S), + ) -> Option { + if self.tx.is_full() { + dropped.fetch_add(1, Ordering::Release); + return None; + } + + let (event, stats) = mkEvent(); + match self.tx.try_send(event) { + Ok(()) => Some(stats), + Err(TrySendError::Full(_)) => { + dropped.fetch_add(1, Ordering::Release); + None + } + Err(TrySendError::Disconnected(_)) => None, + } + } + + fn send_metadata(&self, dropped: &AtomicUsize, event: Event) -> bool { + self.send_stats(dropped, || (event, ())).is_some() + } +} + +impl Layer for ConsoleLayer +where + S: Subscriber + for<'a> LookupSpan<'a>, +{ + fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest { + let dropped = match (metadata.name(), metadata.target()) { + (_, "executor::spawn") => { + self.spawn_callsites.insert(metadata); + &self.shared.dropped_tasks + } + (_, "executor::waker") => { + self.waker_callsites.insert(metadata); + &self.shared.dropped_tasks + } + (_, _) => &self.shared.dropped_tasks, + }; + + self.send_metadata(dropped, Event::Metadata(metadata)); + + Interest::always() + } +} #[cfg(test)] mod tests { diff --git a/runtime/console/src/server.rs b/runtime/console/src/server.rs new file mode 100644 index 0000000..2bf0ba1 --- /dev/null +++ b/runtime/console/src/server.rs @@ -0,0 +1,95 @@ +use crate::Aggregator; +use console_api::instrument::instrument_server::{Instrument, InstrumentServer}; +use console_api::instrument::{ + InstrumentRequest, PauseRequest, PauseResponse, ResumeRequest, ResumeResponse, + TaskDetailsRequest, +}; +use std::error::Error; +use std::net::{IpAddr, Ipv6Addr}; + +pub struct Server { + aggregator: Aggregator, + client_buffer_size: usize, +} + +impl Server { + pub(crate) const DEFAULT_ADDR: IpAddr = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + pub(crate) const DEFAULT_PORT: u16 = 49289; + + pub(crate) fn new(aggregator: Aggregator, client_buffer_size: usize) -> Self { + Self { + aggregator, + client_buffer_size, + } + } + + pub(crate) async fn serve( + mut self, /*, incoming: I */ + ) -> Result<(), Box> { + // TODO: Spawn two tasks; the aggregator that's collecting stats, aggregating and + // collating them and the server task doing the tonic gRPC stuff + + let svc = InstrumentServer::new(self); + + // The gRPC server task; requires a `Stream` of `tokio::AsyncRead + tokio::AsyncWrite`. + // TODO: Pass an async listening socket that implements the tokio versions of Read/Write + let incoming = todo!(); + tonic::transport::Server::builder() + .add_service(svc) + .serve_with_incoming(incoming) + .await?; + + // TODO: Kill the aggregator task if the serve task has ended. + + Ok(()) + } +} + +#[tonic::async_trait] +impl Instrument for Server { + type WatchUpdatesStream = (); + + async fn watch_updates( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + /* + match request.remote_addr() { + Some(addr) => tracing::debug!(client.addr = %addr, "starting a new watch"), + None => tracing::debug!(client.addr = %"", "starting a new watch"), + } + let permit = self.subscribe.reserve().await.map_err(|_| { + tonic::Status::internal("cannot start new watch, aggregation task is not running") + })?; + let (tx, rx) = mpsc::channel(self.client_buffer); + permit.send(Command::Instrument(Watch(tx))); + tracing::debug!("watch started"); + let stream = tokio_stream::wrappers::ReceiverStream::new(rx); + Ok(tonic::Response::new(stream)) + */ + todo!() + } + + type WatchTaskDetailsStream = (); + + async fn watch_task_details( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + todo!() + } + + async fn pause( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + todo!() + } + + async fn resume( + &self, + request: tonic::Request, + ) -> Result, tonic::Status> { + todo!() + } +} diff --git a/runtime/console/src/stack.rs b/runtime/console/src/stack.rs new file mode 100644 index 0000000..2bed34d --- /dev/null +++ b/runtime/console/src/stack.rs @@ -0,0 +1,64 @@ +use tracing_core::span::Id; + +// This has been copied from tracing-subscriber. Once the library adds +// the ability to iterate over entered spans, this code will +// no longer be needed here +// +// https://github.com/tokio-rs/tracing/blob/master/tracing-subscriber/src/registry/stack.rs +#[derive(Debug, Clone)] +pub(crate) struct ContextId { + id: Id, + duplicate: bool, +} + +impl ContextId { + pub fn id(&self) -> &Id { + &self.id + } +} + +/// `SpanStack` tracks what spans are currently executing on a thread-local basis. +/// +/// A "separate current span" for each thread is a semantic choice, as each span +/// can be executing in a different thread. +#[derive(Debug, Default)] +pub(crate) struct SpanStack { + stack: Vec, +} + +impl SpanStack { + #[inline] + pub(crate) fn push(&mut self, id: Id) -> bool { + let duplicate = self.stack.iter().any(|i| i.id == id); + self.stack.push(ContextId { id, duplicate }); + !duplicate + } + + /// Pop a currently entered span. + /// + /// Returns `true` if the span was actually exited. + #[inline] + pub(crate) fn pop(&mut self, expected_id: &Id) -> bool { + if let Some((idx, _)) = self + .stack + .iter() + .enumerate() + .rev() + .find(|(_, ctx_id)| ctx_id.id == *expected_id) + { + let ContextId { id: _, duplicate } = self.stack.remove(idx); + return !duplicate; + } + false + } + + pub(crate) fn iter(&self) -> impl Iterator { + self.stack + .iter() + .filter_map(|ContextId { id, duplicate }| if *duplicate { None } else { Some(id) }) + } + + pub(crate) fn stack(&self) -> &Vec { + &self.stack + } +} From ee0593dc6fb76cf9ecb56719a0c69eb17750aa0a Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Jun 2022 16:21:13 +0200 Subject: [PATCH 25/51] Use `ManuallyDrop` instead of `mem::forget` where appropiate --- runtime/executor/src/pool.rs | 27 +++++++++++++++++++++++++++ runtime/lightproc/src/lightproc.rs | 10 +++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index a900d24..ff422d1 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -20,6 +20,9 @@ use std::marker::PhantomData; use std::mem::MaybeUninit; use std::sync::Arc; use std::time::Duration; +use tracing::field::FieldSet; +use tracing::metadata::Kind; +use tracing::{Level, Span}; #[derive(Debug)] struct Spooler<'a> { @@ -45,12 +48,21 @@ impl Spooler<'_> { /// Global executor pub struct Executor<'a> { spooler: Arc>, + span: Span, } impl<'a, 'executor: 'a> Executor<'executor> { pub fn new() -> Self { Executor { spooler: Arc::new(Spooler::new()), + span: tracing::span!(Level::INFO, "executor"), + } + } + + pub fn new_with_parent_span(parent: &Span) -> Self { + Executor { + spooler: Arc::new(Spooler::new()), + span: tracing::span!(parent: parent, Level::INFO, "executor"), } } @@ -99,7 +111,15 @@ impl<'a, 'executor: 'a> Executor<'executor> { F: Future + Send + 'a, R: Send + 'a, { + let span = tracing::info_span!( + parent: &self.span, + //target: "executor::spawn", + "runtime.spawn" + ); + let _guard = span.enter(); + let (task, handle) = LightProc::recoverable(future, self.schedule()); + tracing::trace!("spawning sendable task"); task.schedule(); handle } @@ -109,7 +129,14 @@ impl<'a, 'executor: 'a> Executor<'executor> { F: Future + 'a, R: Send + 'a, { + let span = tracing::info_span!( + parent: &self.span, + //target: "executor::spawn", + "runtime.spawn_local" + ); + let _guard = span.enter(); let (task, handle) = LightProc::recoverable(future, schedule_local()); + tracing::trace!("spawning sendable task"); task.schedule(); handle } diff --git a/runtime/lightproc/src/lightproc.rs b/runtime/lightproc/src/lightproc.rs index 3d59379..c94b5fa 100644 --- a/runtime/lightproc/src/lightproc.rs +++ b/runtime/lightproc/src/lightproc.rs @@ -33,7 +33,7 @@ use crate::raw_proc::RawProc; use crate::recoverable_handle::RecoverableHandle; use std::fmt::{self, Debug, Formatter}; use std::future::Future; -use std::mem; +use std::mem::ManuallyDrop; use std::panic::AssertUnwindSafe; use std::ptr::NonNull; @@ -130,9 +130,9 @@ impl LightProc { /// /// Schedule the lightweight process with passed `schedule` function at the build time. pub fn schedule(self) { - let ptr = self.raw_proc.as_ptr(); + let this = ManuallyDrop::new(self); + let ptr = this.raw_proc.as_ptr(); let pdata = ptr as *const ProcData; - mem::forget(self); unsafe { ((*pdata).vtable.schedule)(ptr); @@ -144,9 +144,9 @@ impl LightProc { /// "Running" a lightproc means ticking it once and if it doesn't complete /// immediately re-scheduling it as soon as it's Waker wakes it back up. pub fn run(self) { - let ptr = self.raw_proc.as_ptr(); + let this = ManuallyDrop::new(self); + let ptr = this.raw_proc.as_ptr(); let pdata = ptr as *const ProcData; - mem::forget(self); unsafe { ((*pdata).vtable.tick)(ptr); From 35c9f45f6d35711c7902ae4c97fbf9908482e819 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Jun 2022 19:11:57 +0200 Subject: [PATCH 26/51] More console features --- Cargo.lock | 62 +++++- runtime/console/Cargo.toml | 13 +- runtime/console/src/aggregate.rs | 369 ++++++++++++++++++++++++++++++- runtime/console/src/attribute.rs | 30 +++ runtime/console/src/callsites.rs | 2 +- runtime/console/src/event.rs | 38 ++++ runtime/console/src/lib.rs | 10 +- runtime/console/src/server.rs | 191 +++++++++++++--- runtime/console/src/stats.rs | 161 ++++++++++++++ 9 files changed, 838 insertions(+), 38 deletions(-) create mode 100644 runtime/console/src/attribute.rs create mode 100644 runtime/console/src/stats.rs diff --git a/Cargo.lock b/Cargo.lock index d815106..d9e4bbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47feb9fbcef700639ef28e04ca2a87eab8161a01a075ee227b15c90143805462" dependencies = [ - "nom", + "nom 5.1.2", ] [[package]] @@ -670,10 +670,21 @@ dependencies = [ name = "console" version = "0.1.0" dependencies = [ + "async-channel", + "async-compat", + "async-io", + "async-net", + "async-oneshot", "console-api", "crossbeam-channel", + "crossbeam-utils", + "futures-util", + "hdrhistogram", "hyper", + "prost-types", "thread_local", + "tokio", + "tokio-util", "tonic", "tracing", "tracing-core", @@ -743,6 +754,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.3.5" @@ -1126,6 +1146,16 @@ dependencies = [ "instant", ] +[[package]] +name = "flate2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1422,6 +1452,20 @@ dependencies = [ "ahash", ] +[[package]] +name = "hdrhistogram" +version = "7.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31672b7011be2c4f7456c4ddbcb40e7e9a4a9fad8efe49a6ebaf5f307d0109c0" +dependencies = [ + "base64", + "byteorder", + "crossbeam-channel", + "flate2", + "nom 7.1.1", + "num-traits", +] + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1832,6 +1876,12 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.5.3" @@ -1888,6 +1938,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "ntapi" version = "0.3.7" diff --git a/runtime/console/Cargo.toml b/runtime/console/Cargo.toml index 592b083..fd823e8 100644 --- a/runtime/console/Cargo.toml +++ b/runtime/console/Cargo.toml @@ -7,10 +7,21 @@ edition = "2021" [dependencies] console-api = "0.3" +prost-types = "0.10" tonic = { version = "0.7.2", default_features = false, features = [] } hyper = { version = "0.14", default_features = false, features = ["http2", "server", "stream"] } thread_local = "1.1" tracing = "0.1" tracing-core = "0.1" tracing-subscriber = { version = "0.3", default_features = false, features = ["registry"] } -crossbeam-channel = "0.5" \ No newline at end of file +crossbeam-utils = "0.8" +crossbeam-channel = "0.5" +async-net = "1.6" +async-compat = "0.2" +async-channel = "1.6" +async-oneshot = "0.5" +async-io = "1.7" +tokio-util = "0.7" +futures-util = "0.3" +tokio = { version = "1.19", default_features = false, features = []} +hdrhistogram = "7.5" \ No newline at end of file diff --git a/runtime/console/src/aggregate.rs b/runtime/console/src/aggregate.rs index 1c0a5a1..25fb192 100644 --- a/runtime/console/src/aggregate.rs +++ b/runtime/console/src/aggregate.rs @@ -1,12 +1,375 @@ +use crate::server::{Watch, WatchRequest}; +use crate::stats::TimeAnchor; use crate::Event; -use crossbeam_channel::Receiver; +use crate::{server, stats}; +use console_api::{async_ops, instrument, resources, tasks}; +use crossbeam_channel::{Receiver, TryRecvError}; +use futures_util::{FutureExt, StreamExt}; +use std::num::NonZeroU64; +use std::sync::atomic::AtomicBool; +use std::sync::Arc; +use std::time::{Duration, Instant}; +use tracing_core::Metadata; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +pub(crate) struct Id(NonZeroU64); + +impl Id { + pub fn from_non_zero_u64(u: NonZeroU64) -> Self { + Self(u) + } +} + +impl Into for Id { + fn into(self) -> console_api::Id { + console_api::Id { id: self.0.into() } + } +} + +struct Resource { + id: Id, + is_dirty: AtomicBool, + parent_id: Option, + metadata: &'static Metadata<'static>, + concrete_type: String, + kind: resources::resource::Kind, + location: Option, + is_internal: bool, +} + +/// Represents static data for tasks +struct Task { + id: Id, + is_dirty: AtomicBool, + metadata: &'static Metadata<'static>, + fields: Vec, + location: Option, +} + +struct AsyncOp { + id: Id, + is_dirty: AtomicBool, + parent_id: Option, + resource_id: Id, + metadata: &'static Metadata<'static>, + source: String, +} + +#[derive(Copy, Clone, Eq, PartialEq)] +pub(crate) enum Include { + All, + UpdatedOnly, +} + +type IdMap = std::collections::HashMap; pub(crate) struct Aggregator { events: Receiver, + rpcs: async_channel::Receiver, + watchers: Vec>, + details_watchers: IdMap>>, + all_metadata: Vec, + new_metadata: Vec, + running: bool, + publish_interval: Duration, + base_time: TimeAnchor, + tasks: IdMap, + task_stats: IdMap>, + resources: IdMap, + resource_stats: IdMap>, + async_ops: IdMap, + async_op_stats: IdMap>, + poll_ops: Vec, } impl Aggregator { - pub fn new(events: Receiver) -> Self { - Self { events } + pub fn new(events: Receiver, rpcs: async_channel::Receiver) -> Self { + Self { + events, + rpcs, + watchers: Vec::new(), + details_watchers: IdMap::new(), + running: true, + publish_interval: Duration::from_secs(1), + all_metadata: Vec::new(), + new_metadata: Vec::new(), + base_time: TimeAnchor::new(), + tasks: IdMap::new(), + task_stats: IdMap::new(), + resources: IdMap::new(), + resource_stats: IdMap::new(), + async_ops: IdMap::new(), + async_op_stats: IdMap::new(), + poll_ops: Vec::new(), + } + } + + fn add_instrument_subscription(&mut self, subscription: Watch) { + tracing::debug!("new instrument subscription"); + + let task_update = Some(self.task_update(Include::All)); + let resource_update = Some(self.resource_update(Include::All)); + let async_op_update = Some(self.async_op_update(Include::All)); + let now = Instant::now(); + + let update = &instrument::Update { + task_update, + resource_update, + async_op_update, + now: Some(self.base_time.to_timestamp(now)), + new_metadata: Some(console_api::RegisterMetadata { + metadata: (self.all_metadata).clone(), + }), + }; + + // Send the initial state --- if this fails, the subscription is already dead + if subscription.update(update) { + self.watchers.push(subscription) + } + } + + /// Add the task details subscription to the watchers after sending the first update, + /// if the task is found. + fn add_task_detail_subscription( + &mut self, + watch_request: WatchRequest, + ) { + let WatchRequest { + id, + mut stream_sender, + buffer, + } = watch_request; + tracing::debug!(id = ?id, "new task details subscription"); + if let Some(stats) = self.task_stats.get(&id) { + let (tx, rx) = async_channel::bounded(buffer); + let subscription = Watch(tx); + let now = Some(self.base_time.to_timestamp(Instant::now())); + // Send back the stream receiver. + // Then send the initial state --- if this fails, the subscription is already dead. + if stream_sender.send(rx).is_ok() + && subscription.update(&console_api::tasks::TaskDetails { + task_id: Some(id.clone().into()), + now, + poll_times_histogram: Some(stats.poll_duration_histogram()), + }) + { + self.details_watchers + .entry(id.clone()) + .or_insert_with(Vec::new) + .push(subscription); + } + } + // If the task is not found, drop `stream_sender` which will result in a not found error + } + + fn task_update(&mut self, include: Include) -> tasks::TaskUpdate { + todo!() + } + + fn resource_update(&mut self, include: Include) -> resources::ResourceUpdate { + todo!() + } + + fn async_op_update(&mut self, include: Include) -> async_ops::AsyncOpUpdate { + todo!() + } + + pub async fn run(mut self) { + let mut timer = StreamExt::fuse(async_io::Timer::interval(self.publish_interval)); + loop { + let mut recv = self.rpcs.recv().fuse(); + let should_send: bool = futures_util::select! { + _ = timer.next() => self.running, + cmd = recv => { + match cmd { + Ok(server::Command::Instrument(subscription)) => { + self.add_instrument_subscription(subscription); + } + Ok(server::Command::WatchTaskDetail(request)) => { + } + Ok(server::Command::Pause) => { + self.running = false; + } + Ok(server::Command::Resume) => { + self.running = true; + } + Err(_) => { + tracing::debug!("rpc channel closed, exiting"); + return + } + } + false + }, + }; + + // drain and aggregate buffered events. + // + // Note: we *don't* want to actually await the call to `recv` --- we + // don't want the aggregator task to be woken on every event, + // because it will then be woken when its own `poll` calls are + // exited. that would result in a busy-loop. instead, we only want + // to be woken when the flush interval has elapsed, or when the + // channel is almost full. + let mut drained = false; + while let Ok(event) = self.events.try_recv() { + self.update_state(event); + } + if let Err(TryRecvError::Disconnected) = self.events.try_recv() { + tracing::debug!("event channel closed; terminating"); + return; + } + + // flush data to clients, if there are any currently subscribed + // watchers and we should send a new update. + if !self.watchers.is_empty() && should_send { + self.publish(); + } + } + } + + fn publish(&mut self) { + let new_metadata = if !self.new_metadata.is_empty() { + Some(console_api::RegisterMetadata { + metadata: std::mem::take(&mut self.new_metadata), + }) + } else { + None + }; + let task_update = Some(self.task_update(Include::UpdatedOnly)); + let resource_update = Some(self.resource_update(Include::UpdatedOnly)); + let async_op_update = Some(self.async_op_update(Include::UpdatedOnly)); + + let update = instrument::Update { + now: Some(self.base_time.to_timestamp(Instant::now())), + new_metadata, + task_update, + resource_update, + async_op_update, + }; + + //self.watchers.retain_and_shrink(|watch: &Watch| watch.update + // (&update)); + + let stats = &self.task_stats; + // Assuming there are much fewer task details subscribers than there are + // stats updates, iterate over `details_watchers` and compact the map. + /*self.details_watchers.retain_and_shrink(|id, watchers| { + if let Some(task_stats) = stats.get(id) { + let details = tasks::TaskDetails { + task_id: Some(id.clone().into()), + now: Some(self.base_time.to_timestamp(Instant::now())), + poll_times_histogram: Some(task_stats.poll_duration_histogram()), + }; + watchers.retain(|watch| watch.update(&details)); + !watchers.is_empty() + } else { + false + } + }); + + */ + } + + /// Update the current state with data from a single event. + fn update_state(&mut self, event: Event) { + // do state update + match event { + Event::Metadata(meta) => { + self.all_metadata.push(meta.into()); + self.new_metadata.push(meta.into()); + } + + Event::Spawn { + id, + metadata, + stats, + fields, + location, + } => { + self.tasks.insert( + id.clone(), + Task { + id: id.clone(), + is_dirty: AtomicBool::new(true), + metadata, + fields, + location, + // TODO: parents + }, + ); + + self.task_stats.insert(id, stats); + } + + Event::Resource { + id, + parent_id, + metadata, + kind, + concrete_type, + location, + is_internal, + stats, + } => { + self.resources.insert( + id.clone(), + Resource { + id: id.clone(), + is_dirty: AtomicBool::new(true), + parent_id, + kind, + metadata, + concrete_type, + location, + is_internal, + }, + ); + + self.resource_stats.insert(id, stats); + } + + Event::PollOp { + metadata, + resource_id, + op_name, + async_op_id, + task_id, + is_ready, + } => { + let poll_op = resources::PollOp { + metadata: Some(metadata.into()), + resource_id: Some(resource_id.into()), + name: op_name, + task_id: Some(task_id.into()), + async_op_id: Some(async_op_id.into()), + is_ready, + }; + + self.poll_ops.push(poll_op); + } + + Event::AsyncResourceOp { + id, + source, + resource_id, + metadata, + parent_id, + stats, + } => { + self.async_ops.insert( + id.clone(), + AsyncOp { + id: id.clone(), + is_dirty: AtomicBool::new(true), + resource_id, + metadata, + source, + parent_id, + }, + ); + + self.async_op_stats.insert(id, stats); + } + } } } diff --git a/runtime/console/src/attribute.rs b/runtime/console/src/attribute.rs new file mode 100644 index 0000000..55c2eb8 --- /dev/null +++ b/runtime/console/src/attribute.rs @@ -0,0 +1,30 @@ +use crate::aggregate::Id; +use std::collections::HashMap; + +#[derive(Debug, Default)] +pub(crate) struct Attributes { + attributes: HashMap, +} + +#[derive(Debug, Clone)] +pub(crate) struct Update { + pub(crate) field: console_api::Field, + pub(crate) op: Option, + pub(crate) unit: Option, +} + +#[derive(Debug, Clone)] +pub(crate) enum UpdateOp { + Add, + Override, + Sub, +} + +/// Represents a key for a `proto::field::Name`. Because the +/// proto::field::Name might not be unique we also include the +/// resource id in this key +#[derive(Debug, Hash, PartialEq, Eq)] +struct FieldKey { + update_id: Id, + field_name: console_api::field::Name, +} diff --git a/runtime/console/src/callsites.rs b/runtime/console/src/callsites.rs index 35a0da4..803a86a 100644 --- a/runtime/console/src/callsites.rs +++ b/runtime/console/src/callsites.rs @@ -36,7 +36,7 @@ impl Callsites { while { for cs in &self.array[idx..end] { let ptr = cs.load(Ordering::Acquire); - let meta = unsafe { ptr as *const _ as &Metadata<'static> }; + let meta = unsafe { &*ptr }; if meta.callsite() == callsite.callsite() { return true; } diff --git a/runtime/console/src/event.rs b/runtime/console/src/event.rs index 65b316f..d681715 100644 --- a/runtime/console/src/event.rs +++ b/runtime/console/src/event.rs @@ -1,5 +1,43 @@ +use crate::aggregate::Id; +use crate::stats; +use console_api::resources; +use std::sync::Arc; use tracing_core::Metadata; pub(crate) enum Event { Metadata(&'static Metadata<'static>), + Spawn { + id: Id, + metadata: &'static Metadata<'static>, + stats: Arc, + fields: Vec, + location: Option, + }, + Resource { + id: Id, + parent_id: Option, + metadata: &'static Metadata<'static>, + concrete_type: String, + kind: resources::resource::Kind, + location: Option, + is_internal: bool, + stats: Arc, + }, + PollOp { + metadata: &'static Metadata<'static>, + resource_id: Id, + op_name: String, + async_op_id: Id, + task_id: Id, + is_ready: bool, + }, + AsyncResourceOp { + id: Id, + parent_id: Option, + resource_id: Id, + metadata: &'static Metadata<'static>, + source: String, + + stats: Arc, + }, } diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index b0b8688..de46432 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -13,10 +13,12 @@ use tracing_subscriber::registry::LookupSpan; use tracing_subscriber::Layer; mod aggregate; +mod attribute; mod callsites; mod event; mod server; mod stack; +mod stats; use crate::aggregate::Aggregator; use crate::callsites::Callsites; @@ -46,6 +48,8 @@ pub struct Builder { /// A smaller number will reduce the memory footprint but may lead to more events being dropped /// during activity bursts. event_buffer_capacity: usize, + + client_buffer_capacity: usize, } impl Builder { pub fn build(self) -> (ConsoleLayer, Server) { @@ -59,6 +63,7 @@ impl Default for Builder { server_addr: Server::DEFAULT_ADDR, server_port: Server::DEFAULT_PORT, event_buffer_capacity: ConsoleLayer::DEFAULT_EVENT_BUFFER_CAPACITY, + client_buffer_capacity: 1024, } } } @@ -85,8 +90,9 @@ impl ConsoleLayer { let (tx, events) = crossbeam_channel::bounded(config.event_buffer_capacity); let shared = Arc::new(Shared::default()); - let aggregator = Aggregator::new(events); - let server = Server::new(aggregator); + let (subscribe, rpcs) = async_channel::bounded(config.client_buffer_capacity); + let aggregator = Aggregator::new(events, rpcs); + let server = Server::new(aggregator, config.client_buffer_capacity, subscribe); let layer = Self { current_spans: ThreadLocal::new(), tx, diff --git a/runtime/console/src/server.rs b/runtime/console/src/server.rs index 2bf0ba1..5591206 100644 --- a/runtime/console/src/server.rs +++ b/runtime/console/src/server.rs @@ -1,25 +1,93 @@ +use crate::aggregate::Id; use crate::Aggregator; +use async_channel::{Receiver, Sender}; +use console_api::instrument; use console_api::instrument::instrument_server::{Instrument, InstrumentServer}; -use console_api::instrument::{ - InstrumentRequest, PauseRequest, PauseResponse, ResumeRequest, ResumeResponse, - TaskDetailsRequest, -}; +use console_api::tasks; +use futures_util::TryStreamExt; use std::error::Error; -use std::net::{IpAddr, Ipv6Addr}; +use std::io::IoSlice; +use std::net::{IpAddr, Ipv6Addr, SocketAddr}; +use std::pin::Pin; +use std::task::{Context, Poll}; +use tokio::io::AsyncRead as TokioAsyncRead; +use tokio::io::{AsyncWrite as TokioAsyncWrite, ReadBuf}; +use tonic::transport::server::Connected; +use tonic::Status; + +struct StreamWrapper(T); +impl Connected for StreamWrapper { + type ConnectInfo = (); + + fn connect_info(&self) -> Self::ConnectInfo { + () + } +} +impl TokioAsyncWrite for StreamWrapper { + fn poll_write( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &[u8], + ) -> Poll> { + TokioAsyncWrite::poll_write(Pin::new(&mut self.0), cx, buf) + } + + fn poll_flush( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { + TokioAsyncWrite::poll_flush(Pin::new(&mut self.0), cx) + } + + fn poll_shutdown( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { + TokioAsyncWrite::poll_shutdown(Pin::new(&mut self.0), cx) + } + + fn poll_write_vectored( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + bufs: &[IoSlice<'_>], + ) -> Poll> { + TokioAsyncWrite::poll_write_vectored(Pin::new(&mut self.0), cx, bufs) + } + + fn is_write_vectored(&self) -> bool { + TokioAsyncWrite::is_write_vectored(&self.0) + } +} +impl TokioAsyncRead for StreamWrapper { + fn poll_read( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut ReadBuf<'_>, + ) -> Poll> { + TokioAsyncRead::poll_read(Pin::new(&mut self.0), cx, buf) + } +} pub struct Server { aggregator: Aggregator, client_buffer_size: usize, + subscribe: Sender, } impl Server { pub(crate) const DEFAULT_ADDR: IpAddr = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); pub(crate) const DEFAULT_PORT: u16 = 49289; - pub(crate) fn new(aggregator: Aggregator, client_buffer_size: usize) -> Self { + pub(crate) fn new( + aggregator: Aggregator, + client_buffer_size: usize, + subscribe: Sender, + ) -> Self { + let subscribe = todo!(); Self { aggregator, client_buffer_size, + subscribe, } } @@ -32,8 +100,12 @@ impl Server { let svc = InstrumentServer::new(self); // The gRPC server task; requires a `Stream` of `tokio::AsyncRead + tokio::AsyncWrite`. - // TODO: Pass an async listening socket that implements the tokio versions of Read/Write - let incoming = todo!(); + let listener = + async_net::TcpListener::bind(SocketAddr::new(Self::DEFAULT_ADDR, Self::DEFAULT_PORT)) + .await?; + let incoming = listener + .incoming() + .map_ok(|stream| StreamWrapper(async_compat::Compat::new(stream))); tonic::transport::Server::builder() .add_service(svc) .serve_with_incoming(incoming) @@ -45,51 +117,110 @@ impl Server { } } +pub(crate) struct Watch(pub(crate) Sender>); +impl Watch { + pub fn update(&self, update: &T) -> bool { + self.0.try_send(Ok(update.clone())).is_ok() + } +} + +pub(crate) struct WatchRequest { + pub id: Id, + pub stream_sender: async_oneshot::Sender>>, + pub buffer: usize, +} + +pub(crate) enum Command { + Instrument(Watch), + WatchTaskDetail(WatchRequest), + Pause, + Resume, +} + #[tonic::async_trait] impl Instrument for Server { - type WatchUpdatesStream = (); + type WatchUpdatesStream = async_channel::Receiver>; async fn watch_updates( &self, - request: tonic::Request, + request: tonic::Request, ) -> Result, tonic::Status> { - /* match request.remote_addr() { Some(addr) => tracing::debug!(client.addr = %addr, "starting a new watch"), None => tracing::debug!(client.addr = %"", "starting a new watch"), } - let permit = self.subscribe.reserve().await.map_err(|_| { - tonic::Status::internal("cannot start new watch, aggregation task is not running") - })?; - let (tx, rx) = mpsc::channel(self.client_buffer); - permit.send(Command::Instrument(Watch(tx))); - tracing::debug!("watch started"); - let stream = tokio_stream::wrappers::ReceiverStream::new(rx); - Ok(tonic::Response::new(stream)) - */ - todo!() + + if !self.subscribe.is_full() { + let (tx, rx) = async_channel::bounded(self.client_buffer_size); + self.subscribe.send(Command::Instrument(Watch(tx))).await; + tracing::debug!("watch started"); + Ok(tonic::Response::new(rx)) + } else { + Err(tonic::Status::internal( + "cannot start new watch, aggregation task is not running", + )) + } } - type WatchTaskDetailsStream = (); + type WatchTaskDetailsStream = async_channel::Receiver>; async fn watch_task_details( &self, - request: tonic::Request, + request: tonic::Request, ) -> Result, tonic::Status> { - todo!() + let task_id = request + .into_inner() + .id + .ok_or_else(|| tonic::Status::invalid_argument("missing task_id"))? + .id; + + // `tracing` reserves span ID 0 for niche optimization for `Option`. + let id = std::num::NonZeroU64::new(task_id) + .map(Id::from_non_zero_u64) + .ok_or_else(|| tonic::Status::invalid_argument("task_id cannot be 0"))?; + + if !self.subscribe.is_full() { + // Check with the aggregator task to request a stream if the task exists. + let (stream_sender, stream_recv) = async_oneshot::oneshot(); + self.subscribe + .send(Command::WatchTaskDetail(WatchRequest { + id, + stream_sender, + buffer: self.client_buffer_size, + })) + .await; + // If the aggregator drops the sender, the task doesn't exist. + let rx = stream_recv.await.map_err(|_| { + tracing::warn!(id = ?task_id, "requested task not found"); + tonic::Status::not_found("task not found") + })?; + + tracing::debug!(id = ?task_id, "task details watch started"); + Ok(tonic::Response::new(rx)) + } else { + Err(tonic::Status::internal( + "cannot start new watch, aggregation task is not running", + )) + } } async fn pause( &self, - request: tonic::Request, - ) -> Result, tonic::Status> { - todo!() + _request: tonic::Request, + ) -> Result, tonic::Status> { + self.subscribe.send(Command::Pause).await.map_err(|_| { + tonic::Status::internal("cannot pause, aggregation task is not running") + })?; + Ok(tonic::Response::new(instrument::PauseResponse {})) } async fn resume( &self, - request: tonic::Request, - ) -> Result, tonic::Status> { - todo!() + _request: tonic::Request, + ) -> Result, tonic::Status> { + self.subscribe.send(Command::Resume).await.map_err(|_| { + tonic::Status::internal("cannot resume, aggregation task is not running") + })?; + Ok(tonic::Response::new(instrument::ResumeResponse {})) } } diff --git a/runtime/console/src/stats.rs b/runtime/console/src/stats.rs new file mode 100644 index 0000000..d2bf2af --- /dev/null +++ b/runtime/console/src/stats.rs @@ -0,0 +1,161 @@ +use crate::aggregate::Id; +use crate::attribute; +use crossbeam_utils::atomic::AtomicCell; +use hdrhistogram::serialization::{Serializer, V2Serializer}; +use std::sync::atomic::{AtomicBool, AtomicUsize}; +use std::sync::Mutex; +use std::time::{Duration, Instant, SystemTime}; + +/// Anchors an `Instant` with a `SystemTime` timestamp to allow converting +/// monotonic `Instant`s into timestamps that can be sent over the wire. +#[derive(Debug, Clone)] +pub(crate) struct TimeAnchor { + mono: Instant, + sys: SystemTime, +} + +impl TimeAnchor { + pub(crate) fn new() -> Self { + Self { + mono: Instant::now(), + sys: SystemTime::now(), + } + } + + pub(crate) fn to_system_time(&self, t: Instant) -> SystemTime { + let dur = t + .checked_duration_since(self.mono) + .unwrap_or_else(|| Duration::from_secs(0)); + self.sys + dur + } + + pub(crate) fn to_timestamp(&self, t: Instant) -> prost_types::Timestamp { + self.to_system_time(t).into() + } +} + +#[derive(Debug, Default)] +struct PollStats { + /// The number of polls in progress + current_polls: AtomicUsize, + /// The total number of polls + polls: AtomicUsize, + timestamps: Mutex>, +} + +/// Stats associated with a task. +#[derive(Debug)] +pub(crate) struct TaskStats { + is_dirty: AtomicBool, + is_dropped: AtomicBool, + // task stats + pub(crate) created_at: Instant, + timestamps: Mutex, + + // waker stats + wakes: AtomicUsize, + waker_clones: AtomicUsize, + waker_drops: AtomicUsize, + self_wakes: AtomicUsize, + + /// Poll durations and other stats. + poll_stats: PollStats, +} + +impl TaskStats { + pub(crate) fn poll_duration_histogram( + &self, + ) -> console_api::tasks::task_details::PollTimesHistogram { + let hist = self + .poll_stats + .timestamps + .lock() + .unwrap() + .histogram + .to_proto(); + console_api::tasks::task_details::PollTimesHistogram::Histogram(hist) + } +} + +/// Stats associated with an async operation. +/// +/// This shares all of the same fields as [`ResourceStats]`, with the addition +/// of [`PollStats`] tracking when the async operation is polled, and the task +/// ID of the last task to poll the async op. +#[derive(Debug)] +pub(crate) struct AsyncOpStats { + /// The task ID of the last task to poll this async op. + /// + /// This is set every time the async op is polled, in case a future is + /// passed between tasks. + task_id: AtomicCell, + + /// Fields shared with `ResourceStats`. + pub(crate) stats: ResourceStats, + + /// Poll durations and other stats. + poll_stats: PollStats<()>, +} + +/// Stats associated with a resource. +#[derive(Debug)] +pub(crate) struct ResourceStats { + is_dirty: AtomicBool, + is_dropped: AtomicBool, + created_at: Instant, + dropped_at: Mutex>, + attributes: Mutex, + pub(crate) inherit_child_attributes: bool, + pub(crate) parent_id: Option, +} + +#[derive(Debug, Default)] +struct TaskTimestamps { + dropped_at: Option, + last_wake: Option, +} + +#[derive(Debug, Default)] +struct PollTimestamps { + first_poll: Option, + last_poll_started: Option, + last_poll_ended: Option, + busy_time: Duration, + histogram: H, +} + +#[derive(Debug)] +struct Histogram { + histogram: hdrhistogram::Histogram, + max: u64, + outliers: u64, + max_outlier: Option, +} + +impl Histogram { + fn new(max: u64) -> Self { + // significant figures should be in the [0-5] range and memory usage + // grows exponentially with higher a sigfig + let histogram = hdrhistogram::Histogram::new_with_max(max, 2).unwrap(); + Self { + histogram, + max, + max_outlier: None, + outliers: 0, + } + } + + fn to_proto(&self) -> console_api::tasks::DurationHistogram { + let mut serializer = V2Serializer::new(); + let mut raw_histogram = Vec::new(); + serializer + .serialize(&self.histogram, &mut raw_histogram) + .expect("histogram failed to serialize"); + console_api::tasks::DurationHistogram { + raw_histogram, + max_value: self.max, + high_outliers: self.outliers, + highest_outlier: self.max_outlier, + } + } +} From 287ca9806de62af293a19f7f97eb72c763a10ae0 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Jun 2022 22:23:55 +0200 Subject: [PATCH 27/51] Console is attached and compiles --- Cargo.lock | 538 +++++++++++++++---------------- Cargo.toml | 7 +- bffhd/lib.rs | 7 +- bffhd/logging.rs | 25 +- runtime/console/Cargo.toml | 5 +- runtime/console/src/aggregate.rs | 168 +++++++--- runtime/console/src/attribute.rs | 85 ++++- runtime/console/src/event.rs | 43 ++- runtime/console/src/id_map.rs | 126 ++++++++ runtime/console/src/lib.rs | 357 +++++++++++++++++++- runtime/console/src/server.rs | 30 +- runtime/console/src/stats.rs | 460 +++++++++++++++++++++++++- runtime/console/src/visitors.rs | 529 ++++++++++++++++++++++++++++++ 13 files changed, 2008 insertions(+), 372 deletions(-) create mode 100644 runtime/console/src/id_map.rs create mode 100644 runtime/console/src/visitors.rs diff --git a/Cargo.lock b/Cargo.lock index d9e4bbb..164f0c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,14 +161,14 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.0.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026b7e44f1316b567ee750fea85103f87fcb80792b860e979f221259796ca0a" +checksum = "5262ed948da60dd8956c6c5aca4d4163593dddb7b32d73267c93dab7b2e98940" dependencies = [ "async-channel", "async-executor", "async-io", - "async-mutex", + "async-lock", "blocking", "futures-lite", "num_cpus", @@ -203,15 +203,6 @@ dependencies = [ "event-listener", ] -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - [[package]] name = "async-net" version = "1.6.1" @@ -251,9 +242,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-channel", "async-global-executor", @@ -268,7 +259,6 @@ dependencies = [ "kv-log-macro", "log", "memchr", - "num_cpus", "once_cell", "pin-project-lite", "pin-utils", @@ -305,9 +295,9 @@ checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" [[package]] name = "async-trait" -version = "0.1.52" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" +checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" dependencies = [ "proc-macro2", "quote", @@ -339,9 +329,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.5.4" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4af7447fc1214c1f3a1ace861d0216a6c8bb13965b64bbad9650f375b67689a" +checksum = "33d590cacd53140ff87cc2e192eb22fc3dc23c5b3f93b0d4f020677f98e8c629" dependencies = [ "async-trait", "axum-core", @@ -351,7 +341,7 @@ dependencies = [ "http", "http-body", "hyper", - "itoa 1.0.1", + "itoa 1.0.2", "matchit", "memchr", "mime", @@ -368,9 +358,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdc19781b16e32f8a7200368a336fa4509d4b72ef15dd4e41df5290855ee1e6" +checksum = "cf4d047478b986f14a13edad31a009e2e05cb241f9805d0d75e4cba4e129ad4d" dependencies = [ "async-trait", "bytes", @@ -498,9 +488,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] name = "byte-tools" @@ -510,9 +500,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytecheck" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "314889ea31cda264cb7c3d6e6e5c9415a987ecb0e72c17c00d36fbb881d34abe" +checksum = "3a31f923c2db9513e4298b72df143e6e655a759b3d6a0966df18f81223fff54f" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -520,9 +510,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a2b3b92c135dae665a6f760205b89187638e83bed17ef3e44e83c712cf30600" +checksum = "edb17c862a905d912174daa27ae002326fff56dc8b8ada50a0a5f0976cb174f0" dependencies = [ "proc-macro2", "quote", @@ -549,9 +539,9 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" [[package]] name = "capnp" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c262726f68118392269a3f7a5546baf51dcfe5cb3c3f0957b502106bf1a065" +checksum = "21d5d7da973146f1720672faa44f1523cc8f923636190ca1a931c7bc8834de68" [[package]] name = "capnp-futures" @@ -643,20 +633,29 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.6" +version = "3.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" +checksum = "9f1fe12880bae935d142c8702d500c63a4e8634b6c3c57ad72bf978fc7b6249a" dependencies = [ "atty", "bitflags", + "clap_lex", "indexmap", - "lazy_static", - "os_str_bytes", + "once_cell", "strsim", "termcolor", "textwrap 0.15.0", ] +[[package]] +name = "clap_lex" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87eba3c8c7f42ef17f6c659fc7416d0f4758cd3e58861ee63c5fa4a4dde649e4" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "concurrent-queue" version = "1.2.2" @@ -688,7 +687,7 @@ dependencies = [ "tonic", "tracing", "tracing-core", - "tracing-subscriber 0.3.9", + "tracing-subscriber", ] [[package]] @@ -705,9 +704,9 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.23" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0936ffe6d0c8d6a51b3b0a73b2acbe925d786f346cf45bfddc8341d79fb7dc8a" +checksum = "2906f2480cdc015e998deac388331a0f1c1cd88744948c749513020c83c370bc" dependencies = [ "const_format_proc_macros", ] @@ -747,9 +746,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] @@ -815,9 +814,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbfe11fe19ff083c48923cf179540e8cd0535903dc35e178a1fdeeb59aef51f" +checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ "cfg-if", "crossbeam-utils", @@ -836,15 +835,15 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] @@ -860,12 +859,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978" dependencies = [ "cfg-if", - "lazy_static", + "once_cell", ] [[package]] @@ -892,9 +891,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" +checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" dependencies = [ "quote", "syn", @@ -913,9 +912,9 @@ dependencies = [ [[package]] name = "desfire" -version = "0.2.0-alpha1" +version = "0.2.0-alpha2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83dddd3136b4dfc80f46dc6441cd3f16f99317e645bedc61eabc1452d24bfb3f" +checksum = "337f0fcd6ef888be0962aeff547f1b219f4190ea785b5c33328f071e91405411" dependencies = [ "aes", "block-modes", @@ -978,7 +977,8 @@ dependencies = [ "capnp", "capnp-rpc", "chrono", - "clap 3.1.6", + "clap 3.2.6", + "console", "desfire", "dirs", "erased-serde", @@ -1020,7 +1020,7 @@ dependencies = [ "toml", "tracing", "tracing-futures", - "tracing-subscriber 0.2.25", + "tracing-subscriber", "url", "uuid", ] @@ -1054,9 +1054,9 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", @@ -1092,9 +1092,9 @@ dependencies = [ [[package]] name = "erased-serde" -version = "0.3.18" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56047058e1ab118075ca22f9ecd737bcc961aa3566a3019cb71388afa280bd8a" +checksum = "81d013529d5574a60caeda29e179e695125448e5de52e3874f7b4c1d7360e18e" dependencies = [ "serde", ] @@ -1128,7 +1128,7 @@ dependencies = [ "rand", "slab", "tracing", - "tracing-subscriber 0.3.9", + "tracing-subscriber", ] [[package]] @@ -1257,9 +1257,9 @@ dependencies = [ [[package]] name = "futures-rustls" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d383f0425d991a05e564c2f3ec150bd6dde863179c131dd60d8aa73a05434461" +checksum = "e01fe9932a224b72b45336d96040aa86386d674a31d0af27d800ea7bc8ca97fe" dependencies = [ "futures-io", "rustls", @@ -1268,9 +1268,9 @@ dependencies = [ [[package]] name = "futures-signals" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439b5920b9dc57ddd4a959b4b1c0eb9a68ded001f1e331d422b0a68ef2928c5f" +checksum = "633f5e17d6fb8d3cfa0710087d0cbe708d07cc416ca6c4682ce876aa7839c09d" dependencies = [ "discard", "futures-channel", @@ -1355,20 +1355,20 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] name = "ghost" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479" +checksum = "76c813ffb63e8fd3df6f1ac3cc1ea392c7612ac2de4d0b44dcbfe03e5c4bf94a" dependencies = [ "proc-macro2", "quote", @@ -1402,9 +1402,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "gloo-timers" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" dependencies = [ "futures-channel", "futures-core", @@ -1439,15 +1439,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - -[[package]] -name = "hashbrown" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758" +checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" dependencies = [ "ahash", ] @@ -1486,13 +1480,13 @@ dependencies = [ [[package]] name = "http" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.1", + "itoa 1.0.2", ] [[package]] @@ -1539,7 +1533,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.1", + "itoa 1.0.2", "pin-project-lite", "socket2", "tokio", @@ -1573,12 +1567,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown", ] [[package]] @@ -1650,9 +1644,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "jobserver" @@ -1665,9 +1659,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.56" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" dependencies = [ "wasm-bindgen", ] @@ -1702,9 +1696,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.120" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libgit2-sys" @@ -1720,9 +1714,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.6" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "libc", @@ -1789,9 +1783,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", "value-bag", @@ -1805,9 +1799,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "matchers" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ "regex-automata", ] @@ -1826,9 +1820,9 @@ checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" @@ -1893,25 +1887,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba42135c6a5917b9db9cd7b293e5409e1c6b041e6f9825e92e55a894c63b6f8" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "miow", - "ntapi", "wasi 0.11.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -1948,15 +1931,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - [[package]] name = "num-derive" version = "0.3.3" @@ -1970,9 +1944,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -1980,9 +1954,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -2008,9 +1982,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" [[package]] name = "oorandom" @@ -2038,12 +2012,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] +checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" [[package]] name = "owo-colors" @@ -2150,9 +2121,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -2162,9 +2133,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "plotters" @@ -2230,11 +2201,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -2292,9 +2263,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.15" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" dependencies = [ "proc-macro2", ] @@ -2331,9 +2302,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -2343,41 +2314,41 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", "redox_syscall", + "thiserror", ] [[package]] name = "regex" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ "aho-corasick", "memchr", @@ -2395,9 +2366,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "remove_dir_all" @@ -2434,12 +2405,12 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.36" +version = "0.7.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5230ae2981a885590b0dc84e0b24c0ed23ad24f7adc0eb824b26cafa961f7c36" +checksum = "517a3034eb2b1499714e9d1e49b2367ad567e07639b69776d35e259d9c27cca6" dependencies = [ "bytecheck", - "hashbrown 0.12.0", + "hashbrown", "ptr_meta", "rend", "rkyv_derive", @@ -2448,9 +2419,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.36" +version = "0.7.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc752d5925dbcb324522f3a4c93193d17f107b2e11810913aa3ad352fa01480" +checksum = "505c209ee04111a006431abf39696e640838364d67a107c559ababaf6fd8c9dd" dependencies = [ "proc-macro2", "quote", @@ -2459,9 +2430,9 @@ dependencies = [ [[package]] name = "rkyv_dyn" -version = "0.7.33" +version = "0.7.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed5db4771a89bfd4ec32b790d09d1b03b7d6b888cb8d12877a6310def8f0118" +checksum = "b7c7adf3c35f3c1d8aa1f3a573e91d38c0da8110e99f4ff0006def9691025db2" dependencies = [ "inventory", "lazy_static", @@ -2473,9 +2444,9 @@ dependencies = [ [[package]] name = "rkyv_dyn_derive" -version = "0.7.33" +version = "0.7.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec9b321e2966c8f1f086b7e6180c10af688ac590461c9e6395895ddedba753" +checksum = "d8079a7a86551483b68603bd3712c332e8adfd3a2747a8f51a65cd8b7412b98b" dependencies = [ "proc-macro2", "quote", @@ -2559,9 +2530,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.4" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921" +checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" dependencies = [ "log", "ring", @@ -2571,25 +2542,16 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca9ebdfa27d3fc180e42879037b5338ab1c040c06affd00d8338598e7800943" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" dependencies = [ "openssl-probe", - "rustls-pemfile 0.2.1", + "rustls-pemfile 1.0.0", "schannel", "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" -dependencies = [ - "base64", -] - [[package]] name = "rustls-pemfile" version = "0.3.0" @@ -2600,10 +2562,19 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.9" +name = "rustls-pemfile" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" +dependencies = [ + "base64", +] + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" @@ -2616,12 +2587,12 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "winapi", + "windows-sys", ] [[package]] @@ -2690,15 +2661,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" +checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] @@ -2715,9 +2686,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -2739,11 +2710,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ - "itoa 1.0.1", + "itoa 1.0.2", "ryu", "serde", ] @@ -2796,9 +2767,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" dependencies = [ "libc", "signal-hook-registry", @@ -2833,9 +2804,9 @@ checksum = "cc47a29ce97772ca5c927f75bac34866b16d64e07f330c3248e2d7226623901b" [[package]] name = "slab" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" @@ -2923,13 +2894,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.88" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd69e719f31e88618baa1eaa6ee2de5c9a1c004f1e9ecdb58e8352a13f20a01" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -3022,11 +2993,12 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] @@ -3042,9 +3014,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -3084,9 +3056,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -3095,9 +3067,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.2" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ "rustls", "tokio", @@ -3131,9 +3103,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] @@ -3223,9 +3195,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.32" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ "cfg-if", "log", @@ -3236,9 +3208,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ "proc-macro2", "quote", @@ -3247,11 +3219,11 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" +checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921" dependencies = [ - "lazy_static", + "once_cell", "valuable", ] @@ -3269,59 +3241,31 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" dependencies = [ "lazy_static", "log", "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" -version = "0.2.25" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" dependencies = [ "ansi_term", - "chrono", "lazy_static", "matchers", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec", "thread_local", "tracing", "tracing-core", "tracing-log", - "tracing-serde", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce" -dependencies = [ - "ansi_term", - "sharded-slab", - "smallvec", - "thread_local", - "tracing-core", - "tracing-log", ] [[package]] @@ -3332,13 +3276,14 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "trybuild" -version = "1.0.56" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d60539445867cdd9680b2bfe2d0428f1814b7d5c9652f09d8d3eae9d19308db" +checksum = "764b9e244b482a9b81bde596aa37aa6f1347bf8007adab25e59f901b32b4e0a0" dependencies = [ "glob", "once_cell", "serde", + "serde_derive", "serde_json", "termcolor", "toml", @@ -3364,9 +3309,15 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-linebreak" @@ -3394,9 +3345,9 @@ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "untrusted" @@ -3434,9 +3385,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.0.0-alpha.8" +version = "1.0.0-alpha.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" dependencies = [ "ctor", "version_check", @@ -3483,9 +3434,9 @@ dependencies = [ [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasi" @@ -3495,9 +3446,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3505,9 +3456,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" dependencies = [ "bumpalo", "lazy_static", @@ -3520,9 +3471,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.29" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" +checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ "cfg-if", "js-sys", @@ -3532,9 +3483,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3542,9 +3493,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" dependencies = [ "proc-macro2", "quote", @@ -3555,15 +3506,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] name = "web-sys" -version = "0.3.56" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" dependencies = [ "js-sys", "wasm-bindgen", @@ -3618,3 +3569,46 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" diff --git a/Cargo.toml b/Cargo.toml index 21b74fd..fdae5ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ dirs = "4.0.0" # Runtime executor = { path = "runtime/executor" } +console = { path = "runtime/console" } # Catch&Handle POSIX process signals signal-hook = "0.3.13" @@ -72,9 +73,9 @@ rust-argon2 = "0.8.3" rand = "0.8.4" # Async aware logging and tracing -tracing = "0.1.28" -tracing-subscriber = { version = "0.2.25", features = ["env-filter"] } -tracing-futures = { version = "0.2.5", features = ["futures-03"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter", "registry", "std"] } +tracing-futures = { version = "0.2", features = ["futures-03"] } # API api = { path = "api" } diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 21ff90c..e0c9d86 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -76,7 +76,7 @@ pub static RESOURCES: OnceCell = OnceCell::new(); impl Diflouroborane { pub fn new(config: Config) -> miette::Result { - logging::init(&config.logging); + let mut server = logging::init(&config.logging); tracing::info!(version = env::VERSION, "Starting BFFH"); let span = tracing::info_span!("setup"); @@ -84,6 +84,11 @@ impl Diflouroborane { let executor = Executor::new(); + if let Some(aggregator) = server.aggregator.take() { + executor.spawn(aggregator.run()); + } + executor.spawn(server.serve()); + let env = StateDB::open_env(&config.db_path)?; let statedb = StateDB::create_with_env(env.clone())?; diff --git a/bffhd/logging.rs b/bffhd/logging.rs index 026e83d..51d9832 100644 --- a/bffhd/logging.rs +++ b/bffhd/logging.rs @@ -1,6 +1,7 @@ use tracing_subscriber::EnvFilter; use serde::{Deserialize, Serialize}; +use tracing_subscriber::prelude::*; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LogConfig { @@ -24,21 +25,25 @@ impl Default for LogConfig { } } -pub fn init(config: &LogConfig) { +pub fn init(config: &LogConfig) -> console::Server { + let (console, server) = console::ConsoleLayer::new(); + let filter = if let Some(ref filter) = config.filter { EnvFilter::new(filter.as_str()) } else { EnvFilter::from_env("BFFH_LOG") }; - let builder = tracing_subscriber::fmt().with_env_filter(filter); + let format = &config.format; + // TODO: Restore output format settings being settable + let fmt_layer = tracing_subscriber::fmt::layer().with_filter(filter); - let format = config.format.to_lowercase(); - match format.as_str() { - "compact" => builder.compact().init(), - "pretty" => builder.pretty().init(), - "full" => builder.init(), - _ => builder.init(), - } - tracing::info!(format = format.as_str(), "Logging initialized") + tracing_subscriber::registry() + .with(fmt_layer) + .with(console) + .init(); + + tracing::info!(format = format.as_str(), "Logging initialized"); + + server } diff --git a/runtime/console/Cargo.toml b/runtime/console/Cargo.toml index fd823e8..82c629a 100644 --- a/runtime/console/Cargo.toml +++ b/runtime/console/Cargo.toml @@ -24,4 +24,7 @@ async-io = "1.7" tokio-util = "0.7" futures-util = "0.3" tokio = { version = "1.19", default_features = false, features = []} -hdrhistogram = "7.5" \ No newline at end of file +hdrhistogram = "7.5" + +[dev-dependencies] +tracing-subscriber = "0.3" diff --git a/runtime/console/src/aggregate.rs b/runtime/console/src/aggregate.rs index 25fb192..1acf6d2 100644 --- a/runtime/console/src/aggregate.rs +++ b/runtime/console/src/aggregate.rs @@ -1,35 +1,24 @@ +use crate::id_map::{IdMap, ToProto}; use crate::server::{Watch, WatchRequest}; -use crate::stats::TimeAnchor; -use crate::Event; +use crate::stats::{TimeAnchor, Unsent}; use crate::{server, stats}; +use crate::{Event, Shared}; use console_api::{async_ops, instrument, resources, tasks}; use crossbeam_channel::{Receiver, TryRecvError}; use futures_util::{FutureExt, StreamExt}; +use std::collections::HashMap; use std::num::NonZeroU64; -use std::sync::atomic::AtomicBool; +use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::time::{Duration, Instant}; +use tracing::span; use tracing_core::Metadata; -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -pub(crate) struct Id(NonZeroU64); - -impl Id { - pub fn from_non_zero_u64(u: NonZeroU64) -> Self { - Self(u) - } -} - -impl Into for Id { - fn into(self) -> console_api::Id { - console_api::Id { id: self.0.into() } - } -} - +#[derive(Debug)] struct Resource { - id: Id, + id: span::Id, is_dirty: AtomicBool, - parent_id: Option, + parent_id: Option, metadata: &'static Metadata<'static>, concrete_type: String, kind: resources::resource::Kind, @@ -38,36 +27,114 @@ struct Resource { } /// Represents static data for tasks +#[derive(Debug)] struct Task { - id: Id, + id: span::Id, is_dirty: AtomicBool, metadata: &'static Metadata<'static>, fields: Vec, location: Option, } +#[derive(Debug)] struct AsyncOp { - id: Id, + id: span::Id, is_dirty: AtomicBool, - parent_id: Option, - resource_id: Id, + parent_id: Option, + resource_id: span::Id, metadata: &'static Metadata<'static>, source: String, } +impl ToProto for Task { + type Output = tasks::Task; + + fn to_proto(&self, _: &stats::TimeAnchor) -> Self::Output { + tasks::Task { + id: Some(self.id.clone().into()), + // TODO: more kinds of tasks... + kind: tasks::task::Kind::Spawn as i32, + metadata: Some(self.metadata.into()), + parents: Vec::new(), // TODO: implement parents nicely + fields: self.fields.clone(), + location: self.location.clone(), + } + } +} + +impl Unsent for Task { + fn take_unsent(&self) -> bool { + self.is_dirty.swap(false, Ordering::AcqRel) + } + + fn is_unsent(&self) -> bool { + self.is_dirty.load(Ordering::Acquire) + } +} + +impl ToProto for Resource { + type Output = resources::Resource; + + fn to_proto(&self, _: &stats::TimeAnchor) -> Self::Output { + resources::Resource { + id: Some(self.id.clone().into()), + parent_resource_id: self.parent_id.clone().map(Into::into), + kind: Some(self.kind.clone()), + metadata: Some(self.metadata.into()), + concrete_type: self.concrete_type.clone(), + location: self.location.clone(), + is_internal: self.is_internal, + } + } +} + +impl Unsent for Resource { + fn take_unsent(&self) -> bool { + self.is_dirty.swap(false, Ordering::AcqRel) + } + + fn is_unsent(&self) -> bool { + self.is_dirty.load(Ordering::Acquire) + } +} + +impl ToProto for AsyncOp { + type Output = async_ops::AsyncOp; + + fn to_proto(&self, _: &stats::TimeAnchor) -> Self::Output { + async_ops::AsyncOp { + id: Some(self.id.clone().into()), + metadata: Some(self.metadata.into()), + resource_id: Some(self.resource_id.clone().into()), + source: self.source.clone(), + parent_async_op_id: self.parent_id.clone().map(Into::into), + } + } +} + +impl Unsent for AsyncOp { + fn take_unsent(&self) -> bool { + self.is_dirty.swap(false, Ordering::AcqRel) + } + + fn is_unsent(&self) -> bool { + self.is_dirty.load(Ordering::Acquire) + } +} + #[derive(Copy, Clone, Eq, PartialEq)] pub(crate) enum Include { All, UpdatedOnly, } -type IdMap = std::collections::HashMap; - -pub(crate) struct Aggregator { +#[derive(Debug)] +pub struct Aggregator { + shared: Arc, events: Receiver, rpcs: async_channel::Receiver, watchers: Vec>, - details_watchers: IdMap>>, + details_watchers: HashMap>>, all_metadata: Vec, new_metadata: Vec, running: bool, @@ -83,23 +150,28 @@ pub(crate) struct Aggregator { } impl Aggregator { - pub fn new(events: Receiver, rpcs: async_channel::Receiver) -> Self { + pub(crate) fn new( + shared: Arc, + events: Receiver, + rpcs: async_channel::Receiver, + ) -> Self { Self { + shared, events, rpcs, watchers: Vec::new(), - details_watchers: IdMap::new(), + details_watchers: HashMap::default(), running: true, publish_interval: Duration::from_secs(1), all_metadata: Vec::new(), new_metadata: Vec::new(), base_time: TimeAnchor::new(), - tasks: IdMap::new(), - task_stats: IdMap::new(), - resources: IdMap::new(), - resource_stats: IdMap::new(), - async_ops: IdMap::new(), - async_op_stats: IdMap::new(), + tasks: IdMap::default(), + task_stats: IdMap::default(), + resources: IdMap::default(), + resource_stats: IdMap::default(), + async_ops: IdMap::default(), + async_op_stats: IdMap::default(), poll_ops: Vec::new(), } } @@ -163,15 +235,32 @@ impl Aggregator { } fn task_update(&mut self, include: Include) -> tasks::TaskUpdate { - todo!() + tasks::TaskUpdate { + new_tasks: self.tasks.as_proto_list(include, &self.base_time), + stats_update: self.task_stats.as_proto(include, &self.base_time), + dropped_events: self.shared.dropped_tasks.swap(0, Ordering::AcqRel) as u64, + } } fn resource_update(&mut self, include: Include) -> resources::ResourceUpdate { - todo!() + let new_poll_ops = match include { + Include::All => self.poll_ops.clone(), + Include::UpdatedOnly => std::mem::take(&mut self.poll_ops), + }; + resources::ResourceUpdate { + new_resources: self.resources.as_proto_list(include, &self.base_time), + stats_update: self.resource_stats.as_proto(include, &self.base_time), + new_poll_ops, + dropped_events: self.shared.dropped_resources.swap(0, Ordering::AcqRel) as u64, + } } fn async_op_update(&mut self, include: Include) -> async_ops::AsyncOpUpdate { - todo!() + async_ops::AsyncOpUpdate { + new_async_ops: self.async_ops.as_proto_list(include, &self.base_time), + stats_update: self.async_op_stats.as_proto(include, &self.base_time), + dropped_events: self.shared.dropped_async_ops.swap(0, Ordering::AcqRel) as u64, + } } pub async fn run(mut self) { @@ -210,7 +299,6 @@ impl Aggregator { // exited. that would result in a busy-loop. instead, we only want // to be woken when the flush interval has elapsed, or when the // channel is almost full. - let mut drained = false; while let Ok(event) = self.events.try_recv() { self.update_state(event); } diff --git a/runtime/console/src/attribute.rs b/runtime/console/src/attribute.rs index 55c2eb8..b012129 100644 --- a/runtime/console/src/attribute.rs +++ b/runtime/console/src/attribute.rs @@ -1,11 +1,94 @@ -use crate::aggregate::Id; use std::collections::HashMap; +use tracing_core::span::Id; #[derive(Debug, Default)] pub(crate) struct Attributes { attributes: HashMap, } +impl Attributes { + pub(crate) fn values(&self) -> impl Iterator { + self.attributes.values() + } + + pub(crate) fn update(&mut self, id: &Id, update: &Update) { + let field_name = match update.field.name.as_ref() { + Some(name) => name.clone(), + None => { + tracing::warn!(?update.field, "field missing name, skipping..."); + return; + } + }; + let update_id = id.clone(); + let key = FieldKey { + update_id, + field_name, + }; + + self.attributes + .entry(key) + .and_modify(|attr| update_attribute(attr, update)) + .or_insert_with(|| update.clone().into()); + } +} + +fn update_attribute(attribute: &mut console_api::Attribute, update: &Update) { + use console_api::field::Value::*; + let attribute_val = attribute.field.as_mut().and_then(|a| a.value.as_mut()); + let update_val = update.field.value.clone(); + let update_name = update.field.name.clone(); + match (attribute_val, update_val) { + (Some(BoolVal(v)), Some(BoolVal(upd))) => *v = upd, + + (Some(StrVal(v)), Some(StrVal(upd))) => *v = upd, + + (Some(DebugVal(v)), Some(DebugVal(upd))) => *v = upd, + + (Some(U64Val(v)), Some(U64Val(upd))) => match update.op { + Some(UpdateOp::Add) => *v = v.saturating_add(upd), + + Some(UpdateOp::Sub) => *v = v.saturating_sub(upd), + + Some(UpdateOp::Override) => *v = upd, + + None => tracing::warn!( + "numeric attribute update {:?} needs to have an op field", + update_name + ), + }, + + (Some(I64Val(v)), Some(I64Val(upd))) => match update.op { + Some(UpdateOp::Add) => *v = v.saturating_add(upd), + + Some(UpdateOp::Sub) => *v = v.saturating_sub(upd), + + Some(UpdateOp::Override) => *v = upd, + + None => tracing::warn!( + "numeric attribute update {:?} needs to have an op field", + update_name + ), + }, + + (val, update) => { + tracing::warn!( + "attribute {:?} cannot be updated by update {:?}", + val, + update + ); + } + } +} + +impl From for console_api::Attribute { + fn from(upd: Update) -> Self { + console_api::Attribute { + field: Some(upd.field), + unit: upd.unit, + } + } +} + #[derive(Debug, Clone)] pub(crate) struct Update { pub(crate) field: console_api::Field, diff --git a/runtime/console/src/event.rs b/runtime/console/src/event.rs index d681715..5cbe6ec 100644 --- a/runtime/console/src/event.rs +++ b/runtime/console/src/event.rs @@ -1,21 +1,21 @@ -use crate::aggregate::Id; use crate::stats; use console_api::resources; use std::sync::Arc; +use tracing::span; use tracing_core::Metadata; pub(crate) enum Event { Metadata(&'static Metadata<'static>), Spawn { - id: Id, + id: span::Id, metadata: &'static Metadata<'static>, stats: Arc, fields: Vec, location: Option, }, Resource { - id: Id, - parent_id: Option, + id: span::Id, + parent_id: Option, metadata: &'static Metadata<'static>, concrete_type: String, kind: resources::resource::Kind, @@ -25,19 +25,42 @@ pub(crate) enum Event { }, PollOp { metadata: &'static Metadata<'static>, - resource_id: Id, + resource_id: span::Id, op_name: String, - async_op_id: Id, - task_id: Id, + async_op_id: span::Id, + task_id: span::Id, is_ready: bool, }, AsyncResourceOp { - id: Id, - parent_id: Option, - resource_id: Id, + id: span::Id, + parent_id: Option, + resource_id: span::Id, metadata: &'static Metadata<'static>, source: String, stats: Arc, }, } + +#[derive(Clone, Debug, Copy)] +pub(crate) enum WakeOp { + Wake { self_wake: bool }, + WakeByRef { self_wake: bool }, + Clone, + Drop, +} + +impl WakeOp { + /// Returns `true` if `self` is a `Wake` or `WakeByRef` event. + pub(crate) fn is_wake(self) -> bool { + matches!(self, Self::Wake { .. } | Self::WakeByRef { .. }) + } + + pub(crate) fn self_wake(self, self_wake: bool) -> Self { + match self { + Self::Wake { .. } => Self::Wake { self_wake }, + Self::WakeByRef { .. } => Self::WakeByRef { self_wake }, + x => x, + } + } +} diff --git a/runtime/console/src/id_map.rs b/runtime/console/src/id_map.rs new file mode 100644 index 0000000..3af1602 --- /dev/null +++ b/runtime/console/src/id_map.rs @@ -0,0 +1,126 @@ +use crate::aggregate::Include; +use crate::stats::{DroppedAt, TimeAnchor, Unsent}; +use std::collections::HashMap; +use std::time::{Duration, Instant}; +use tracing_core::span::Id; + +pub(crate) trait ToProto { + type Output; + fn to_proto(&self, base_time: &TimeAnchor) -> Self::Output; +} + +#[derive(Debug)] +pub(crate) struct IdMap { + data: HashMap, +} + +impl Default for IdMap { + fn default() -> Self { + IdMap { + data: HashMap::::new(), + } + } +} + +impl IdMap { + pub(crate) fn insert(&mut self, id: Id, data: T) { + self.data.insert(id, data); + } + + pub(crate) fn since_last_update(&mut self) -> impl Iterator { + self.data.iter_mut().filter_map(|(id, data)| { + if data.take_unsent() { + Some((id, data)) + } else { + None + } + }) + } + + pub(crate) fn all(&self) -> impl Iterator { + self.data.iter() + } + + pub(crate) fn get(&self, id: &Id) -> Option<&T> { + self.data.get(id) + } + + pub(crate) fn as_proto_list( + &mut self, + include: Include, + base_time: &TimeAnchor, + ) -> Vec + where + T: ToProto, + { + match include { + Include::UpdatedOnly => self + .since_last_update() + .map(|(_, d)| d.to_proto(base_time)) + .collect(), + Include::All => self.all().map(|(_, d)| d.to_proto(base_time)).collect(), + } + } + + pub(crate) fn as_proto( + &mut self, + include: Include, + base_time: &TimeAnchor, + ) -> HashMap + where + T: ToProto, + { + match include { + Include::UpdatedOnly => self + .since_last_update() + .map(|(id, d)| (id.into_u64(), d.to_proto(base_time))) + .collect(), + Include::All => self + .all() + .map(|(id, d)| (id.into_u64(), d.to_proto(base_time))) + .collect(), + } + } + + pub(crate) fn drop_closed( + &mut self, + stats: &mut IdMap, + now: Instant, + retention: Duration, + has_watchers: bool, + ) { + let _span = tracing::debug_span!( + "drop_closed", + entity = %std::any::type_name::(), + stats = %std::any::type_name::(), + ) + .entered(); + + // drop closed entities + tracing::trace!(?retention, has_watchers, "dropping closed"); + + stats.data.retain(|id, stats| { + if let Some(dropped_at) = stats.dropped_at() { + let dropped_for = now.checked_duration_since(dropped_at).unwrap_or_default(); + let dirty = stats.is_unsent(); + let should_drop = + // if there are any clients watching, retain all dirty tasks regardless of age + (dirty && has_watchers) + || dropped_for > retention; + tracing::trace!( + stats.id = ?id, + stats.dropped_at = ?dropped_at, + stats.dropped_for = ?dropped_for, + stats.dirty = dirty, + should_drop, + ); + return !should_drop; + } + + true + }); + + // drop closed entities which no longer have stats. + self.data.retain(|id, _| stats.data.contains_key(id)); + } +} diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index de46432..d0c9305 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -1,31 +1,39 @@ use crossbeam_channel::{Sender, TrySendError}; -use std::any::TypeId; +use std::borrow::Borrow; use std::cell::RefCell; use std::net::IpAddr; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; +use std::time::{Duration, Instant}; use thread_local::ThreadLocal; -use tracing_core::span::{Attributes, Id, Record}; -use tracing_core::{Interest, LevelFilter, Metadata, Subscriber}; -use tracing_subscriber::filter::Filtered; -use tracing_subscriber::layer::{Context, Filter, Layered}; -use tracing_subscriber::registry::LookupSpan; +use tracing::span; +use tracing_core::span::Attributes; +use tracing_core::{Interest, Metadata, Subscriber}; +use tracing_subscriber::layer::{Context, Filter}; +use tracing_subscriber::registry::{LookupSpan, SpanRef}; use tracing_subscriber::Layer; mod aggregate; mod attribute; mod callsites; mod event; +mod id_map; mod server; mod stack; mod stats; +mod visitors; use crate::aggregate::Aggregator; use crate::callsites::Callsites; +use crate::visitors::{ + AsyncOpVisitor, PollOpVisitor, ResourceVisitor, ResourceVisitorResult, StateUpdateVisitor, + TaskVisitor, WakerVisitor, +}; use event::Event; pub use server::Server; use stack::SpanStack; +#[derive(Debug)] pub struct ConsoleLayer { current_spans: ThreadLocal>, @@ -34,6 +42,34 @@ pub struct ConsoleLayer { spawn_callsites: Callsites<8>, waker_callsites: Callsites<8>, + resource_callsites: Callsites<8>, + + /// Set of callsites for spans representing async operations on resources + /// + /// TODO: Take some time to determine more reasonable numbers + async_op_callsites: Callsites<32>, + + /// Set of callsites for spans representing async op poll operations + /// + /// TODO: Take some time to determine more reasonable numbers + async_op_poll_callsites: Callsites<32>, + + /// Set of callsites for events representing poll operation invocations on resources + /// + /// TODO: Take some time to determine more reasonable numbers + poll_op_callsites: Callsites<32>, + + /// Set of callsites for events representing state attribute state updates on resources + /// + /// TODO: Take some time to determine more reasonable numbers + resource_state_update_callsites: Callsites<32>, + + /// Set of callsites for events representing state attribute state updates on async resource ops + /// + /// TODO: Take some time to determine more reasonable numbers + async_op_state_update_callsites: Callsites<32>, + + max_poll_duration_nanos: u64, } #[derive(Debug)] @@ -50,6 +86,8 @@ pub struct Builder { event_buffer_capacity: usize, client_buffer_capacity: usize, + + poll_duration_max: Duration, } impl Builder { pub fn build(self) -> (ConsoleLayer, Server) { @@ -64,6 +102,7 @@ impl Default for Builder { server_port: Server::DEFAULT_PORT, event_buffer_capacity: ConsoleLayer::DEFAULT_EVENT_BUFFER_CAPACITY, client_buffer_capacity: 1024, + poll_duration_max: ConsoleLayer::DEFAULT_POLL_DURATION_MAX, } } } @@ -72,6 +111,7 @@ impl Default for Builder { struct Shared { dropped_tasks: AtomicUsize, dropped_resources: AtomicUsize, + dropped_async_ops: AtomicUsize, } impl ConsoleLayer { @@ -91,7 +131,7 @@ impl ConsoleLayer { let (tx, events) = crossbeam_channel::bounded(config.event_buffer_capacity); let shared = Arc::new(Shared::default()); let (subscribe, rpcs) = async_channel::bounded(config.client_buffer_capacity); - let aggregator = Aggregator::new(events, rpcs); + let aggregator = Aggregator::new(shared.clone(), events, rpcs); let server = Server::new(aggregator, config.client_buffer_capacity, subscribe); let layer = Self { current_spans: ThreadLocal::new(), @@ -99,6 +139,13 @@ impl ConsoleLayer { shared, spawn_callsites: Callsites::default(), waker_callsites: Callsites::default(), + resource_callsites: Callsites::default(), + async_op_callsites: Callsites::default(), + async_op_poll_callsites: Callsites::default(), + poll_op_callsites: Callsites::default(), + resource_state_update_callsites: Callsites::default(), + async_op_state_update_callsites: Callsites::default(), + max_poll_duration_nanos: config.poll_duration_max.as_nanos() as u64, }; (layer, server) @@ -109,6 +156,14 @@ impl ConsoleLayer { const DEFAULT_EVENT_BUFFER_CAPACITY: usize = 1024; const DEFAULT_CLIENT_BUFFER_CAPACITY: usize = 1024; + /// The default maximum value for task poll duration histograms. + /// + /// Any poll duration exceeding this will be clamped to this value. By + /// default, the maximum poll duration is one second. + /// + /// See also [`Builder::poll_duration_histogram_max`]. + pub const DEFAULT_POLL_DURATION_MAX: Duration = Duration::from_secs(1); + fn is_spawn(&self, metadata: &Metadata<'static>) -> bool { self.spawn_callsites.contains(metadata) } @@ -117,6 +172,54 @@ impl ConsoleLayer { self.waker_callsites.contains(metadata) } + fn is_resource(&self, meta: &'static Metadata<'static>) -> bool { + self.resource_callsites.contains(meta) + } + + fn is_async_op(&self, meta: &'static Metadata<'static>) -> bool { + self.async_op_callsites.contains(meta) + } + + fn is_id_spawned(&self, id: &span::Id, cx: &Context<'_, S>) -> bool + where + S: Subscriber + for<'a> LookupSpan<'a>, + { + cx.span(id) + .map(|span| self.is_spawn(span.metadata())) + .unwrap_or(false) + } + + fn is_id_resource(&self, id: &span::Id, cx: &Context<'_, S>) -> bool + where + S: Subscriber + for<'a> LookupSpan<'a>, + { + cx.span(id) + .map(|span| self.is_resource(span.metadata())) + .unwrap_or(false) + } + + fn is_id_async_op(&self, id: &span::Id, cx: &Context<'_, S>) -> bool + where + S: Subscriber + for<'a> LookupSpan<'a>, + { + cx.span(id) + .map(|span| self.is_async_op(span.metadata())) + .unwrap_or(false) + } + + fn first_entered

(&self, stack: &SpanStack, p: P) -> Option + where + P: Fn(&span::Id) -> bool, + { + stack + .stack() + .iter() + .rev() + .find(|id| p(id.id())) + .map(|id| id.id()) + .cloned() + } + fn send_stats( &self, dropped: &AtomicUsize, @@ -157,6 +260,30 @@ where self.waker_callsites.insert(metadata); &self.shared.dropped_tasks } + (ResourceVisitor::RES_SPAN_NAME, _) => { + self.resource_callsites.insert(metadata); + &self.shared.dropped_resources + } + (AsyncOpVisitor::ASYNC_OP_SPAN_NAME, _) => { + self.async_op_callsites.insert(metadata); + &self.shared.dropped_async_ops + } + ("runtime.resource.async_op.poll", _) => { + self.async_op_poll_callsites.insert(metadata); + &self.shared.dropped_async_ops + } + (_, PollOpVisitor::POLL_OP_EVENT_TARGET) => { + self.poll_op_callsites.insert(metadata); + &self.shared.dropped_async_ops + } + (_, StateUpdateVisitor::RE_STATE_UPDATE_EVENT_TARGET) => { + self.resource_state_update_callsites.insert(metadata); + &self.shared.dropped_resources + } + (_, StateUpdateVisitor::AO_STATE_UPDATE_EVENT_TARGET) => { + self.async_op_state_update_callsites.insert(metadata); + &self.shared.dropped_async_ops + } (_, _) => &self.shared.dropped_tasks, }; @@ -164,13 +291,215 @@ where Interest::always() } -} -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - let result = 2 + 2; - assert_eq!(result, 4); + fn on_new_span(&self, attrs: &Attributes<'_>, id: &span::Id, ctx: Context<'_, S>) { + let metadata = attrs.metadata(); + if self.is_spawn(metadata) { + let at = Instant::now(); + let mut task_visitor = TaskVisitor::new(metadata.into()); + attrs.record(&mut task_visitor); + let (fields, location) = task_visitor.result(); + if let Some(stats) = self.send_stats(&self.shared.dropped_tasks, move || { + let stats = Arc::new(stats::TaskStats::new(self.max_poll_duration_nanos, at)); + let event = Event::Spawn { + id: id.clone(), + stats: stats.clone(), + metadata, + fields, + location, + }; + (event, stats) + }) { + ctx.span(id) + .expect("`on_new_span` called with nonexistent span. This is a tracing bug."); + } + } else if self.is_resource(metadata) { + let at = Instant::now(); + let mut resource_visitor = ResourceVisitor::default(); + attrs.record(&mut resource_visitor); + if let Some(result) = resource_visitor.result() { + let ResourceVisitorResult { + concrete_type, + kind, + location, + is_internal, + inherit_child_attrs, + } = result; + let parent_id = self.current_spans.get().and_then(|stack| { + self.first_entered(&stack.borrow(), |id| self.is_id_resource(id, &ctx)) + }); + if let Some(stats) = self.send_stats(&self.shared.dropped_resources, move || { + let stats = Arc::new(stats::ResourceStats::new( + at, + inherit_child_attrs, + parent_id.clone(), + )); + let event = Event::Resource { + id: id.clone(), + parent_id, + metadata, + concrete_type, + kind, + location, + is_internal, + stats: stats.clone(), + }; + (event, stats) + }) { + ctx.span(id).expect("if `on_new_span` was called, the span must exist; this is a `tracing` bug!").extensions_mut().insert(stats); + } + } + } else if self.is_async_op(metadata) { + let at = Instant::now(); + let mut async_op_visitor = AsyncOpVisitor::default(); + attrs.record(&mut async_op_visitor); + if let Some((source, inherit_child_attrs)) = async_op_visitor.result() { + let resource_id = self.current_spans.get().and_then(|stack| { + self.first_entered(&stack.borrow(), |id| self.is_id_resource(id, &ctx)) + }); + + let parent_id = self.current_spans.get().and_then(|stack| { + self.first_entered(&stack.borrow(), |id| self.is_id_async_op(id, &ctx)) + }); + + if let Some(resource_id) = resource_id { + if let Some(stats) = + self.send_stats(&self.shared.dropped_async_ops, move || { + let stats = Arc::new(stats::AsyncOpStats::new( + at, + inherit_child_attrs, + parent_id.clone(), + )); + let event = Event::AsyncResourceOp { + id: id.clone(), + parent_id, + resource_id, + metadata, + source, + stats: stats.clone(), + }; + (event, stats) + }) + { + ctx.span(id).expect("if `on_new_span` was called, the span must exist; this is a `tracing` bug!").extensions_mut().insert(stats); + } + } + } + } + } + + fn on_event(&self, event: &tracing::Event<'_>, ctx: Context<'_, S>) { + let metadata = event.metadata(); + if self.waker_callsites.contains(metadata) { + let at = Instant::now(); + let mut visitor = WakerVisitor::default(); + event.record(&mut visitor); + if let Some((id, mut op)) = visitor.result() { + if let Some(span) = ctx.span(&id) { + let exts = span.extensions(); + if let Some(stats) = exts.get::>() { + if op.is_wake() { + let self_wake = self + .current_spans + .get() + .map(|spans| spans.borrow().iter().any(|span| span == &id)) + .unwrap_or(false); + op = op.self_wake(self_wake); + } + + stats.record_wake_op(op, at); + } + } + } + } + } + + fn on_enter(&self, id: &span::Id, cx: Context<'_, S>) { + fn update LookupSpan<'a>>( + span: &SpanRef, + at: Option, + ) -> Option { + let exts = span.extensions(); + // if the span we are entering is a task or async op, record the + // poll stats. + if let Some(stats) = exts.get::>() { + let at = at.unwrap_or_else(Instant::now); + stats.start_poll(at); + Some(at) + } else if let Some(stats) = exts.get::>() { + let at = at.unwrap_or_else(Instant::now); + stats.start_poll(at); + Some(at) + // otherwise, is the span a resource? in that case, we also want + // to enter it, although we don't care about recording poll + // stats. + } else if exts.get::>().is_some() { + Some(at.unwrap_or_else(Instant::now)) + } else { + None + } + } + + if let Some(span) = cx.span(id) { + if let Some(now) = update(&span, None) { + if let Some(parent) = span.parent() { + update(&parent, Some(now)); + } + self.current_spans + .get_or_default() + .borrow_mut() + .push(id.clone()); + } + } + } + + fn on_exit(&self, id: &span::Id, cx: Context<'_, S>) { + fn update LookupSpan<'a>>( + span: &SpanRef, + at: Option, + ) -> Option { + let exts = span.extensions(); + // if the span we are entering is a task or async op, record the + // poll stats. + if let Some(stats) = exts.get::>() { + let at = at.unwrap_or_else(Instant::now); + stats.end_poll(at); + Some(at) + } else if let Some(stats) = exts.get::>() { + let at = at.unwrap_or_else(Instant::now); + stats.end_poll(at); + Some(at) + // otherwise, is the span a resource? in that case, we also want + // to enter it, although we don't care about recording poll + // stats. + } else if exts.get::>().is_some() { + Some(at.unwrap_or_else(Instant::now)) + } else { + None + } + } + + if let Some(span) = cx.span(id) { + if let Some(now) = update(&span, None) { + if let Some(parent) = span.parent() { + update(&parent, Some(now)); + } + self.current_spans.get_or_default().borrow_mut().pop(id); + } + } + } + + fn on_close(&self, id: span::Id, cx: Context<'_, S>) { + if let Some(span) = cx.span(&id) { + let now = Instant::now(); + let exts = span.extensions(); + if let Some(stats) = exts.get::>() { + stats.drop_task(now); + } else if let Some(stats) = exts.get::>() { + stats.drop_async_op(now); + } else if let Some(stats) = exts.get::>() { + stats.drop_resource(now); + } + } } } diff --git a/runtime/console/src/server.rs b/runtime/console/src/server.rs index 5591206..14ff385 100644 --- a/runtime/console/src/server.rs +++ b/runtime/console/src/server.rs @@ -1,19 +1,21 @@ -use crate::aggregate::Id; use crate::Aggregator; use async_channel::{Receiver, Sender}; +use async_compat::CompatExt; use console_api::instrument; use console_api::instrument::instrument_server::{Instrument, InstrumentServer}; use console_api::tasks; use futures_util::TryStreamExt; use std::error::Error; +use std::future::Future; use std::io::IoSlice; -use std::net::{IpAddr, Ipv6Addr, SocketAddr}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::io::AsyncRead as TokioAsyncRead; use tokio::io::{AsyncWrite as TokioAsyncWrite, ReadBuf}; use tonic::transport::server::Connected; use tonic::Status; +use tracing_core::span::Id; struct StreamWrapper(T); impl Connected for StreamWrapper { @@ -68,14 +70,16 @@ impl TokioAsyncRead for StreamWrapper { } } +#[derive(Debug)] pub struct Server { - aggregator: Aggregator, + pub aggregator: Option, client_buffer_size: usize, subscribe: Sender, } impl Server { - pub(crate) const DEFAULT_ADDR: IpAddr = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + //pub(crate) const DEFAULT_ADDR: IpAddr = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + pub(crate) const DEFAULT_ADDR: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); pub(crate) const DEFAULT_PORT: u16 = 49289; pub(crate) fn new( @@ -83,15 +87,14 @@ impl Server { client_buffer_size: usize, subscribe: Sender, ) -> Self { - let subscribe = todo!(); Self { - aggregator, + aggregator: Some(aggregator), client_buffer_size, subscribe, } } - pub(crate) async fn serve( + pub async fn serve( mut self, /*, incoming: I */ ) -> Result<(), Box> { // TODO: Spawn two tasks; the aggregator that's collecting stats, aggregating and @@ -99,16 +102,10 @@ impl Server { let svc = InstrumentServer::new(self); - // The gRPC server task; requires a `Stream` of `tokio::AsyncRead + tokio::AsyncWrite`. - let listener = - async_net::TcpListener::bind(SocketAddr::new(Self::DEFAULT_ADDR, Self::DEFAULT_PORT)) - .await?; - let incoming = listener - .incoming() - .map_ok(|stream| StreamWrapper(async_compat::Compat::new(stream))); tonic::transport::Server::builder() .add_service(svc) - .serve_with_incoming(incoming) + .serve(SocketAddr::new(Self::DEFAULT_ADDR, Self::DEFAULT_PORT)) + .compat() .await?; // TODO: Kill the aggregator task if the serve task has ended. @@ -117,6 +114,7 @@ impl Server { } } +#[derive(Debug)] pub(crate) struct Watch(pub(crate) Sender>); impl Watch { pub fn update(&self, update: &T) -> bool { @@ -124,12 +122,14 @@ impl Watch { } } +#[derive(Debug)] pub(crate) struct WatchRequest { pub id: Id, pub stream_sender: async_oneshot::Sender>>, pub buffer: usize, } +#[derive(Debug)] pub(crate) enum Command { Instrument(Watch), WatchTaskDetail(WatchRequest), diff --git a/runtime/console/src/stats.rs b/runtime/console/src/stats.rs index d2bf2af..9018d8f 100644 --- a/runtime/console/src/stats.rs +++ b/runtime/console/src/stats.rs @@ -1,10 +1,62 @@ -use crate::aggregate::Id; -use crate::attribute; +use crate::id_map::ToProto; +use crate::{attribute, event}; use crossbeam_utils::atomic::AtomicCell; use hdrhistogram::serialization::{Serializer, V2Serializer}; -use std::sync::atomic::{AtomicBool, AtomicUsize}; -use std::sync::Mutex; +use std::cmp; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant, SystemTime}; +use tracing::span; + +/// A type which records whether it has unsent updates. +/// +/// If something implementing this trait has been changed since the last time +/// data was sent to a client, it will indicate that it is "dirty". If it has +/// not been changed, it does not have to be included in the current update. +pub(crate) trait Unsent { + /// Returns `true` if this type has unsent updates, and if it does, clears + /// the flag indicating there are unsent updates. + /// + /// This is called when filtering which stats need to be included in the + /// current update. If this returns `true`, it will be included, so it + /// becomes no longer dirty. + fn take_unsent(&self) -> bool; + + /// Returns `true` if this type has unsent updates, without changing the + /// flag. + fn is_unsent(&self) -> bool; +} + +// An entity (e.g Task, Resource) that at some point in +// time can be dropped. This generally refers to spans that +// have been closed indicating that a task, async op or a +// resource is not in use anymore +pub(crate) trait DroppedAt { + fn dropped_at(&self) -> Option; +} + +impl DroppedAt for Arc { + fn dropped_at(&self) -> Option { + T::dropped_at(self) + } +} + +impl Unsent for Arc { + fn take_unsent(&self) -> bool { + T::take_unsent(self) + } + + fn is_unsent(&self) -> bool { + T::is_unsent(self) + } +} + +impl ToProto for Arc { + type Output = T::Output; + fn to_proto(&self, base_time: &TimeAnchor) -> T::Output { + T::to_proto(self, base_time) + } +} /// Anchors an `Instant` with a `SystemTime` timestamp to allow converting /// monotonic `Instant`s into timestamps that can be sent over the wire. @@ -34,6 +86,10 @@ impl TimeAnchor { } } +trait RecordPoll { + fn record_poll_duration(&mut self, duration: Duration); +} + #[derive(Debug, Default)] struct PollStats { /// The number of polls in progress @@ -43,6 +99,78 @@ struct PollStats { timestamps: Mutex>, } +impl PollStats { + fn start_poll(&self, at: Instant) { + if self.current_polls.fetch_add(1, Ordering::AcqRel) == 0 { + // We are starting the first poll + let mut timestamps = self.timestamps.lock().unwrap(); + if timestamps.first_poll.is_none() { + timestamps.first_poll = Some(at); + } + + timestamps.last_poll_started = Some(at); + + self.polls.fetch_add(1, Ordering::Release); + } + } + + fn end_poll(&self, at: Instant) { + // Are we ending the last current poll? + if self.current_polls.fetch_sub(1, Ordering::AcqRel) > 1 { + return; + } + + let mut timestamps = self.timestamps.lock().unwrap(); + let started = match timestamps.last_poll_started { + Some(last_poll) => last_poll, + None => { + eprintln!( + "a poll ended, but start timestamp was recorded. \ + this is probably a `console-subscriber` bug" + ); + return; + } + }; + + timestamps.last_poll_ended = Some(at); + let elapsed = match at.checked_duration_since(started) { + Some(elapsed) => elapsed, + None => { + eprintln!( + "possible Instant clock skew detected: a poll's end timestamp \ + was before its start timestamp\nstart = {:?}\n end = {:?}", + started, at + ); + return; + } + }; + + // if we have a poll time histogram, add the timestamp + timestamps.histogram.record_poll_duration(elapsed); + + timestamps.busy_time += elapsed; + } +} + +impl ToProto for PollStats { + type Output = console_api::PollStats; + + fn to_proto(&self, base_time: &TimeAnchor) -> Self::Output { + let timestamps = self.timestamps.lock().unwrap(); + console_api::PollStats { + polls: self.polls.load(Ordering::Acquire) as u64, + first_poll: timestamps.first_poll.map(|at| base_time.to_timestamp(at)), + last_poll_started: timestamps + .last_poll_started + .map(|at| base_time.to_timestamp(at)), + last_poll_ended: timestamps + .last_poll_ended + .map(|at| base_time.to_timestamp(at)), + busy_time: Some(timestamps.busy_time.into()), + } + } +} + /// Stats associated with a task. #[derive(Debug)] pub(crate) struct TaskStats { @@ -63,6 +191,30 @@ pub(crate) struct TaskStats { } impl TaskStats { + pub(crate) fn new(poll_duration_max: u64, created_at: Instant) -> Self { + Self { + is_dirty: AtomicBool::new(true), + is_dropped: AtomicBool::new(false), + created_at, + timestamps: Mutex::new(TaskTimestamps::default()), + poll_stats: PollStats { + timestamps: Mutex::new(PollTimestamps { + histogram: Histogram::new(poll_duration_max), + first_poll: None, + last_poll_started: None, + last_poll_ended: None, + busy_time: Duration::new(0, 0), + }), + current_polls: AtomicUsize::new(0), + polls: AtomicUsize::new(0), + }, + wakes: AtomicUsize::new(0), + waker_clones: AtomicUsize::new(0), + waker_drops: AtomicUsize::new(0), + self_wakes: AtomicUsize::new(0), + } + } + pub(crate) fn poll_duration_histogram( &self, ) -> console_api::tasks::task_details::PollTimesHistogram { @@ -75,6 +227,104 @@ impl TaskStats { .to_proto(); console_api::tasks::task_details::PollTimesHistogram::Histogram(hist) } + + pub(crate) fn record_wake_op(&self, op: event::WakeOp, at: Instant) { + use event::WakeOp; + match op { + WakeOp::Wake { self_wake } => { + self.waker_drops.fetch_add(1, Ordering::Release); + self.wake(at, self_wake); + } + WakeOp::WakeByRef { self_wake } => { + self.wake(at, self_wake); + } + WakeOp::Clone => { + self.waker_clones.fetch_add(1, Ordering::Release); + } + WakeOp::Drop => { + self.waker_drops.fetch_add(1, Ordering::Release); + } + } + self.make_dirty(); + } + + fn wake(&self, at: Instant, self_wake: bool) { + let mut timestamps = self.timestamps.lock().unwrap(); + timestamps.last_wake = cmp::max(timestamps.last_wake, Some(at)); + if self_wake { + self.wakes.fetch_add(1, Ordering::Release); + } + self.wakes.fetch_add(1, Ordering::Release); + } + + pub(crate) fn start_poll(&self, at: Instant) { + self.poll_stats.start_poll(at); + self.make_dirty(); + } + + pub(crate) fn end_poll(&self, at: Instant) { + self.poll_stats.end_poll(at); + self.make_dirty(); + } + + pub(crate) fn drop_task(&self, dropped_at: Instant) { + if self.is_dropped.swap(true, Ordering::AcqRel) { + // The task was already dropped. + // TODO(eliza): this could maybe panic in debug mode... + return; + } + + let mut timestamps = self.timestamps.lock().unwrap(); + let _prev = timestamps.dropped_at.replace(dropped_at); + debug_assert_eq!(_prev, None, "tried to drop a task twice; this is a bug!"); + self.make_dirty(); + } + + fn make_dirty(&self) { + self.is_dirty.swap(true, Ordering::AcqRel); + } +} + +impl ToProto for TaskStats { + type Output = console_api::tasks::Stats; + + fn to_proto(&self, base_time: &TimeAnchor) -> Self::Output { + let poll_stats = Some(self.poll_stats.to_proto(base_time)); + let timestamps = self.timestamps.lock().unwrap(); + console_api::tasks::Stats { + poll_stats, + created_at: Some(base_time.to_timestamp(self.created_at)), + dropped_at: timestamps.dropped_at.map(|at| base_time.to_timestamp(at)), + wakes: self.wakes.load(Ordering::Acquire) as u64, + waker_clones: self.waker_clones.load(Ordering::Acquire) as u64, + self_wakes: self.self_wakes.load(Ordering::Acquire) as u64, + waker_drops: self.waker_drops.load(Ordering::Acquire) as u64, + last_wake: timestamps.last_wake.map(|at| base_time.to_timestamp(at)), + } + } +} + +impl Unsent for TaskStats { + #[inline] + fn take_unsent(&self) -> bool { + self.is_dirty.swap(false, Ordering::AcqRel) + } + + fn is_unsent(&self) -> bool { + self.is_dirty.load(Ordering::Acquire) + } +} + +impl DroppedAt for TaskStats { + fn dropped_at(&self) -> Option { + // avoid acquiring the lock if we know we haven't tried to drop this + // thing yet + if self.is_dropped.load(Ordering::Acquire) { + return self.timestamps.lock().unwrap().dropped_at; + } + + None + } } /// Stats associated with an async operation. @@ -97,6 +347,98 @@ pub(crate) struct AsyncOpStats { poll_stats: PollStats<()>, } +impl AsyncOpStats { + pub(crate) fn new( + created_at: Instant, + inherit_child_attributes: bool, + parent_id: Option, + ) -> Self { + Self { + task_id: AtomicCell::new(0), + stats: ResourceStats::new(created_at, inherit_child_attributes, parent_id), + poll_stats: PollStats::default(), + } + } + + pub(crate) fn task_id(&self) -> Option { + let id = self.task_id.load(); + if id > 0 { + Some(id as u64) + } else { + None + } + } + + pub(crate) fn set_task_id(&self, id: &tracing::span::Id) { + self.task_id.store(id.into_u64()); + self.make_dirty(); + } + + pub(crate) fn drop_async_op(&self, dropped_at: Instant) { + self.stats.drop_resource(dropped_at) + } + + pub(crate) fn start_poll(&self, at: Instant) { + self.poll_stats.start_poll(at); + self.make_dirty(); + } + + pub(crate) fn end_poll(&self, at: Instant) { + self.poll_stats.end_poll(at); + self.make_dirty(); + } + + #[inline] + fn make_dirty(&self) { + self.stats.make_dirty() + } +} + +impl Unsent for AsyncOpStats { + #[inline] + fn take_unsent(&self) -> bool { + self.stats.take_unsent() + } + + #[inline] + fn is_unsent(&self) -> bool { + self.stats.is_unsent() + } +} + +impl DroppedAt for AsyncOpStats { + fn dropped_at(&self) -> Option { + self.stats.dropped_at() + } +} + +impl ToProto for AsyncOpStats { + type Output = console_api::async_ops::Stats; + + fn to_proto(&self, base_time: &TimeAnchor) -> Self::Output { + let attributes = self + .stats + .attributes + .lock() + .unwrap() + .values() + .cloned() + .collect(); + console_api::async_ops::Stats { + poll_stats: Some(self.poll_stats.to_proto(base_time)), + created_at: Some(base_time.to_timestamp(self.stats.created_at)), + dropped_at: self + .stats + .dropped_at + .lock() + .unwrap() + .map(|at| base_time.to_timestamp(at)), + task_id: self.task_id().map(Into::into), + attributes, + } + } +} + /// Stats associated with a resource. #[derive(Debug)] pub(crate) struct ResourceStats { @@ -106,7 +448,92 @@ pub(crate) struct ResourceStats { dropped_at: Mutex>, attributes: Mutex, pub(crate) inherit_child_attributes: bool, - pub(crate) parent_id: Option, + pub(crate) parent_id: Option, +} + +impl ResourceStats { + pub(crate) fn new( + created_at: Instant, + inherit_child_attributes: bool, + parent_id: Option, + ) -> Self { + Self { + is_dirty: AtomicBool::new(true), + is_dropped: AtomicBool::new(false), + created_at, + dropped_at: Mutex::new(None), + attributes: Default::default(), + inherit_child_attributes, + parent_id, + } + } + + pub(crate) fn update_attribute(&self, id: &span::Id, update: &attribute::Update) { + self.attributes.lock().unwrap().update(id, update); + self.make_dirty(); + } + + #[inline] + pub(crate) fn drop_resource(&self, dropped_at: Instant) { + if self.is_dropped.swap(true, Ordering::AcqRel) { + // The task was already dropped. + // TODO(eliza): this could maybe panic in debug mode... + return; + } + + let mut timestamp = self.dropped_at.lock().unwrap(); + let _prev = timestamp.replace(dropped_at); + debug_assert_eq!( + _prev, None, + "tried to drop a resource/async op twice; this is a bug!" + ); + self.make_dirty(); + } + + #[inline] + fn make_dirty(&self) { + self.is_dirty.swap(true, Ordering::AcqRel); + } +} + +impl Unsent for ResourceStats { + #[inline] + fn take_unsent(&self) -> bool { + self.is_dirty.swap(false, Ordering::AcqRel) + } + + fn is_unsent(&self) -> bool { + self.is_dirty.load(Ordering::Acquire) + } +} + +impl DroppedAt for ResourceStats { + fn dropped_at(&self) -> Option { + // avoid acquiring the lock if we know we haven't tried to drop this + // thing yet + if self.is_dropped.load(Ordering::Acquire) { + return *self.dropped_at.lock().unwrap(); + } + + None + } +} + +impl ToProto for ResourceStats { + type Output = console_api::resources::Stats; + + fn to_proto(&self, base_time: &TimeAnchor) -> Self::Output { + let attributes = self.attributes.lock().unwrap().values().cloned().collect(); + console_api::resources::Stats { + created_at: Some(base_time.to_timestamp(self.created_at)), + dropped_at: self + .dropped_at + .lock() + .unwrap() + .map(|at| base_time.to_timestamp(at)), + attributes, + } + } } #[derive(Debug, Default)] @@ -159,3 +586,26 @@ impl Histogram { } } } + +impl RecordPoll for Histogram { + fn record_poll_duration(&mut self, duration: Duration) { + let mut duration_ns = duration.as_nanos() as u64; + + // clamp the duration to the histogram's max value + if duration_ns > self.max { + self.outliers += 1; + self.max_outlier = cmp::max(self.max_outlier, Some(duration_ns)); + duration_ns = self.max; + } + + self.histogram + .record(duration_ns) + .expect("duration has already been clamped to histogram max value") + } +} + +impl RecordPoll for () { + fn record_poll_duration(&mut self, _: Duration) { + // do nothing + } +} diff --git a/runtime/console/src/visitors.rs b/runtime/console/src/visitors.rs new file mode 100644 index 0000000..858703f --- /dev/null +++ b/runtime/console/src/visitors.rs @@ -0,0 +1,529 @@ +use crate::{attribute, event}; +use console_api::resources::resource; +use tracing::{field, span}; +use tracing_core::field::Visit; + +const LOCATION_FILE: &str = "loc.file"; +const LOCATION_LINE: &str = "loc.line"; +const LOCATION_COLUMN: &str = "loc.col"; +const INHERIT_FIELD_NAME: &str = "inherits_child_attrs"; + +/// Used to extract the fields needed to construct +/// an Event::Resource from the metadata of a tracing span +/// that has the following shape: +/// +/// tracing::trace_span!( +/// "runtime.resource", +/// concrete_type = "Sleep", +/// kind = "timer", +/// is_internal = true, +/// inherits_child_attrs = true, +/// ); +/// +/// Fields: +/// concrete_type - indicates the concrete rust type for this resource +/// kind - indicates the type of resource (i.e. timer, sync, io ) +/// is_internal - whether this is a resource type that is not exposed publicly (i.e. BatchSemaphore) +/// inherits_child_attrs - whether this resource should inherit the state attributes of its children +#[derive(Default)] +pub(crate) struct ResourceVisitor { + concrete_type: Option, + kind: Option, + is_internal: bool, + inherit_child_attrs: bool, + line: Option, + file: Option, + column: Option, +} + +pub(crate) struct ResourceVisitorResult { + pub(crate) concrete_type: String, + pub(crate) kind: resource::Kind, + pub(crate) location: Option, + pub(crate) is_internal: bool, + pub(crate) inherit_child_attrs: bool, +} + +/// Used to extract all fields from the metadata +/// of a tracing span +pub(crate) struct FieldVisitor { + fields: Vec, + meta_id: console_api::MetaId, +} + +/// Used to extract the fields needed to construct +/// an `Event::Spawn` from the metadata of a tracing span +/// that has the following shape: +/// +/// ``` +/// tracing::trace_span!( +/// target: "tokio::task", +/// "runtime.spawn", +/// kind = "local", +/// task.name = "some_name", +/// loc.file = "some_file.rs", +/// loc.line = 555, +/// loc.col = 5, +/// ); +/// ``` +/// +/// # Fields +/// +/// This visitor has special behavior for `loc.line`, `loc.file`, and `loc.col` +/// fields, which are interpreted as a Rust source code location where the task +/// was spawned, if they are present. Other fields are recorded as arbitrary +/// key-value pairs. +pub(crate) struct TaskVisitor { + field_visitor: FieldVisitor, + line: Option, + file: Option, + column: Option, +} + +/// Used to extract the fields needed to construct +/// an Event::AsyncOp from the metadata of a tracing span +/// that has the following shape: +/// +/// tracing::trace_span!( +/// "runtime.resource.async_op", +/// source = "Sleep::new_timeout", +/// ); +/// +/// Fields: +/// source - the method which has created an instance of this async operation +#[derive(Default)] +pub(crate) struct AsyncOpVisitor { + source: Option, + inherit_child_attrs: bool, +} + +/// Used to extract the fields needed to construct +/// an Event::Waker from the metadata of a tracing span +/// that has the following shape: +/// +/// tracing::trace!( +/// target: "tokio::task::waker", +/// op = "waker.clone", +/// task.id = id.into_u64(), +/// ); +/// +/// Fields: +/// task.id - the id of the task this waker will wake +/// op - the operation associated with this waker event +#[derive(Default)] +pub(crate) struct WakerVisitor { + id: Option, + op: Option, +} + +/// Used to extract the fields needed to construct +/// an Event::PollOp from the metadata of a tracing event +/// that has the following shape: +/// +/// tracing::trace!( +/// target: "runtime::resource::poll_op", +/// op_name = "poll_elapsed", +/// readiness = "pending" +/// ); +/// +/// Fields: +/// op_name - the name of this resource poll operation +/// readiness - the result of invoking this poll op, describing its readiness +#[derive(Default)] +pub(crate) struct PollOpVisitor { + op_name: Option, + is_ready: Option, +} + +/// Used to extract the fields needed to construct +/// an Event::StateUpdate from the metadata of a tracing event +/// that has the following shape: +/// +/// tracing::trace!( +/// target: "runtime::resource::state_update", +/// duration = duration, +/// duration.unit = "ms", +/// duration.op = "override", +/// ); +/// +/// Fields: +/// attribute_name - a field value for a field that has the name of the resource attribute being updated +/// value - the value for this update +/// unit - the unit for the value being updated (e.g. ms, s, bytes) +/// op - the operation that this update performs to the value of the resource attribute (one of: ovr, sub, add) +pub(crate) struct StateUpdateVisitor { + meta_id: console_api::MetaId, + field: Option, + unit: Option, + op: Option, +} + +impl ResourceVisitor { + pub(crate) const RES_SPAN_NAME: &'static str = "runtime.resource"; + const RES_CONCRETE_TYPE_FIELD_NAME: &'static str = "concrete_type"; + const RES_VIZ_FIELD_NAME: &'static str = "is_internal"; + const RES_KIND_FIELD_NAME: &'static str = "kind"; + const RES_KIND_TIMER: &'static str = "timer"; + + pub(crate) fn result(self) -> Option { + let concrete_type = self.concrete_type?; + let kind = self.kind?; + + let location = if self.file.is_some() && self.line.is_some() && self.column.is_some() { + Some(console_api::Location { + file: self.file, + line: self.line, + column: self.column, + ..Default::default() + }) + } else { + None + }; + + Some(ResourceVisitorResult { + concrete_type, + kind, + location, + is_internal: self.is_internal, + inherit_child_attrs: self.inherit_child_attrs, + }) + } +} + +impl Visit for ResourceVisitor { + fn record_debug(&mut self, _: &field::Field, _: &dyn std::fmt::Debug) {} + + fn record_str(&mut self, field: &tracing_core::Field, value: &str) { + match field.name() { + Self::RES_CONCRETE_TYPE_FIELD_NAME => self.concrete_type = Some(value.to_string()), + Self::RES_KIND_FIELD_NAME => { + let kind = Some(match value { + Self::RES_KIND_TIMER => { + resource::kind::Kind::Known(resource::kind::Known::Timer as i32) + } + other => resource::kind::Kind::Other(other.to_string()), + }); + self.kind = Some(resource::Kind { kind }); + } + LOCATION_FILE => self.file = Some(value.to_string()), + _ => {} + } + } + + fn record_bool(&mut self, field: &tracing_core::Field, value: bool) { + match field.name() { + Self::RES_VIZ_FIELD_NAME => self.is_internal = value, + INHERIT_FIELD_NAME => self.inherit_child_attrs = value, + _ => {} + } + } + + fn record_u64(&mut self, field: &tracing_core::Field, value: u64) { + match field.name() { + LOCATION_LINE => self.line = Some(value as u32), + LOCATION_COLUMN => self.column = Some(value as u32), + _ => {} + } + } +} + +impl FieldVisitor { + pub(crate) fn new(meta_id: console_api::MetaId) -> Self { + FieldVisitor { + fields: Vec::default(), + meta_id, + } + } + pub(crate) fn result(self) -> Vec { + self.fields + } +} + +impl TaskVisitor { + pub(crate) fn new(meta_id: console_api::MetaId) -> Self { + TaskVisitor { + field_visitor: FieldVisitor::new(meta_id), + line: None, + file: None, + column: None, + } + } + + pub(crate) fn result(self) -> (Vec, Option) { + let fields = self.field_visitor.result(); + let location = if self.file.is_some() && self.line.is_some() && self.column.is_some() { + Some(console_api::Location { + file: self.file, + line: self.line, + column: self.column, + ..Default::default() + }) + } else { + None + }; + + (fields, location) + } +} + +impl Visit for TaskVisitor { + fn record_debug(&mut self, field: &field::Field, value: &dyn std::fmt::Debug) { + self.field_visitor.record_debug(field, value); + } + + fn record_i64(&mut self, field: &tracing_core::Field, value: i64) { + self.field_visitor.record_i64(field, value); + } + + fn record_u64(&mut self, field: &tracing_core::Field, value: u64) { + match field.name() { + LOCATION_LINE => self.line = Some(value as u32), + LOCATION_COLUMN => self.column = Some(value as u32), + _ => self.field_visitor.record_u64(field, value), + } + } + + fn record_bool(&mut self, field: &tracing_core::Field, value: bool) { + self.field_visitor.record_bool(field, value); + } + + fn record_str(&mut self, field: &tracing_core::Field, value: &str) { + if field.name() == LOCATION_FILE { + self.file = Some(value.to_string()); + } else { + self.field_visitor.record_str(field, value); + } + } +} + +impl Visit for FieldVisitor { + fn record_debug(&mut self, field: &field::Field, value: &dyn std::fmt::Debug) { + self.fields.push(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + + fn record_i64(&mut self, field: &tracing_core::Field, value: i64) { + self.fields.push(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + + fn record_u64(&mut self, field: &tracing_core::Field, value: u64) { + self.fields.push(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + + fn record_bool(&mut self, field: &tracing_core::Field, value: bool) { + self.fields.push(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + + fn record_str(&mut self, field: &tracing_core::Field, value: &str) { + self.fields.push(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } +} + +impl AsyncOpVisitor { + pub(crate) const ASYNC_OP_SPAN_NAME: &'static str = "runtime.resource.async_op"; + const ASYNC_OP_SRC_FIELD_NAME: &'static str = "source"; + + pub(crate) fn result(self) -> Option<(String, bool)> { + let inherit = self.inherit_child_attrs; + self.source.map(|s| (s, inherit)) + } +} + +impl Visit for AsyncOpVisitor { + fn record_debug(&mut self, _: &field::Field, _: &dyn std::fmt::Debug) {} + + fn record_str(&mut self, field: &tracing_core::Field, value: &str) { + if field.name() == Self::ASYNC_OP_SRC_FIELD_NAME { + self.source = Some(value.to_string()); + } + } + + fn record_bool(&mut self, field: &tracing_core::Field, value: bool) { + if field.name() == INHERIT_FIELD_NAME { + self.inherit_child_attrs = value; + } + } +} + +impl WakerVisitor { + const WAKE: &'static str = "waker.wake"; + const WAKE_BY_REF: &'static str = "waker.wake_by_ref"; + const CLONE: &'static str = "waker.clone"; + const DROP: &'static str = "waker.drop"; + const TASK_ID_FIELD_NAME: &'static str = "task.id"; + + pub(crate) fn result(self) -> Option<(span::Id, event::WakeOp)> { + self.id.zip(self.op) + } +} + +impl Visit for WakerVisitor { + fn record_debug(&mut self, _: &field::Field, _: &dyn std::fmt::Debug) { + // don't care (yet?) + } + + fn record_u64(&mut self, field: &tracing_core::Field, value: u64) { + if field.name() == Self::TASK_ID_FIELD_NAME { + self.id = Some(span::Id::from_u64(value)); + } + } + + fn record_str(&mut self, field: &tracing_core::Field, value: &str) { + use crate::event::WakeOp; + if field.name() == "op" { + self.op = Some(match value { + Self::WAKE => WakeOp::Wake { self_wake: false }, + Self::WAKE_BY_REF => WakeOp::WakeByRef { self_wake: false }, + Self::CLONE => WakeOp::Clone, + Self::DROP => WakeOp::Drop, + _ => return, + }); + } + } +} + +impl PollOpVisitor { + pub(crate) const POLL_OP_EVENT_TARGET: &'static str = "runtime::resource::poll_op"; + const OP_NAME_FIELD_NAME: &'static str = "op_name"; + const OP_READINESS_FIELD_NAME: &'static str = "is_ready"; + + pub(crate) fn result(self) -> Option<(String, bool)> { + let op_name = self.op_name?; + let is_ready = self.is_ready?; + Some((op_name, is_ready)) + } +} + +impl Visit for PollOpVisitor { + fn record_debug(&mut self, _: &field::Field, _: &dyn std::fmt::Debug) {} + + fn record_bool(&mut self, field: &tracing_core::Field, value: bool) { + if field.name() == Self::OP_READINESS_FIELD_NAME { + self.is_ready = Some(value) + } + } + + fn record_str(&mut self, field: &tracing_core::Field, value: &str) { + if field.name() == Self::OP_NAME_FIELD_NAME { + self.op_name = Some(value.to_string()); + } + } +} + +impl StateUpdateVisitor { + pub(crate) const RE_STATE_UPDATE_EVENT_TARGET: &'static str = "runtime::resource::state_update"; + pub(crate) const AO_STATE_UPDATE_EVENT_TARGET: &'static str = + "runtime::resource::async_op::state_update"; + + const STATE_OP_SUFFIX: &'static str = ".op"; + const STATE_UNIT_SUFFIX: &'static str = ".unit"; + + const OP_ADD: &'static str = "add"; + const OP_SUB: &'static str = "sub"; + const OP_OVERRIDE: &'static str = "override"; + + pub(crate) fn new(meta_id: console_api::MetaId) -> Self { + StateUpdateVisitor { + meta_id, + field: None, + unit: None, + op: None, + } + } + + pub(crate) fn result(self) -> Option { + Some(attribute::Update { + field: self.field?, + op: self.op, + unit: self.unit, + }) + } +} + +impl Visit for StateUpdateVisitor { + fn record_debug(&mut self, field: &field::Field, value: &dyn std::fmt::Debug) { + if !field.name().ends_with(Self::STATE_OP_SUFFIX) + && !field.name().ends_with(Self::STATE_UNIT_SUFFIX) + { + self.field = Some(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + } + + fn record_i64(&mut self, field: &field::Field, value: i64) { + if !field.name().ends_with(Self::STATE_OP_SUFFIX) + && !field.name().ends_with(Self::STATE_UNIT_SUFFIX) + { + self.field = Some(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + } + + fn record_u64(&mut self, field: &field::Field, value: u64) { + if !field.name().ends_with(Self::STATE_OP_SUFFIX) + && !field.name().ends_with(Self::STATE_UNIT_SUFFIX) + { + self.field = Some(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + } + + fn record_bool(&mut self, field: &field::Field, value: bool) { + if !field.name().ends_with(Self::STATE_OP_SUFFIX) + && !field.name().ends_with(Self::STATE_UNIT_SUFFIX) + { + self.field = Some(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + } + + fn record_str(&mut self, field: &field::Field, value: &str) { + if field.name().ends_with(Self::STATE_OP_SUFFIX) { + match value { + Self::OP_ADD => self.op = Some(attribute::UpdateOp::Add), + Self::OP_SUB => self.op = Some(attribute::UpdateOp::Sub), + Self::OP_OVERRIDE => self.op = Some(attribute::UpdateOp::Override), + _ => {} + }; + } else if field.name().ends_with(Self::STATE_UNIT_SUFFIX) { + self.unit = Some(value.to_string()); + } else { + self.field = Some(console_api::Field { + name: Some(field.name().into()), + value: Some(value.into()), + metadata_id: Some(self.meta_id.clone()), + }); + } + } +} From aef36fa3d4786d658fb7097e380c1debab08815b Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Jun 2022 22:48:12 +0200 Subject: [PATCH 28/51] Some bits work \o/ --- runtime/console/src/lib.rs | 2 +- runtime/executor/src/pool.rs | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index d0c9305..fb3ba3a 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -252,7 +252,7 @@ where { fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest { let dropped = match (metadata.name(), metadata.target()) { - (_, "executor::spawn") => { + (_, "executor::task") | ("runtime.spawn", _) => { self.spawn_callsites.insert(metadata); &self.shared.dropped_tasks } diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index ff422d1..b74e035 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -22,7 +22,7 @@ use std::sync::Arc; use std::time::Duration; use tracing::field::FieldSet; use tracing::metadata::Kind; -use tracing::{Level, Span}; +use tracing::{Instrument, Level, Span}; #[derive(Debug)] struct Spooler<'a> { @@ -111,14 +111,13 @@ impl<'a, 'executor: 'a> Executor<'executor> { F: Future + Send + 'a, R: Send + 'a, { - let span = tracing::info_span!( - parent: &self.span, - //target: "executor::spawn", - "runtime.spawn" + let span = tracing::trace_span!( + target: "executor::task", + "runtime.spawn", ); - let _guard = span.enter(); + let fut = future.instrument(span); - let (task, handle) = LightProc::recoverable(future, self.schedule()); + let (task, handle) = LightProc::recoverable(fut, self.schedule()); tracing::trace!("spawning sendable task"); task.schedule(); handle @@ -129,13 +128,13 @@ impl<'a, 'executor: 'a> Executor<'executor> { F: Future + 'a, R: Send + 'a, { - let span = tracing::info_span!( - parent: &self.span, - //target: "executor::spawn", - "runtime.spawn_local" + let span = tracing::trace_span!( + target: "executor::task", + "runtime.spawn", ); - let _guard = span.enter(); - let (task, handle) = LightProc::recoverable(future, schedule_local()); + let fut = future.instrument(span); + + let (task, handle) = LightProc::recoverable(fut, schedule_local()); tracing::trace!("spawning sendable task"); task.schedule(); handle From 2d8d6f9938e0efa63c7b0b0bef36f2feeaccc0ff Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 22 Jun 2022 14:43:09 +0200 Subject: [PATCH 29/51] tracing more data --- Cargo.lock | 1 + bffhd/lib.rs | 13 ++++++-- runtime/console/src/lib.rs | 6 ++-- runtime/console/src/server.rs | 3 -- runtime/console/src/visitors.rs | 6 ++++ runtime/executor/src/pool.rs | 8 ++--- runtime/executor/src/worker.rs | 1 + runtime/lightproc/Cargo.toml | 1 + runtime/lightproc/src/lib.rs | 4 +-- runtime/lightproc/src/lightproc.rs | 15 ++++++--- runtime/lightproc/src/proc_data.rs | 7 ++++ runtime/lightproc/src/raw_proc.rs | 53 +++++++++++++++++++++++++++++- 12 files changed, 98 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 164f0c9..4764797 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1736,6 +1736,7 @@ dependencies = [ "futures-executor", "lazy_static", "pin-utils", + "tracing", ] [[package]] diff --git a/bffhd/lib.rs b/bffhd/lib.rs index e0c9d86..4153e9b 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -62,6 +62,7 @@ use crate::users::db::UserDB; use crate::users::Users; use executor::pool::Executor; use signal_hook::consts::signal::*; +use tracing::Span; pub struct Diflouroborane { config: Config, @@ -70,6 +71,7 @@ pub struct Diflouroborane { pub users: Users, pub roles: Roles, pub resources: ResourcesHandle, + span: Span, } pub static RESOURCES: OnceCell = OnceCell::new(); @@ -77,11 +79,14 @@ pub static RESOURCES: OnceCell = OnceCell::new(); impl Diflouroborane { pub fn new(config: Config) -> miette::Result { let mut server = logging::init(&config.logging); + let span = tracing::info_span!( + target: "bffh", + "bffh" + ); + let span2 = span.clone(); + let _guard = span2.enter(); tracing::info!(version = env::VERSION, "Starting BFFH"); - let span = tracing::info_span!("setup"); - let _guard = span.enter(); - let executor = Executor::new(); if let Some(aggregator) = server.aggregator.take() { @@ -116,10 +121,12 @@ impl Diflouroborane { users, roles, resources, + span, }) } pub fn run(&mut self) -> miette::Result<()> { + let _guard = self.span.enter(); let mut signals = signal_hook_async_std::Signals::new(&[SIGINT, SIGQUIT, SIGTERM]) .into_diagnostic() .wrap_err("Failed to construct signal handler")?; diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index fb3ba3a..112c6d2 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -252,11 +252,11 @@ where { fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest { let dropped = match (metadata.name(), metadata.target()) { - (_, "executor::task") | ("runtime.spawn", _) => { + (_, TaskVisitor::SPAWN_TARGET) | (TaskVisitor::SPAWN_NAME, _) => { self.spawn_callsites.insert(metadata); &self.shared.dropped_tasks } - (_, "executor::waker") => { + (WakerVisitor::WAKE_TARGET, _) => { self.waker_callsites.insert(metadata); &self.shared.dropped_tasks } @@ -268,7 +268,7 @@ where self.async_op_callsites.insert(metadata); &self.shared.dropped_async_ops } - ("runtime.resource.async_op.poll", _) => { + (AsyncOpVisitor::ASYNC_OP_POLL_NAME, _) => { self.async_op_poll_callsites.insert(metadata); &self.shared.dropped_async_ops } diff --git a/runtime/console/src/server.rs b/runtime/console/src/server.rs index 14ff385..b92e8c0 100644 --- a/runtime/console/src/server.rs +++ b/runtime/console/src/server.rs @@ -97,9 +97,6 @@ impl Server { pub async fn serve( mut self, /*, incoming: I */ ) -> Result<(), Box> { - // TODO: Spawn two tasks; the aggregator that's collecting stats, aggregating and - // collating them and the server task doing the tonic gRPC stuff - let svc = InstrumentServer::new(self); tonic::transport::Server::builder() diff --git a/runtime/console/src/visitors.rs b/runtime/console/src/visitors.rs index 858703f..77398d1 100644 --- a/runtime/console/src/visitors.rs +++ b/runtime/console/src/visitors.rs @@ -240,6 +240,9 @@ impl FieldVisitor { } impl TaskVisitor { + pub(crate) const SPAWN_TARGET: &'static str = "executor::task"; + pub(crate) const SPAWN_NAME: &'static str = "runtime.spawn"; + pub(crate) fn new(meta_id: console_api::MetaId) -> Self { TaskVisitor { field_visitor: FieldVisitor::new(meta_id), @@ -340,6 +343,7 @@ impl Visit for FieldVisitor { impl AsyncOpVisitor { pub(crate) const ASYNC_OP_SPAN_NAME: &'static str = "runtime.resource.async_op"; + pub(crate) const ASYNC_OP_POLL_NAME: &'static str = "runtime.resource.async_op.poll"; const ASYNC_OP_SRC_FIELD_NAME: &'static str = "source"; pub(crate) fn result(self) -> Option<(String, bool)> { @@ -365,6 +369,8 @@ impl Visit for AsyncOpVisitor { } impl WakerVisitor { + pub(crate) const WAKE_TARGET: &'static str = "executor::waker"; + const WAKE: &'static str = "waker.wake"; const WAKE_BY_REF: &'static str = "waker.wake_by_ref"; const CLONE: &'static str = "waker.clone"; diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index b74e035..d6f1338 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -113,11 +113,11 @@ impl<'a, 'executor: 'a> Executor<'executor> { { let span = tracing::trace_span!( target: "executor::task", + parent: &self.span, "runtime.spawn", ); - let fut = future.instrument(span); - let (task, handle) = LightProc::recoverable(fut, self.schedule()); + let (task, handle) = LightProc::recoverable(future, self.schedule(), span); tracing::trace!("spawning sendable task"); task.schedule(); handle @@ -130,11 +130,11 @@ impl<'a, 'executor: 'a> Executor<'executor> { { let span = tracing::trace_span!( target: "executor::task", + parent: &self.span, "runtime.spawn", ); - let fut = future.instrument(span); - let (task, handle) = LightProc::recoverable(fut, schedule_local()); + let (task, handle) = LightProc::recoverable(future, schedule_local(), span); tracing::trace!("spawning sendable task"); task.schedule(); handle diff --git a/runtime/executor/src/worker.rs b/runtime/executor/src/worker.rs index 345afa7..413476e 100644 --- a/runtime/executor/src/worker.rs +++ b/runtime/executor/src/worker.rs @@ -2,6 +2,7 @@ use crossbeam_deque::{Injector, Steal, Stealer, Worker}; use crossbeam_queue::SegQueue; use crossbeam_utils::sync::{Parker, Unparker}; use lightproc::prelude::LightProc; +use lightproc::raw_proc::ProcData; use std::marker::PhantomData; use std::sync::Arc; use std::time::Duration; diff --git a/runtime/lightproc/Cargo.toml b/runtime/lightproc/Cargo.toml index 52403ea..7d4be3e 100644 --- a/runtime/lightproc/Cargo.toml +++ b/runtime/lightproc/Cargo.toml @@ -15,6 +15,7 @@ crossbeam-utils = "0.8" pin-utils = "0.1.0" bitfield = "0.13.2" bitflags = "1.3.2" +tracing = "0.1" [dev-dependencies] crossbeam = "0.8" diff --git a/runtime/lightproc/src/lib.rs b/runtime/lightproc/src/lib.rs index fc325b0..2bcf9db 100644 --- a/runtime/lightproc/src/lib.rs +++ b/runtime/lightproc/src/lib.rs @@ -16,9 +16,9 @@ #![forbid(missing_docs)] #![forbid(missing_debug_implementations)] #![forbid(unused_import_braces)] -#![forbid(unused_imports)] +#![warn(unused_imports)] #![forbid(unused_must_use)] -#![forbid(unused_variables)] +//TODO: reenable #![forbid(unused_variables)] mod catch_unwind; mod layout_helpers; diff --git a/runtime/lightproc/src/lightproc.rs b/runtime/lightproc/src/lightproc.rs index c94b5fa..0900f56 100644 --- a/runtime/lightproc/src/lightproc.rs +++ b/runtime/lightproc/src/lightproc.rs @@ -36,6 +36,7 @@ use std::future::Future; use std::mem::ManuallyDrop; use std::panic::AssertUnwindSafe; use std::ptr::NonNull; +use tracing::Span; /// Shared functionality for both Send and !Send LightProc pub struct LightProc { @@ -76,14 +77,18 @@ impl LightProc { /// println!("future panicked!: {}", &reason); /// }); /// ``` - pub fn recoverable<'a, F, R, S>(future: F, schedule: S) -> (Self, RecoverableHandle) + pub fn recoverable<'a, F, R, S>( + future: F, + schedule: S, + span: Span, + ) -> (Self, RecoverableHandle) where F: Future + 'a, R: 'a, S: Fn(LightProc) + 'a, { let recovery_future = AssertUnwindSafe(future).catch_unwind(); - let (proc, handle) = Self::build(recovery_future, schedule); + let (proc, handle) = Self::build(recovery_future, schedule, span); (proc, RecoverableHandle::new(handle)) } @@ -92,6 +97,7 @@ impl LightProc { /// /// # Example /// ```rust + /// # use tracing::Span; /// # use lightproc::prelude::*; /// # /// # // ... future that does work @@ -113,15 +119,16 @@ impl LightProc { /// let standard = LightProc::build( /// future, /// schedule_function, + /// Span::current(), /// ); /// ``` - pub fn build<'a, F, R, S>(future: F, schedule: S) -> (Self, ProcHandle) + pub fn build<'a, F, R, S>(future: F, schedule: S, span: Span) -> (Self, ProcHandle) where F: Future + 'a, R: 'a, S: Fn(LightProc) + 'a, { - let raw_proc = RawProc::allocate(future, schedule); + let raw_proc = RawProc::allocate(future, schedule, span); let proc = LightProc { raw_proc }; let handle = ProcHandle::new(raw_proc); (proc, handle) diff --git a/runtime/lightproc/src/proc_data.rs b/runtime/lightproc/src/proc_data.rs index be9b956..8c215a5 100644 --- a/runtime/lightproc/src/proc_data.rs +++ b/runtime/lightproc/src/proc_data.rs @@ -5,6 +5,7 @@ use std::cell::Cell; use std::fmt::{self, Debug, Formatter}; use std::sync::atomic::Ordering; use std::task::Waker; +use tracing::Span; /// The pdata of a proc. /// @@ -25,6 +26,12 @@ pub(crate) struct ProcData { /// In addition to the actual waker virtual table, it also contains pointers to several other /// methods necessary for bookkeeping the heap-allocated proc. pub(crate) vtable: &'static ProcVTable, + + /// The span assigned to this process. + /// + /// A lightproc has a tracing span associated that allow recording occurances of vtable calls + /// for this process. + pub(crate) span: Span, } impl ProcData { diff --git a/runtime/lightproc/src/raw_proc.rs b/runtime/lightproc/src/raw_proc.rs index 4c28603..c06cf95 100644 --- a/runtime/lightproc/src/raw_proc.rs +++ b/runtime/lightproc/src/raw_proc.rs @@ -16,8 +16,10 @@ use std::ptr::NonNull; use std::sync::atomic::Ordering; use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; +use tracing::Span; /// Raw pointers to the fields of a proc. +// TODO: Make generic over the Allocator used! pub(crate) struct RawProc<'a, F, R, S> { pub(crate) pdata: *const ProcData, pub(crate) schedule: *const S, @@ -26,6 +28,10 @@ pub(crate) struct RawProc<'a, F, R, S> { // Make the lifetime 'a of the future invariant _marker: PhantomData<&'a ()>, + // TODO: We should link a proc to a process bucket for scheduling and tracing + // => nope, do that via scheduling func + // TODO: A proc should be able to be assigned a name for tracing and reporting + // This could also be implemented via storing a Span similar to `Instrumented` } impl<'a, F, R, S> RawProc<'a, F, R, S> @@ -37,7 +43,7 @@ where /// Allocates a proc with the given `future` and `schedule` function. /// /// It is assumed there are initially only the `LightProc` reference and the `ProcHandle`. - pub(crate) fn allocate(future: F, schedule: S) -> NonNull<()> { + pub(crate) fn allocate(future: F, schedule: S, span: Span) -> NonNull<()> { // Compute the layout of the proc for allocation. Abort if the computation fails. let proc_layout = Self::proc_layout(); @@ -70,6 +76,7 @@ where destroy: Self::destroy, tick: Self::tick, }, + span, }); // Write the schedule function as the third field of the proc. @@ -128,6 +135,16 @@ where /// Wakes a waker. unsafe fn wake(ptr: *const ()) { let raw = Self::from_ptr(ptr); + let _guard = (&(*raw.pdata).span).enter(); + let id = (&(*raw.pdata).span) + .id() + .map(|id| id.into_u64()) + .unwrap_or(0); + tracing::trace!( + target: "executor::waker", + op = "waker.wake", + task.id = id, + ); let mut state = (*raw.pdata).state.load(Ordering::Acquire); @@ -191,6 +208,16 @@ where /// Wakes a waker by reference. unsafe fn wake_by_ref(ptr: *const ()) { let raw = Self::from_ptr(ptr); + let _guard = (&(*raw.pdata).span).enter(); + let id = (&(*raw.pdata).span) + .id() + .map(|id| id.into_u64()) + .unwrap_or(0); + tracing::trace!( + target: "executor::waker", + op = "waker.wake_by_ref", + task.id = id, + ); let mut state = (*raw.pdata).state.load(Ordering::Acquire); @@ -250,6 +277,17 @@ where /// Clones a waker. unsafe fn clone_waker(ptr: *const ()) -> RawWaker { let raw = Self::from_ptr(ptr); + let _guard = (&(*raw.pdata).span).enter(); + let id = (&(*raw.pdata).span) + .id() + .map(|id| id.into_u64()) + .unwrap_or(0); + tracing::trace!( + target: "executor::waker", + op = "waker.clone", + task.id = id, + ); + let raw_waker = &(*raw.pdata).vtable.raw_waker; // Increment the reference count. With any kind of reference-counted data structure, @@ -271,6 +309,16 @@ where #[inline] unsafe fn decrement(ptr: *const ()) { let raw = Self::from_ptr(ptr); + let _guard = (&(*raw.pdata).span).enter(); + let id = (&(*raw.pdata).span) + .id() + .map(|id| id.into_u64()) + .unwrap_or(0); + tracing::trace!( + target: "executor::waker", + op = "waker.drop", + task.id = id, + ); // Decrement the reference count. let new = (*raw.pdata).state.fetch_sub(1, Ordering::AcqRel); @@ -323,6 +371,9 @@ where // Drop the schedule function. (raw.schedule as *mut S).drop_in_place(); + // Drop the proc data containing the associated Span + (raw.pdata as *mut ProcData).drop_in_place(); + // Finally, deallocate the memory reserved by the proc. alloc::dealloc(ptr as *mut u8, proc_layout.layout); } From 18d69063fd6fb7b856b91ff58188f213704ef324 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 22 Jun 2022 19:01:51 +0200 Subject: [PATCH 30/51] Even more console shenanigans --- bffhd/lib.rs | 17 ++++++++++++++++- runtime/console/src/aggregate.rs | 8 +++----- runtime/console/src/lib.rs | 16 ++++++++++++---- runtime/console/src/stats.rs | 3 +-- runtime/executor/src/pool.rs | 16 ++++++++++++++-- runtime/executor/src/worker.rs | 1 - 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 4153e9b..777b81e 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -92,7 +92,22 @@ impl Diflouroborane { if let Some(aggregator) = server.aggregator.take() { executor.spawn(aggregator.run()); } - executor.spawn(server.serve()); + tracing::info!("Server is being spawned"); + let handle = executor.spawn(server.serve()); + std::thread::spawn(move || { + let result = async_io::block_on(handle); + match result { + Some(Ok(())) => { + tracing::info!("console server finished without error"); + } + Some(Err(error)) => { + tracing::info!(%error, "console server finished with error"); + } + None => { + tracing::info!("console server finished with panic"); + } + } + }); let env = StateDB::open_env(&config.db_path)?; diff --git a/runtime/console/src/aggregate.rs b/runtime/console/src/aggregate.rs index 1acf6d2..4029a1f 100644 --- a/runtime/console/src/aggregate.rs +++ b/runtime/console/src/aggregate.rs @@ -335,13 +335,13 @@ impl Aggregator { async_op_update, }; - //self.watchers.retain_and_shrink(|watch: &Watch| watch.update - // (&update)); + self.watchers + .retain(|watch: &Watch| watch.update(&update)); let stats = &self.task_stats; // Assuming there are much fewer task details subscribers than there are // stats updates, iterate over `details_watchers` and compact the map. - /*self.details_watchers.retain_and_shrink(|id, watchers| { + self.details_watchers.retain(|id, watchers| { if let Some(task_stats) = stats.get(id) { let details = tasks::TaskDetails { task_id: Some(id.clone().into()), @@ -354,8 +354,6 @@ impl Aggregator { false } }); - - */ } /// Update the current state with data from a single event. diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index 112c6d2..e5c7cc7 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -256,7 +256,7 @@ where self.spawn_callsites.insert(metadata); &self.shared.dropped_tasks } - (WakerVisitor::WAKE_TARGET, _) => { + (_, WakerVisitor::WAKE_TARGET) => { self.waker_callsites.insert(metadata); &self.shared.dropped_tasks } @@ -311,7 +311,9 @@ where (event, stats) }) { ctx.span(id) - .expect("`on_new_span` called with nonexistent span. This is a tracing bug."); + .expect("`on_new_span` called with nonexistent span. This is a tracing bug.") + .extensions_mut() + .insert(stats); } } else if self.is_resource(metadata) { let at = Instant::now(); @@ -346,7 +348,10 @@ where }; (event, stats) }) { - ctx.span(id).expect("if `on_new_span` was called, the span must exist; this is a `tracing` bug!").extensions_mut().insert(stats); + ctx.span(id) + .expect("if `on_new_span` was called, the span must exist; this is a `tracing` bug!") + .extensions_mut() + .insert(stats); } } } else if self.is_async_op(metadata) { @@ -381,7 +386,10 @@ where (event, stats) }) { - ctx.span(id).expect("if `on_new_span` was called, the span must exist; this is a `tracing` bug!").extensions_mut().insert(stats); + ctx.span(id) + .expect("if `on_new_span` was called, the span must exist; this is a `tracing` bug!") + .extensions_mut() + .insert(stats); } } } diff --git a/runtime/console/src/stats.rs b/runtime/console/src/stats.rs index 9018d8f..021c8da 100644 --- a/runtime/console/src/stats.rs +++ b/runtime/console/src/stats.rs @@ -209,7 +209,7 @@ impl TaskStats { polls: AtomicUsize::new(0), }, wakes: AtomicUsize::new(0), - waker_clones: AtomicUsize::new(0), + waker_clones: AtomicUsize::new(1), waker_drops: AtomicUsize::new(0), self_wakes: AtomicUsize::new(0), } @@ -232,7 +232,6 @@ impl TaskStats { use event::WakeOp; match op { WakeOp::Wake { self_wake } => { - self.waker_drops.fetch_add(1, Ordering::Release); self.wake(at, self_wake); } WakeOp::WakeByRef { self_wake } => { diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index d6f1338..4c91363 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -106,15 +106,21 @@ impl<'a, 'executor: 'a> Executor<'executor> { /// ); /// # } /// ``` + #[track_caller] pub fn spawn(&self, future: F) -> RecoverableHandle where F: Future + Send + 'a, R: Send + 'a, { + let location = std::panic::Location::caller(); let span = tracing::trace_span!( target: "executor::task", - parent: &self.span, + parent: Span::current(), "runtime.spawn", + kind = "global", + loc.file = location.file(), + loc.line = location.line(), + loc.col = location.column(), ); let (task, handle) = LightProc::recoverable(future, self.schedule(), span); @@ -123,15 +129,21 @@ impl<'a, 'executor: 'a> Executor<'executor> { handle } + #[track_caller] pub fn spawn_local(&self, future: F) -> RecoverableHandle where F: Future + 'a, R: Send + 'a, { + let location = std::panic::Location::caller(); let span = tracing::trace_span!( target: "executor::task", - parent: &self.span, + parent: Span::current(), "runtime.spawn", + kind = "local", + loc.file = location.file(), + loc.line = location.line(), + loc.col = location.column(), ); let (task, handle) = LightProc::recoverable(future, schedule_local(), span); diff --git a/runtime/executor/src/worker.rs b/runtime/executor/src/worker.rs index 413476e..345afa7 100644 --- a/runtime/executor/src/worker.rs +++ b/runtime/executor/src/worker.rs @@ -2,7 +2,6 @@ use crossbeam_deque::{Injector, Steal, Stealer, Worker}; use crossbeam_queue::SegQueue; use crossbeam_utils::sync::{Parker, Unparker}; use lightproc::prelude::LightProc; -use lightproc::raw_proc::ProcData; use std::marker::PhantomData; use std::sync::Arc; use std::time::Duration; From 9a86bae45a5900e3cd90d4bb5db9fe938f2cde00 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 13:02:40 +0200 Subject: [PATCH 31/51] Improve Drop guards --- runtime/lightproc/src/raw_proc.rs | 45 ++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/runtime/lightproc/src/raw_proc.rs b/runtime/lightproc/src/raw_proc.rs index c06cf95..81e0c21 100644 --- a/runtime/lightproc/src/raw_proc.rs +++ b/runtime/lightproc/src/raw_proc.rs @@ -24,6 +24,7 @@ pub(crate) struct RawProc<'a, F, R, S> { pub(crate) pdata: *const ProcData, pub(crate) schedule: *const S, pub(crate) future: *mut F, + // TODO: Replace with `MaybeUninit` pub(crate) output: *mut R, // Make the lifetime 'a of the future invariant @@ -135,7 +136,6 @@ where /// Wakes a waker. unsafe fn wake(ptr: *const ()) { let raw = Self::from_ptr(ptr); - let _guard = (&(*raw.pdata).span).enter(); let id = (&(*raw.pdata).span) .id() .map(|id| id.into_u64()) @@ -208,7 +208,6 @@ where /// Wakes a waker by reference. unsafe fn wake_by_ref(ptr: *const ()) { let raw = Self::from_ptr(ptr); - let _guard = (&(*raw.pdata).span).enter(); let id = (&(*raw.pdata).span) .id() .map(|id| id.into_u64()) @@ -277,7 +276,6 @@ where /// Clones a waker. unsafe fn clone_waker(ptr: *const ()) -> RawWaker { let raw = Self::from_ptr(ptr); - let _guard = (&(*raw.pdata).span).enter(); let id = (&(*raw.pdata).span) .id() .map(|id| id.into_u64()) @@ -309,7 +307,6 @@ where #[inline] unsafe fn decrement(ptr: *const ()) { let raw = Self::from_ptr(ptr); - let _guard = (&(*raw.pdata).span).enter(); let id = (&(*raw.pdata).span) .id() .map(|id| id.into_u64()) @@ -383,9 +380,11 @@ where /// Ticking will call `poll` once and re-schedule the task if it returns `Poll::Pending`. If /// polling its future panics, the proc will be closed and the panic propagated into the caller. unsafe fn tick(ptr: *const ()) { - let raw = Self::from_ptr(ptr); + let mut raw = Self::from_ptr(ptr); + // Enter the span associated with the process to track execution time if enabled. + let _guard = (&(*raw.pdata).span).enter(); - // Create a context from the raw proc pointer and the vtable inside the its pdata. + // Create a context from the raw proc pointer and the vtable inside its pdata. let waker = ManuallyDrop::new(Waker::from_raw(RawWaker::new( ptr, &(*raw.pdata).vtable.raw_waker, @@ -431,9 +430,9 @@ where // Poll the inner future, but surround it with a guard that closes the proc in case polling // panics. - let guard = Guard(raw); - let poll = ::poll(Pin::new_unchecked(&mut *raw.future), cx); - mem::forget(guard); + let drop_guard = Guard(&mut raw); + let poll = ::poll(drop_guard.pin_future(), cx); + drop_guard.disable(); match poll { Poll::Ready(out) => { @@ -548,21 +547,43 @@ impl<'a, F, R, S> Clone for RawProc<'a, F, R, S> { } impl<'a, F, R, S> Copy for RawProc<'a, F, R, S> {} +#[repr(transparent)] /// A guard that closes the proc if polling its future panics. -struct Guard<'a, F, R, S>(RawProc<'a, F, R, S>) +struct Guard<'guard, 'a, F, R, S>(&'guard mut RawProc<'a, F, R, S>) where F: Future + 'a, R: 'a, S: Fn(LightProc) + 'a; -impl<'a, F, R, S> Drop for Guard<'a, F, R, S> +impl<'guard, 'a, F, R, S> Guard<'guard, 'a, F, R, S> +where + F: Future + 'a, + R: 'a, + S: Fn(LightProc) + 'a, +{ + #[inline(always)] + /// Disable the guard again. + /// + /// This does essentially nothing but prevents the Drop implementation from being called + fn disable(self) { + // Put `self` in a ManuallyDrop telling the compiler to explicitly not call Drop::drop + let _ = ManuallyDrop::new(self); + } + + #[inline(always)] + unsafe fn pin_future(&self) -> Pin<&mut F> { + Pin::new_unchecked(&mut *self.0.future) + } +} + +impl<'a, F, R, S> Drop for Guard<'_, 'a, F, R, S> where F: Future + 'a, R: 'a, S: Fn(LightProc) + 'a, { fn drop(&mut self) { - let raw = self.0; + let raw = &self.0; let ptr = raw.pdata as *const (); unsafe { From 567df800f30d47baf1ac76fed06d74875f3e94ea Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 13:33:29 +0200 Subject: [PATCH 32/51] A number of small updates batched into one commit --- runtime/console/src/lib.rs | 3 ++- runtime/console/src/visitors.rs | 2 +- runtime/executor/src/pool.rs | 4 ++-- runtime/lightproc/src/proc_handle.rs | 2 ++ runtime/lightproc/src/raw_proc.rs | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/runtime/console/src/lib.rs b/runtime/console/src/lib.rs index e5c7cc7..c3d38af 100644 --- a/runtime/console/src/lib.rs +++ b/runtime/console/src/lib.rs @@ -256,7 +256,7 @@ where self.spawn_callsites.insert(metadata); &self.shared.dropped_tasks } - (_, WakerVisitor::WAKE_TARGET) => { + (_, WakerVisitor::WAKER_EVENT_TARGET) => { self.waker_callsites.insert(metadata); &self.shared.dropped_tasks } @@ -419,6 +419,7 @@ where } } } + } else if self.poll_op_callsites.contains(metadata) { } } diff --git a/runtime/console/src/visitors.rs b/runtime/console/src/visitors.rs index 77398d1..75706a6 100644 --- a/runtime/console/src/visitors.rs +++ b/runtime/console/src/visitors.rs @@ -369,7 +369,7 @@ impl Visit for AsyncOpVisitor { } impl WakerVisitor { - pub(crate) const WAKE_TARGET: &'static str = "executor::waker"; + pub(crate) const WAKER_EVENT_TARGET: &'static str = "executor::waker"; const WAKE: &'static str = "waker.wake"; const WAKE_BY_REF: &'static str = "waker.wake_by_ref"; diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index 4c91363..50adb8b 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -117,10 +117,10 @@ impl<'a, 'executor: 'a> Executor<'executor> { target: "executor::task", parent: Span::current(), "runtime.spawn", - kind = "global", loc.file = location.file(), loc.line = location.line(), loc.col = location.column(), + kind = "global", ); let (task, handle) = LightProc::recoverable(future, self.schedule(), span); @@ -140,10 +140,10 @@ impl<'a, 'executor: 'a> Executor<'executor> { target: "executor::task", parent: Span::current(), "runtime.spawn", - kind = "local", loc.file = location.file(), loc.line = location.line(), loc.col = location.column(), + kind = "local", ); let (task, handle) = LightProc::recoverable(future, schedule_local(), span); diff --git a/runtime/lightproc/src/proc_handle.rs b/runtime/lightproc/src/proc_handle.rs index f2144e6..2dd7666 100644 --- a/runtime/lightproc/src/proc_handle.rs +++ b/runtime/lightproc/src/proc_handle.rs @@ -22,6 +22,8 @@ pub struct ProcHandle { pub(crate) raw_proc: NonNull<()>, /// A marker capturing the generic type `R`. + // TODO: Instead of writing the future output to the RawProc on heap, put it in the handle + // (if still available). pub(crate) result: PhantomData, } diff --git a/runtime/lightproc/src/raw_proc.rs b/runtime/lightproc/src/raw_proc.rs index 81e0c21..b23d4f4 100644 --- a/runtime/lightproc/src/raw_proc.rs +++ b/runtime/lightproc/src/raw_proc.rs @@ -24,7 +24,8 @@ pub(crate) struct RawProc<'a, F, R, S> { pub(crate) pdata: *const ProcData, pub(crate) schedule: *const S, pub(crate) future: *mut F, - // TODO: Replace with `MaybeUninit` + // TODO: Replace with `*mut MaybeUninit`? And also, store the result in the handle if that's + // still available, instead of copying it to the heap. pub(crate) output: *mut R, // Make the lifetime 'a of the future invariant From 2f5f7cb0d79b900d808a5a578a132e5ca72a9640 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 14:37:17 +0200 Subject: [PATCH 33/51] More ideas about how to record data --- Cargo.lock | 35 ++++++++++++++++++++++++++++ runtime/executor/Cargo.toml | 6 ++++- runtime/executor/src/pool.rs | 11 --------- runtime/lightproc/src/proc_handle.rs | 8 +++++++ 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4764797..6932cc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1119,11 +1119,13 @@ dependencies = [ "crossbeam-utils", "futures-timer", "futures-util", + "hdrhistogram", "lazy_static", "libc", "lightproc", "num_cpus", "once_cell", + "parking_lot", "pin-utils", "rand", "slab", @@ -1782,6 +1784,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.17" @@ -2029,6 +2041,29 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + [[package]] name = "percent-encoding" version = "2.1.0" diff --git a/runtime/executor/Cargo.toml b/runtime/executor/Cargo.toml index ac3a2c3..85c6df6 100644 --- a/runtime/executor/Cargo.toml +++ b/runtime/executor/Cargo.toml @@ -40,13 +40,17 @@ libc = "0.2" num_cpus = "1.13" pin-utils = "0.1.0" slab = "0.4" +parking_lot = "0.12" # Allocator arrayvec = { version = "0.7.0" } futures-timer = "3.0.2" once_cell = "1.4.0" -tracing = "0.1.19" crossbeam-queue = "0.3.0" +hdrhistogram = "7.5" + +# Stats & Tracing +tracing = "0.1" [dev-dependencies] async-std = "1.10.0" diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index 50adb8b..4f288d6 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -48,21 +48,12 @@ impl Spooler<'_> { /// Global executor pub struct Executor<'a> { spooler: Arc>, - span: Span, } impl<'a, 'executor: 'a> Executor<'executor> { pub fn new() -> Self { Executor { spooler: Arc::new(Spooler::new()), - span: tracing::span!(Level::INFO, "executor"), - } - } - - pub fn new_with_parent_span(parent: &Span) -> Self { - Executor { - spooler: Arc::new(Spooler::new()), - span: tracing::span!(parent: parent, Level::INFO, "executor"), } } @@ -115,7 +106,6 @@ impl<'a, 'executor: 'a> Executor<'executor> { let location = std::panic::Location::caller(); let span = tracing::trace_span!( target: "executor::task", - parent: Span::current(), "runtime.spawn", loc.file = location.file(), loc.line = location.line(), @@ -138,7 +128,6 @@ impl<'a, 'executor: 'a> Executor<'executor> { let location = std::panic::Location::caller(); let span = tracing::trace_span!( target: "executor::task", - parent: Span::current(), "runtime.spawn", loc.file = location.file(), loc.line = location.line(), diff --git a/runtime/lightproc/src/proc_handle.rs b/runtime/lightproc/src/proc_handle.rs index 2dd7666..7a399d6 100644 --- a/runtime/lightproc/src/proc_handle.rs +++ b/runtime/lightproc/src/proc_handle.rs @@ -191,6 +191,14 @@ impl Drop for ProcHandle { let mut output = None; unsafe { + // Record dropping the handle for this task + let id = (&(*pdata).span).id().map(|id| id.into_u64()).unwrap_or(0); + tracing::trace!( + target: "executor::handle", + op = "handle.drop", + task.id = id, + ); + // Optimistically assume the `ProcHandle` is being dropped just after creating the // proc. This is a common case so if the handle is not used, the overhead of it is only // one compare-exchange operation. From ff727b6d972fcd567ab74313f3b0262adf7fac93 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 16:00:21 +0200 Subject: [PATCH 34/51] Noting down improvement ideas for procs --- runtime/lightproc/src/lightproc.rs | 4 ++-- runtime/lightproc/src/proc_handle.rs | 12 ++++++++++-- runtime/lightproc/src/raw_proc.rs | 12 ++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/runtime/lightproc/src/lightproc.rs b/runtime/lightproc/src/lightproc.rs index 0900f56..b527c54 100644 --- a/runtime/lightproc/src/lightproc.rs +++ b/runtime/lightproc/src/lightproc.rs @@ -46,8 +46,8 @@ pub struct LightProc { // LightProc is both Sync and Send because it explicitly handles synchronization internally: // The state of a `LightProc` is only modified atomically guaranteeing a consistent view from all -// threads. Existing handles are atomically reference counted so the proc itself will not be dropped -// until all pointers to it are themselves dropped. +// threads. Existing wakers (and the proc_handle) are atomically reference counted so the proc +// itself will not be dropped until all pointers to it are themselves dropped. // However, if the future or result inside the LightProc is !Send the executor must ensure that // the `schedule` function does not move the LightProc to a different thread. unsafe impl Send for LightProc {} diff --git a/runtime/lightproc/src/proc_handle.rs b/runtime/lightproc/src/proc_handle.rs index 7a399d6..124c5ca 100644 --- a/runtime/lightproc/src/proc_handle.rs +++ b/runtime/lightproc/src/proc_handle.rs @@ -6,6 +6,7 @@ use crate::state::*; use std::fmt::{self, Debug, Formatter}; use std::future::Future; use std::marker::{PhantomData, Unpin}; +use std::mem::MaybeUninit; use std::pin::Pin; use std::ptr::NonNull; use std::sync::atomic::Ordering; @@ -24,7 +25,7 @@ pub struct ProcHandle { /// A marker capturing the generic type `R`. // TODO: Instead of writing the future output to the RawProc on heap, put it in the handle // (if still available). - pub(crate) result: PhantomData, + pub(crate) result: MaybeUninit, } unsafe impl Send for ProcHandle {} @@ -36,7 +37,7 @@ impl ProcHandle { pub(crate) fn new(raw_proc: NonNull<()>) -> Self { Self { raw_proc, - result: PhantomData, + result: MaybeUninit::uninit(), } } @@ -50,6 +51,13 @@ impl ProcHandle { let pdata = ptr as *const ProcData; unsafe { + let id = (&(*pdata).span).id().map(|id| id.into_u64()).unwrap_or(0); + tracing::trace!( + target: "executor::handle", + op = "handle.cancel", + task.id = id, + ); + let mut state = (*pdata).state.load(Ordering::Acquire); loop { diff --git a/runtime/lightproc/src/raw_proc.rs b/runtime/lightproc/src/raw_proc.rs index b23d4f4..4cb7041 100644 --- a/runtime/lightproc/src/raw_proc.rs +++ b/runtime/lightproc/src/raw_proc.rs @@ -20,6 +20,7 @@ use tracing::Span; /// Raw pointers to the fields of a proc. // TODO: Make generic over the Allocator used! +// TODO: The actual layout stored could be expressed as a struct w/ union. Maybe do that? pub(crate) struct RawProc<'a, F, R, S> { pub(crate) pdata: *const ProcData, pub(crate) schedule: *const S, @@ -30,10 +31,13 @@ pub(crate) struct RawProc<'a, F, R, S> { // Make the lifetime 'a of the future invariant _marker: PhantomData<&'a ()>, - // TODO: We should link a proc to a process bucket for scheduling and tracing - // => nope, do that via scheduling func - // TODO: A proc should be able to be assigned a name for tracing and reporting - // This could also be implemented via storing a Span similar to `Instrumented` + // TODO: We should link a proc to a process group for scheduling and tracing + // - sub-tasks should start in the same group by default + // - that data needs to be available when calling `spawn` and to decide which task to run. + // So there must be a thread-local reference to it that's managed by the executor, and + // updated when a new task is being polled. + // Additionally `schedule` must have a reference to it to be able to push to the right + // queue? The `schedule` fn could just come from the group instead. } impl<'a, F, R, S> RawProc<'a, F, R, S> From 7e113bab474842d09e85b9b0043e60e4991acdc0 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 17:28:13 +0200 Subject: [PATCH 35/51] Attach a GroupID to all LightProcs --- runtime/executor/src/pool.rs | 7 +++++-- runtime/lightproc/src/lib.rs | 2 ++ runtime/lightproc/src/lightproc.rs | 13 ++++++++++--- runtime/lightproc/src/proc_data.rs | 11 +++++++++++ runtime/lightproc/src/raw_proc.rs | 16 ++++++++++++---- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index 4f288d6..e5038ba 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -13,6 +13,7 @@ use crate::worker::{Sleeper, WorkerThread}; use crossbeam_deque::{Injector, Stealer}; use lightproc::lightproc::LightProc; use lightproc::recoverable_handle::RecoverableHandle; +use lightproc::GroupId; use std::cell::Cell; use std::future::Future; use std::iter::Iterator; @@ -112,8 +113,9 @@ impl<'a, 'executor: 'a> Executor<'executor> { loc.col = location.column(), kind = "global", ); + let cgroup = None; - let (task, handle) = LightProc::recoverable(future, self.schedule(), span); + let (task, handle) = LightProc::recoverable(future, self.schedule(), span, cgroup); tracing::trace!("spawning sendable task"); task.schedule(); handle @@ -134,8 +136,9 @@ impl<'a, 'executor: 'a> Executor<'executor> { loc.col = location.column(), kind = "local", ); + let cgroup = None; - let (task, handle) = LightProc::recoverable(future, schedule_local(), span); + let (task, handle) = LightProc::recoverable(future, schedule_local(), span, cgroup); tracing::trace!("spawning sendable task"); task.schedule(); handle diff --git a/runtime/lightproc/src/lib.rs b/runtime/lightproc/src/lib.rs index 2bcf9db..075e0f4 100644 --- a/runtime/lightproc/src/lib.rs +++ b/runtime/lightproc/src/lib.rs @@ -33,6 +33,8 @@ pub mod lightproc; pub mod proc_handle; pub mod recoverable_handle; +pub use proc_data::GroupId; + /// The lightproc prelude. /// /// The prelude re-exports lightproc structs and handles from this crate. diff --git a/runtime/lightproc/src/lightproc.rs b/runtime/lightproc/src/lightproc.rs index b527c54..c8e2f6c 100644 --- a/runtime/lightproc/src/lightproc.rs +++ b/runtime/lightproc/src/lightproc.rs @@ -31,6 +31,7 @@ use crate::proc_ext::ProcFutureExt; use crate::proc_handle::ProcHandle; use crate::raw_proc::RawProc; use crate::recoverable_handle::RecoverableHandle; +use crate::GroupId; use std::fmt::{self, Debug, Formatter}; use std::future::Future; use std::mem::ManuallyDrop; @@ -81,6 +82,7 @@ impl LightProc { future: F, schedule: S, span: Span, + cgroup: Option, ) -> (Self, RecoverableHandle) where F: Future + 'a, @@ -88,7 +90,7 @@ impl LightProc { S: Fn(LightProc) + 'a, { let recovery_future = AssertUnwindSafe(future).catch_unwind(); - let (proc, handle) = Self::build(recovery_future, schedule, span); + let (proc, handle) = Self::build(recovery_future, schedule, span, cgroup); (proc, RecoverableHandle::new(handle)) } @@ -122,13 +124,18 @@ impl LightProc { /// Span::current(), /// ); /// ``` - pub fn build<'a, F, R, S>(future: F, schedule: S, span: Span) -> (Self, ProcHandle) + pub fn build<'a, F, R, S>( + future: F, + schedule: S, + span: Span, + cgroup: Option, + ) -> (Self, ProcHandle) where F: Future + 'a, R: 'a, S: Fn(LightProc) + 'a, { - let raw_proc = RawProc::allocate(future, schedule, span); + let raw_proc = RawProc::allocate(future, schedule, span, cgroup); let proc = LightProc { raw_proc }; let handle = ProcHandle::new(raw_proc); (proc, handle) diff --git a/runtime/lightproc/src/proc_data.rs b/runtime/lightproc/src/proc_data.rs index 8c215a5..9412459 100644 --- a/runtime/lightproc/src/proc_data.rs +++ b/runtime/lightproc/src/proc_data.rs @@ -3,10 +3,16 @@ use crate::state::*; use crossbeam_utils::Backoff; use std::cell::Cell; use std::fmt::{self, Debug, Formatter}; +use std::num::NonZeroU64; use std::sync::atomic::Ordering; use std::task::Waker; use tracing::Span; +#[derive(Clone, Debug, Eq, PartialEq, Hash)] +#[repr(transparent)] +/// Opaque id of the group this proc belongs to +pub struct GroupId(NonZeroU64); + /// The pdata of a proc. /// /// This pdata is stored right at the beginning of every heap-allocated proc. @@ -32,6 +38,11 @@ pub(crate) struct ProcData { /// A lightproc has a tracing span associated that allow recording occurances of vtable calls /// for this process. pub(crate) span: Span, + + /// Control group assigned to this process. + /// + /// The control group links this process to its supervision tree + pub(crate) cgroup: Option, } impl ProcData { diff --git a/runtime/lightproc/src/raw_proc.rs b/runtime/lightproc/src/raw_proc.rs index 4cb7041..1481fb0 100644 --- a/runtime/lightproc/src/raw_proc.rs +++ b/runtime/lightproc/src/raw_proc.rs @@ -15,6 +15,7 @@ use std::pin::Pin; use std::ptr::NonNull; use std::sync::atomic::Ordering; +use crate::GroupId; use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; use tracing::Span; @@ -49,7 +50,12 @@ where /// Allocates a proc with the given `future` and `schedule` function. /// /// It is assumed there are initially only the `LightProc` reference and the `ProcHandle`. - pub(crate) fn allocate(future: F, schedule: S, span: Span) -> NonNull<()> { + pub(crate) fn allocate( + future: F, + schedule: S, + span: Span, + cgroup: Option, + ) -> NonNull<()> { // Compute the layout of the proc for allocation. Abort if the computation fails. let proc_layout = Self::proc_layout(); @@ -83,6 +89,7 @@ where tick: Self::tick, }, span, + cgroup, }); // Write the schedule function as the third field of the proc. @@ -360,10 +367,11 @@ where raw.output as *const () } - /// Cleans up proc's resources and deallocates it. + /// Cleans up the procs resources and deallocates the associated memory. /// - /// If the proc has not been closed, then its future or the output will be dropped. The - /// schedule function gets dropped too. + /// The future or output stored will *not* be dropped, but its memory will be freed. Callers + /// must ensure that they are correctly dropped beforehand if either of those is still alive to + /// prevent use-after-free. #[inline] unsafe fn destroy(ptr: *const ()) { let raw = Self::from_ptr(ptr); From 3075e1c0274a065c363a2a66650a207fa9efd7bb Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 17:28:41 +0200 Subject: [PATCH 36/51] Get started on supervision trees --- Cargo.lock | 1 - runtime/executor/Cargo.toml | 1 - runtime/executor/src/lib.rs | 1 + runtime/executor/src/supervision.rs | 3 +++ 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 runtime/executor/src/supervision.rs diff --git a/Cargo.lock b/Cargo.lock index 6932cc5..6def150 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1128,7 +1128,6 @@ dependencies = [ "parking_lot", "pin-utils", "rand", - "slab", "tracing", "tracing-subscriber", ] diff --git a/runtime/executor/Cargo.toml b/runtime/executor/Cargo.toml index 85c6df6..be7e348 100644 --- a/runtime/executor/Cargo.toml +++ b/runtime/executor/Cargo.toml @@ -39,7 +39,6 @@ lazy_static = "1.4" libc = "0.2" num_cpus = "1.13" pin-utils = "0.1.0" -slab = "0.4" parking_lot = "0.12" # Allocator diff --git a/runtime/executor/src/lib.rs b/runtime/executor/src/lib.rs index c3d71fa..96024ea 100644 --- a/runtime/executor/src/lib.rs +++ b/runtime/executor/src/lib.rs @@ -32,6 +32,7 @@ pub mod manage; pub mod placement; pub mod pool; pub mod run; +mod supervision; mod thread_manager; mod worker; diff --git a/runtime/executor/src/supervision.rs b/runtime/executor/src/supervision.rs new file mode 100644 index 0000000..9694c84 --- /dev/null +++ b/runtime/executor/src/supervision.rs @@ -0,0 +1,3 @@ +pub(crate) struct SupervisionRegistry {} + +impl SupervisionRegistry {} From e7358838d547fd647938353222b89dfc1181c57b Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 17:31:57 +0200 Subject: [PATCH 37/51] Oh whoops handle that --- bffhd/audit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bffhd/audit.rs b/bffhd/audit.rs index e30fe3d..35f0340 100644 --- a/bffhd/audit.rs +++ b/bffhd/audit.rs @@ -51,7 +51,7 @@ impl AuditLog { let mut ser = Serializer::new(&mut writer); line.serialize(&mut ser) .expect("failed to serialize audit log line"); - writer.write("\n".as_bytes())?; + writer.write_all("\n".as_bytes())?; Ok(()) } } From 77e093594536e9b84a9538fed024d794d4b84bda Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Thu, 23 Jun 2022 21:19:31 +0200 Subject: [PATCH 38/51] Allow tracking cgroups with futures --- Cargo.lock | 2 + bffhd/capnp/mod.rs | 5 +- runtime/executor/Cargo.toml | 4 + runtime/executor/src/lib.rs | 2 + runtime/executor/src/pool.rs | 39 +++++- runtime/executor/src/supervision.rs | 180 +++++++++++++++++++++++++++- runtime/lightproc/src/lightproc.rs | 1 + runtime/lightproc/src/proc_data.rs | 34 ++++++ 8 files changed, 261 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6def150..f01992f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1128,6 +1128,8 @@ dependencies = [ "parking_lot", "pin-utils", "rand", + "sharded-slab", + "thread_local", "tracing", "tracing-subscriber", ] diff --git a/bffhd/capnp/mod.rs b/bffhd/capnp/mod.rs index d19ac28..42ba89f 100644 --- a/bffhd/capnp/mod.rs +++ b/bffhd/capnp/mod.rs @@ -3,7 +3,7 @@ use async_net::TcpListener; use capnp_rpc::rpc_twoparty_capnp::Side; use capnp_rpc::twoparty::VatNetwork; use capnp_rpc::RpcSystem; -use executor::prelude::Executor; +use executor::prelude::{Executor, GroupId, SupervisionRegistry}; use futures_rustls::server::TlsStream; use futures_rustls::TlsAcceptor; use futures_util::stream::FuturesUnordered; @@ -167,6 +167,7 @@ impl APIServer { tracing::error!("Error during RPC handling: {}", e); } }; - self.executor.spawn_local(f); + let cgroup = SupervisionRegistry::with(SupervisionRegistry::new_group); + self.executor.spawn_local_cgroup(f, cgroup); } } diff --git a/runtime/executor/Cargo.toml b/runtime/executor/Cargo.toml index be7e348..b11121f 100644 --- a/runtime/executor/Cargo.toml +++ b/runtime/executor/Cargo.toml @@ -51,6 +51,10 @@ hdrhistogram = "7.5" # Stats & Tracing tracing = "0.1" +# Supervision trees +sharded-slab = "0.1" +thread_local = "1.1" + [dev-dependencies] async-std = "1.10.0" tracing = { version = "0.1.19", features = ["max_level_trace"]} diff --git a/runtime/executor/src/lib.rs b/runtime/executor/src/lib.rs index 96024ea..60fa1f9 100644 --- a/runtime/executor/src/lib.rs +++ b/runtime/executor/src/lib.rs @@ -40,4 +40,6 @@ mod worker; /// Prelude of Bastion Executor pub mod prelude { pub use crate::pool::*; + pub use crate::supervision::SupervisionRegistry; + pub use lightproc::GroupId; } diff --git a/runtime/executor/src/pool.rs b/runtime/executor/src/pool.rs index e5038ba..9686706 100644 --- a/runtime/executor/src/pool.rs +++ b/runtime/executor/src/pool.rs @@ -8,6 +8,7 @@ //! [`Worker`]: crate::run_queue::Worker use crate::run::block; +use crate::supervision::SupervisionRegistry; use crate::thread_manager::{DynamicRunner, ThreadManager}; use crate::worker::{Sleeper, WorkerThread}; use crossbeam_deque::{Injector, Stealer}; @@ -49,12 +50,19 @@ impl Spooler<'_> { /// Global executor pub struct Executor<'a> { spooler: Arc>, + root_cgroup: GroupId, } impl<'a, 'executor: 'a> Executor<'executor> { pub fn new() -> Self { + let root_cgroup = SupervisionRegistry::with(|registry| { + let cgroup = registry.new_root_group(); + registry.set_current(&cgroup); + cgroup + }); Executor { spooler: Arc::new(Spooler::new()), + root_cgroup, } } @@ -105,6 +113,8 @@ impl<'a, 'executor: 'a> Executor<'executor> { R: Send + 'a, { let location = std::panic::Location::caller(); + let cgroup = SupervisionRegistry::current(); + let id = cgroup.as_ref().map(|id| id.into_u64()).unwrap_or(0); let span = tracing::trace_span!( target: "executor::task", "runtime.spawn", @@ -112,8 +122,8 @@ impl<'a, 'executor: 'a> Executor<'executor> { loc.line = location.line(), loc.col = location.column(), kind = "global", + cgroup = id, ); - let cgroup = None; let (task, handle) = LightProc::recoverable(future, self.schedule(), span, cgroup); tracing::trace!("spawning sendable task"); @@ -128,6 +138,8 @@ impl<'a, 'executor: 'a> Executor<'executor> { R: Send + 'a, { let location = std::panic::Location::caller(); + let cgroup = SupervisionRegistry::current(); + let id = cgroup.as_ref().map(|id| id.into_u64()).unwrap_or(0); let span = tracing::trace_span!( target: "executor::task", "runtime.spawn", @@ -135,8 +147,8 @@ impl<'a, 'executor: 'a> Executor<'executor> { loc.line = location.line(), loc.col = location.column(), kind = "local", + cgroup = id, ); - let cgroup = None; let (task, handle) = LightProc::recoverable(future, schedule_local(), span, cgroup); tracing::trace!("spawning sendable task"); @@ -144,6 +156,29 @@ impl<'a, 'executor: 'a> Executor<'executor> { handle } + #[track_caller] + pub fn spawn_local_cgroup(&self, future: F, cgroup: GroupId) -> RecoverableHandle + where + F: Future + 'a, + R: Send + 'a, + { + let location = std::panic::Location::caller(); + let span = tracing::trace_span!( + target: "executor::task", + "runtime.spawn", + loc.file = location.file(), + loc.line = location.line(), + loc.col = location.column(), + kind = "local", + cgroup = cgroup.into_u64(), + ); + + let (task, handle) = LightProc::recoverable(future, schedule_local(), span, Some(cgroup)); + tracing::trace!("spawning sendable task"); + task.schedule(); + handle + } + /// Block the calling thread until the given future completes. /// /// # Example diff --git a/runtime/executor/src/supervision.rs b/runtime/executor/src/supervision.rs index 9694c84..a11cfe0 100644 --- a/runtime/executor/src/supervision.rs +++ b/runtime/executor/src/supervision.rs @@ -1,3 +1,179 @@ -pub(crate) struct SupervisionRegistry {} +use lightproc::GroupId; +use once_cell::sync::OnceCell; +use sharded_slab::pool::Ref; +use sharded_slab::{Clear, Pool}; +use std::borrow::Borrow; +use std::cell; +use std::cell::RefCell; +use std::sync::atomic::{fence, AtomicUsize, Ordering}; +use thread_local::ThreadLocal; -impl SupervisionRegistry {} +static REGISTRY: OnceCell = OnceCell::new(); + +fn id_to_idx(id: &GroupId) -> usize { + (id.into_u64() as usize).wrapping_sub(1) +} + +fn idx_to_id(idx: usize) -> GroupId { + GroupId::from_u64(idx.wrapping_add(1) as u64) +} + +pub struct SupervisionRegistry { + groups: Pool, + // TODO: would this be better as the full stack? + current: ThreadLocal>, +} + +impl SupervisionRegistry { + fn new() -> Self { + Self { + groups: Pool::new(), + current: ThreadLocal::new(), + } + } + + pub fn with(f: impl FnOnce(&Self) -> T) -> T { + let this = REGISTRY.get_or_init(SupervisionRegistry::new); + f(&this) + } + + pub(crate) fn get(&self, id: &GroupId) -> Option> { + self.groups.get(id_to_idx(id)) + } + + #[inline] + pub fn current_ref(&self) -> Option> { + self.current.get().map(|c| c.borrow()) + } + + pub fn current() -> Option { + Self::with(|this| this.current_ref().map(|id| this.clone_group(&id))) + } + + pub(crate) fn set_current(&self, id: &GroupId) { + self.current.get_or(|| RefCell::new(id.clone())); + } + + pub fn new_root_group(&self) -> GroupId { + self.new_group_inner(None) + } + + pub fn new_group(&self) -> GroupId { + let parent = self.current_ref().map(|id| self.clone_group(&id)); + self.new_group_inner(parent) + } + + fn new_group_inner(&self, parent: Option) -> GroupId { + tracing::trace_span!( + target: "executor::supervision", + "new_group" + ); + let parent_id = parent.as_ref().map(|id| id.into_non_zero_u64()); + let idx = self + .groups + .create_with(|group| { + group.parent = parent; + + let ref_cnt = group.ref_count.get_mut(); + debug_assert_eq!(0, *ref_cnt); + *ref_cnt = 1; + }) + .expect("Failed to allocate a new group"); + + let id = idx_to_id(idx); + tracing::trace!( + target: "executor::supervision", + parent = parent_id, + id = id.into_non_zero_u64(), + "process group created" + ); + + id + } + + fn clone_group(&self, id: &GroupId) -> GroupId { + tracing::trace!( + target: "executor::supervision", + id = id.into_u64(), + "cloning process group" + ); + let group = self + .get(&id) + .unwrap_or_else(|| panic!("tried to clone group {:?}, but no such group exists!", id)); + + let ref_cnt = group.ref_count.fetch_add(1, Ordering::Relaxed); + assert_ne!( + 0, ref_cnt, + "tried cloning group {:?} that was already closed", + id + ); + id.clone() + } + + /// Try to close the group with the given ID + /// + /// If this method returns `true` the Group was closed. Otherwise there are still references + /// left open. + fn try_close(&self, id: GroupId) -> bool { + tracing::trace!( + target: "executor::supervision", + id = id.into_u64(), + "dropping process group" + ); + let group = match self.get(&id) { + None if std::thread::panicking() => return false, + None => panic!("tried to drop a ref to {:?}, but no such group exists!", id), + Some(group) => group, + }; + + // Reference count *decreases* on the other hand must observe strong ordering — when + let remaining = group.ref_count.fetch_sub(1, Ordering::Release); + if !std::thread::panicking() { + assert!(remaining < usize::MAX, "group reference count overflow"); + } + if remaining > 1 { + return false; + } + + // Generate a compiler fence making sure that all other calls to `try_close` are finished + // before the one that returns `true`. + fence(Ordering::Acquire); + true + } +} + +#[derive(Debug)] +pub(crate) struct GroupInner { + parent: Option, + ref_count: AtomicUsize, +} + +impl GroupInner { + #[inline] + /// Increment the reference count of this group and return the previous value + fn increment_refcnt(&self) -> usize { + // Reference count increases don't need strong ordering. The increments can be done in + // any order as long as they *do* happen. + self.ref_count.fetch_add(1, Ordering::Relaxed) + } +} + +impl Default for GroupInner { + fn default() -> Self { + Self { + parent: None, + ref_count: AtomicUsize::new(0), + } + } +} + +impl Clear for GroupInner { + fn clear(&mut self) { + // A group is always alive as long as at least one of its children is alive. So each + // Group holds a reference to its parent if it has one. If a group is being deleted this + // reference must be closed too, i.e. the parent reference count reduced by one. + if let Some(parent) = self.parent.take() { + SupervisionRegistry::with(|reg| reg.try_close(parent)); + } + } +} diff --git a/runtime/lightproc/src/lightproc.rs b/runtime/lightproc/src/lightproc.rs index c8e2f6c..63af3cd 100644 --- a/runtime/lightproc/src/lightproc.rs +++ b/runtime/lightproc/src/lightproc.rs @@ -122,6 +122,7 @@ impl LightProc { /// future, /// schedule_function, /// Span::current(), + /// None, /// ); /// ``` pub fn build<'a, F, R, S>( diff --git a/runtime/lightproc/src/proc_data.rs b/runtime/lightproc/src/proc_data.rs index 9412459..138fc2c 100644 --- a/runtime/lightproc/src/proc_data.rs +++ b/runtime/lightproc/src/proc_data.rs @@ -13,6 +13,40 @@ use tracing::Span; /// Opaque id of the group this proc belongs to pub struct GroupId(NonZeroU64); +impl GroupId { + /// Construct an ID from an u64 + /// + /// # Panics + /// - if the provided `u64` is `0`. + pub fn from_u64(i: u64) -> Self { + Self(NonZeroU64::new(i).expect("group id must be > 0")) + } + + #[inline] + /// Construct an ID from a NonZeroU64 + /// + /// This method can't fail + pub const fn from_non_zero_u64(i: NonZeroU64) -> Self { + Self(i) + } + + #[allow(clippy::wrong_self_convention)] + //noinspection RsSelfConvention + #[inline] + /// Convert a GroupId into a u64 + pub const fn into_u64(&self) -> u64 { + self.0.get() + } + + #[allow(clippy::wrong_self_convention)] + //noinspection RsSelfConvention + #[inline] + /// Convert a GroupId into a NonZeroU64 + pub const fn into_non_zero_u64(&self) -> NonZeroU64 { + self.0 + } +} + /// The pdata of a proc. /// /// This pdata is stored right at the beginning of every heap-allocated proc. From 57fb279092fe6b6eee89952be8398e594f8752a4 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 24 Jun 2022 12:24:29 +0200 Subject: [PATCH 39/51] Runtime things furthermore --- runtime/lightproc/src/proc_data.rs | 2 +- runtime/lightproc/src/proc_handle.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/lightproc/src/proc_data.rs b/runtime/lightproc/src/proc_data.rs index 138fc2c..d6d0e9c 100644 --- a/runtime/lightproc/src/proc_data.rs +++ b/runtime/lightproc/src/proc_data.rs @@ -113,7 +113,7 @@ impl ProcData { } } - /// Notifies the proc blocked on the proc. + /// Notifies the proc blocked on this proc, if any. /// /// If there is a registered waker, it will be removed from the pdata and woken. #[inline] diff --git a/runtime/lightproc/src/proc_handle.rs b/runtime/lightproc/src/proc_handle.rs index 124c5ca..f04fef0 100644 --- a/runtime/lightproc/src/proc_handle.rs +++ b/runtime/lightproc/src/proc_handle.rs @@ -25,7 +25,7 @@ pub struct ProcHandle { /// A marker capturing the generic type `R`. // TODO: Instead of writing the future output to the RawProc on heap, put it in the handle // (if still available). - pub(crate) result: MaybeUninit, + pub(crate) marker: PhantomData, } unsafe impl Send for ProcHandle {} @@ -37,7 +37,7 @@ impl ProcHandle { pub(crate) fn new(raw_proc: NonNull<()>) -> Self { Self { raw_proc, - result: MaybeUninit::uninit(), + marker: PhantomData, } } From 13bbe2bee9570c6e7ae5f3d30c50ded4c6641bb1 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 24 Jun 2022 12:25:52 +0200 Subject: [PATCH 40/51] Add a connection-specific span to each API handler --- bffhd/capnp/connection.rs | 6 +++++- bffhd/capnp/mod.rs | 40 +++++++++++++++++++++++++++++++++------ bffhd/lib.rs | 25 +++++++++++------------- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/bffhd/capnp/connection.rs b/bffhd/capnp/connection.rs index f8517e9..1f2a265 100644 --- a/bffhd/capnp/connection.rs +++ b/bffhd/capnp/connection.rs @@ -8,12 +8,14 @@ use crate::session::SessionManager; use capnp::capability::Promise; use capnp_rpc::pry; use rsasl::mechname::Mechname; +use tracing::Span; /// Cap'n Proto API Handler pub struct BootCap { peer_addr: SocketAddr, authentication: AuthenticationHandle, sessionmanager: SessionManager, + span: Span, } impl BootCap { @@ -21,12 +23,14 @@ impl BootCap { peer_addr: SocketAddr, authentication: AuthenticationHandle, sessionmanager: SessionManager, + span: Span, ) -> Self { - tracing::trace!(%peer_addr, "bootstrapping RPC"); + tracing::trace!(parent: &span, %peer_addr, "bootstrapping RPC"); Self { peer_addr, authentication, sessionmanager, + span, } } } diff --git a/bffhd/capnp/mod.rs b/bffhd/capnp/mod.rs index 42ba89f..e127ac0 100644 --- a/bffhd/capnp/mod.rs +++ b/bffhd/capnp/mod.rs @@ -12,7 +12,7 @@ use futures_util::{stream, AsyncRead, AsyncWrite, FutureExt, StreamExt}; use std::future::Future; use std::io; -use std::net::SocketAddr; +use std::net::{IpAddr, SocketAddr}; use crate::authentication::AuthenticationHandle; use crate::session::SessionManager; @@ -145,12 +145,35 @@ impl APIServer { peer_addr: SocketAddr, stream: impl Future>>, ) { - tracing::debug!("handling new API connection"); + let span = tracing::trace_span!("api.handle"); + let _guard = span.enter(); + + struct Peer { + ip: IpAddr, + port: u16, + } + + let peer = Peer { + ip: peer_addr.ip(), + port: peer_addr.port(), + }; + tracing::debug!( + %peer.ip, + peer.port, + "spawning api handler" + ); + + let connection_span = tracing::info_span!( + "rpcsystem", + %peer.ip, + peer.port, + ); let f = async move { + tracing::trace!(parent: &connection_span, "starting tls exchange"); let stream = match stream.await { Ok(stream) => stream, - Err(e) => { - tracing::error!("TLS handshake failed: {}", e); + Err(error) => { + tracing::error!(parent: &connection_span, %error, "TLS handshake failed"); return; } }; @@ -161,10 +184,15 @@ impl APIServer { peer_addr, self.authentication.clone(), self.sessionmanager.clone(), + connection_span.clone(), )); - if let Err(e) = RpcSystem::new(Box::new(vat), Some(bootstrap.client)).await { - tracing::error!("Error during RPC handling: {}", e); + if let Err(error) = RpcSystem::new(Box::new(vat), Some(bootstrap.client)).await { + tracing::error!( + parent: &connection_span, + %error, + "error occured during rpc handling", + ); } }; let cgroup = SupervisionRegistry::with(SupervisionRegistry::new_group); diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 777b81e..ec64ef5 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -43,7 +43,7 @@ mod tls; use std::sync::Arc; -use futures_util::StreamExt; +use futures_util::{FutureExt, StreamExt}; use miette::{Context, IntoDiagnostic, Report}; use once_cell::sync::OnceCell; @@ -94,20 +94,17 @@ impl Diflouroborane { } tracing::info!("Server is being spawned"); let handle = executor.spawn(server.serve()); - std::thread::spawn(move || { - let result = async_io::block_on(handle); - match result { - Some(Ok(())) => { - tracing::info!("console server finished without error"); - } - Some(Err(error)) => { - tracing::info!(%error, "console server finished with error"); - } - None => { - tracing::info!("console server finished with panic"); - } + executor.spawn(handle.map(|result| match result { + Some(Ok(())) => { + tracing::info!("console server finished without error"); } - }); + Some(Err(error)) => { + tracing::info!(%error, "console server finished with error"); + } + None => { + tracing::info!("console server finished with panic"); + } + })); let env = StateDB::open_env(&config.db_path)?; From 1ff3f2afb74be24cc8dc9c7902a9d5bb50c816bd Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 24 Jun 2022 13:57:47 +0200 Subject: [PATCH 41/51] log all api calls with `TRACE` level --- bffhd/capnp/authenticationsystem.rs | 86 ++++++++++++++++++++++++++++- bffhd/capnp/connection.rs | 78 ++++++++++++++++++++++---- bffhd/capnp/machinesystem.rs | 53 ++++++++++++++++++ bffhd/capnp/mod.rs | 3 +- bffhd/capnp/permissionsystem.rs | 11 ++++ bffhd/capnp/user_system.rs | 45 ++++++++++++++- bffhd/session/mod.rs | 11 +++- 7 files changed, 270 insertions(+), 17 deletions(-) diff --git a/bffhd/capnp/authenticationsystem.rs b/bffhd/capnp/authenticationsystem.rs index 563ab1b..d530dc5 100644 --- a/bffhd/capnp/authenticationsystem.rs +++ b/bffhd/capnp/authenticationsystem.rs @@ -3,7 +3,10 @@ use capnp::Error; use capnp_rpc::pry; use rsasl::property::AuthId; use rsasl::session::{Session, Step}; +use std::fmt; +use std::fmt::{Formatter, Write}; use std::io::Cursor; +use tracing::Span; use crate::capnp::session::APISession; use crate::session::SessionManager; @@ -12,19 +15,36 @@ use api::authenticationsystem_capnp::authentication::{ }; use api::authenticationsystem_capnp::{response, response::Error as ErrorCode}; +const TARGET: &str = "bffh::api::authenticationsystem"; + pub struct Authentication { + span: Span, state: State, } impl Authentication { pub fn new(session: Session, sessionmanager: SessionManager) -> Self { + let span = tracing::info_span!(target: TARGET, "Authentication",); + tracing::trace!( + target: TARGET, + parent: &span, + "constructing valid authentication system" + ); Self { + span, state: State::Running(session, sessionmanager), } } pub fn invalid_mechanism() -> Self { + let span = tracing::info_span!(target: TARGET, "Authentication",); + tracing::trace!( + target: TARGET, + parent: &span, + "constructing invalid mechanism authentication system" + ); Self { + span, state: State::InvalidMechanism, } } @@ -44,6 +64,19 @@ impl Authentication { } } +impl fmt::Display for Authentication { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("Authentication(")?; + match &self.state { + State::InvalidMechanism => f.write_str("invalid mechanism")?, + State::Finished => f.write_str("finished")?, + State::Aborted => f.write_str("aborted")?, + State::Running(_, _) => f.write_str("running")?, + } + f.write_char(')') + } +} + enum State { InvalidMechanism, Finished, @@ -53,13 +86,30 @@ enum State { impl AuthenticationSystem for Authentication { fn step(&mut self, params: StepParams, mut results: StepResults) -> Promise<(), Error> { - let span = tracing::trace_span!("step"); - let _guard = span.enter(); + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "step",).entered(); + + tracing::trace!(params.data = "", "method call"); + + #[repr(transparent)] + struct Response { + union_field: &'static str, + } + impl fmt::Display for Response { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("Response(")?; + f.write_str(self.union_field)?; + f.write_char(')') + } + } + let mut response; + let mut builder = results.get(); if let State::Running(mut session, manager) = std::mem::replace(&mut self.state, State::Aborted) { let data: &[u8] = pry!(pry!(params.get()).get_data()); + let mut out = Cursor::new(Vec::new()); match session.step(Some(data), &mut out) { Ok(Step::Done(data)) => { @@ -76,6 +126,10 @@ impl AuthenticationSystem for Authentication { capnp::Error::failed("Failed to lookup the given user".to_string()) })); + response = Response { + union_field: "successful", + }; + let mut builder = builder.init_successful(); if data.is_some() { builder.set_additional_data(out.into_inner().as_slice()); @@ -86,21 +140,49 @@ impl AuthenticationSystem for Authentication { Ok(Step::NeedsMore(_)) => { self.state = State::Running(session, manager); builder.set_challenge(out.into_inner().as_slice()); + + response = Response { + union_field: "challenge", + }; } Err(_) => { self.state = State::Aborted; self.build_error(builder); + + response = Response { + union_field: "error", + }; } } } else { self.build_error(builder); + response = Response { + union_field: "error", + }; } + tracing::trace!( + results = %response, + "method return" + ); + Promise::ok(()) } fn abort(&mut self, _: AbortParams, _: AbortResults) -> Promise<(), Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: TARGET, + parent: &self.span, + "abort", + ) + .entered(); + + tracing::trace!("method call"); + self.state = State::Aborted; + + tracing::trace!("method return"); Promise::ok(()) } } diff --git a/bffhd/capnp/connection.rs b/bffhd/capnp/connection.rs index 1f2a265..7506649 100644 --- a/bffhd/capnp/connection.rs +++ b/bffhd/capnp/connection.rs @@ -1,5 +1,7 @@ use api::connection_capnp::bootstrap; pub use api::connection_capnp::bootstrap::Client; +use std::fmt; +use std::fmt::{Formatter, Write}; use std::net::SocketAddr; use crate::authentication::AuthenticationHandle; @@ -25,7 +27,6 @@ impl BootCap { sessionmanager: SessionManager, span: Span, ) -> Self { - tracing::trace!(parent: &span, %peer_addr, "bootstrapping RPC"); Self { peer_addr, authentication, @@ -41,8 +42,14 @@ impl bootstrap::Server for BootCap { _: bootstrap::GetAPIVersionParams, _: bootstrap::GetAPIVersionResults, ) -> Promise<(), ::capnp::Error> { - let span = tracing::trace_span!("get_api_version", peer_addr=%self.peer_addr); - let _guard = span.enter(); + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: "bffh::api", + "Bootstrap", + method = "getAPIVersion", + ) + .entered(); + tracing::trace!("method call"); Promise::ok(()) } @@ -51,11 +58,24 @@ impl bootstrap::Server for BootCap { _: bootstrap::GetServerReleaseParams, mut result: bootstrap::GetServerReleaseResults, ) -> Promise<(), ::capnp::Error> { - let span = tracing::trace_span!("get_server_release", peer_addr=%self.peer_addr); - let _guard = span.enter(); + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: "bffh::api", + "Bootstrap", + method = "getServerRelease", + ) + .entered(); + tracing::trace!("method call"); + let mut builder = result.get(); builder.set_name("bffhd"); builder.set_release(crate::env::VERSION); + + tracing::trace!( + results.name = "bffhd", + results.release = crate::env::VERSION, + "method return" + ); Promise::ok(()) } @@ -64,10 +84,13 @@ impl bootstrap::Server for BootCap { _params: bootstrap::MechanismsParams, mut result: bootstrap::MechanismsResults, ) -> Promise<(), ::capnp::Error> { - let span = tracing::trace_span!("mechanisms", peer_addr=%self.peer_addr); - let _guard = span.enter(); - - tracing::trace!("mechanisms"); + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: "bffh::api", + "mechanisms", + ) + .entered(); + tracing::trace!("method call"); let builder = result.get(); let mechs: Vec<_> = self @@ -81,6 +104,28 @@ impl bootstrap::Server for BootCap { mechbuilder.set(i as u32, m); } + struct DisMechs<'a>(Vec<&'a str>); + impl fmt::Display for DisMechs<'_> { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_char('[')?; + let mut first = true; + for mechanism in self.0.iter() { + if first { + first = false; + f.write_str(mechanism)?; + } else { + f.write_str(" ,")?; + f.write_str(mechanism)?; + } + } + f.write_char(']')?; + Ok(()) + } + } + tracing::trace!( + results.mechs = %DisMechs(mechs), + "method return" + ); Promise::ok(()) } @@ -89,13 +134,17 @@ impl bootstrap::Server for BootCap { params: bootstrap::CreateSessionParams, mut result: bootstrap::CreateSessionResults, ) -> Promise<(), ::capnp::Error> { - let span = tracing::trace_span!("create_session", peer_addr=%self.peer_addr); - let _guard = span.enter(); + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: "bffh::api", + "createSession", + ) + .entered(); let params = pry!(params.get()); let mechanism: &str = pry!(params.get_mechanism()); - tracing::trace!(mechanism); + tracing::trace!(params.mechanism = mechanism, "method call"); let mechname = Mechname::new(mechanism.as_bytes()); let auth = if let Ok(mechname) = mechname { @@ -108,6 +157,11 @@ impl bootstrap::Server for BootCap { Authentication::invalid_mechanism() }; + tracing::trace!( + results.authentication = %auth, + "method return" + ); + let mut builder = result.get(); builder.set_authentication(capnp_rpc::new_client(auth)); diff --git a/bffhd/capnp/machinesystem.rs b/bffhd/capnp/machinesystem.rs index 729bd87..fad4240 100644 --- a/bffhd/capnp/machinesystem.rs +++ b/bffhd/capnp/machinesystem.rs @@ -6,17 +6,27 @@ use crate::RESOURCES; use api::machinesystem_capnp::machine_system::info; use capnp::capability::Promise; use capnp_rpc::pry; +use tracing::Span; + +const TARGET: &str = "bffh::api::machinesystem"; #[derive(Clone)] pub struct Machines { + span: Span, session: SessionHandle, resources: ResourcesHandle, } impl Machines { pub fn new(session: SessionHandle) -> Self { + let span = tracing::info_span!( + target: TARGET, + parent: &session.span, + "MachineSystem", + ); // FIXME no unwrap bad Self { + span, session, resources: RESOURCES.get().unwrap().clone(), } @@ -29,6 +39,16 @@ impl info::Server for Machines { _: info::GetMachineListParams, mut result: info::GetMachineListResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: TARGET, + parent: &self.span, + "getMachineList", + ) + .entered(); + + tracing::trace!("method call"); + let machine_list: Vec<(usize, &Resource)> = self .resources .list_all() @@ -43,6 +63,9 @@ impl info::Server for Machines { Machine::build(self.session.clone(), resource, mbuilder); } + // TODO: indicate result? + tracing::trace!("method return"); + Promise::ok(()) } @@ -51,12 +74,25 @@ impl info::Server for Machines { params: info::GetMachineParams, mut result: info::GetMachineResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: TARGET, + parent: &self.span, + "getMachine", + ) + .entered(); + let params = pry!(params.get()); let id = pry!(params.get_id()); + tracing::trace!(params.id = id, "method call"); + if let Some(resource) = self.resources.get_by_id(id) { + tracing::trace!(results = "Just", results.inner = id, "method return"); let builder = result.get(); Machine::optional_build(self.session.clone(), resource.clone(), builder); + } else { + tracing::trace!(results = "Nothing", "method return"); } Promise::ok(()) @@ -67,12 +103,29 @@ impl info::Server for Machines { params: info::GetMachineURNParams, mut result: info::GetMachineURNResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!( + target: TARGET, + parent: &self.span, + "getMachineURN", + ) + .entered(); + let params = pry!(params.get()); let urn = pry!(params.get_urn()); + tracing::trace!(params.urn = urn, "method call"); + if let Some(resource) = self.resources.get_by_urn(urn) { + tracing::trace!( + results = "Just", + results.inner = resource.get_id(), + "method return" + ); let builder = result.get(); Machine::optional_build(self.session.clone(), resource.clone(), builder); + } else { + tracing::trace!(results = "Nothing", "method return"); } Promise::ok(()) diff --git a/bffhd/capnp/mod.rs b/bffhd/capnp/mod.rs index e127ac0..9dc3db1 100644 --- a/bffhd/capnp/mod.rs +++ b/bffhd/capnp/mod.rs @@ -164,7 +164,8 @@ impl APIServer { ); let connection_span = tracing::info_span!( - "rpcsystem", + target: "bffh::api", + "Bootstrap", %peer.ip, peer.port, ); diff --git a/bffhd/capnp/permissionsystem.rs b/bffhd/capnp/permissionsystem.rs index 199e5c0..6e8eac3 100644 --- a/bffhd/capnp/permissionsystem.rs +++ b/bffhd/capnp/permissionsystem.rs @@ -5,16 +5,22 @@ use api::permissionsystem_capnp::permission_system::info::{ }; use capnp::capability::Promise; use capnp::Error; +use tracing::Span; use crate::session::SessionHandle; +const TARGET: &str = "bffh::api::permissionsystem"; + pub struct Permissions { + span: Span, roles: Roles, } impl Permissions { pub fn new(session: SessionHandle) -> Self { + let span = tracing::info_span!(target: TARGET, "PermissionSystem",); Self { + span, roles: session.roles, } } @@ -26,6 +32,10 @@ impl PermissionSystem for Permissions { _: GetRoleListParams, mut results: GetRoleListResults, ) -> Promise<(), Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "getRoleList",).entered(); + + tracing::trace!("method call"); let roles = self.roles.list().collect::>(); let mut builder = results.get(); let mut b = builder.init_role_list(roles.len() as u32); @@ -33,6 +43,7 @@ impl PermissionSystem for Permissions { let mut role_builder = b.reborrow().get(i as u32); role_builder.set_name(role); } + tracing::trace!("method return"); Promise::ok(()) } } diff --git a/bffhd/capnp/user_system.rs b/bffhd/capnp/user_system.rs index b79215d..2c735d9 100644 --- a/bffhd/capnp/user_system.rs +++ b/bffhd/capnp/user_system.rs @@ -1,20 +1,25 @@ use api::usersystem_capnp::user_system::{info, manage, search}; use capnp::capability::Promise; use capnp_rpc::pry; +use tracing::Span; use crate::capnp::user::User; use crate::session::SessionHandle; use crate::users::{db, UserRef}; +const TARGET: &str = "bffh::api::usersystem"; + #[derive(Clone)] pub struct Users { + span: Span, session: SessionHandle, } impl Users { pub fn new(session: SessionHandle) -> Self { - Self { session } + let span = tracing::info_span!(target: TARGET, "UserSystem",); + Self { span, session } } } @@ -24,8 +29,14 @@ impl info::Server for Users { _: info::GetUserSelfParams, mut result: info::GetUserSelfResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "getUserSelf").entered(); + tracing::trace!("method call"); + let builder = result.get(); User::build(self.session.clone(), builder); + + tracing::trace!("method return"); Promise::ok(()) } } @@ -36,6 +47,10 @@ impl manage::Server for Users { _: manage::GetUserListParams, mut result: manage::GetUserListResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "getUserList",).entered(); + tracing::trace!("method call"); + let userdb = self.session.users.into_inner(); let users = pry!(userdb .get_all() @@ -44,18 +59,30 @@ impl manage::Server for Users { for (i, (_, user)) in users.into_iter().enumerate() { User::fill(&self.session, user, builder.reborrow().get(i as u32)); } + + tracing::trace!("method return"); Promise::ok(()) } + fn add_user_fallible( &mut self, params: manage::AddUserFallibleParams, mut result: manage::AddUserFallibleResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "addUserFallible").entered(); + let params = pry!(params.get()); let username = pry!(params.get_username()); let password = pry!(params.get_password()); // FIXME: saslprep passwords & usernames before storing them + tracing::trace!( + params.username = username, + params.password = "", + "method call" + ); + let mut builder = result.get(); if !username.is_empty() && !password.is_empty() { @@ -81,21 +108,29 @@ impl manage::Server for Users { } } + tracing::trace!("method return"); Promise::ok(()) } + fn remove_user( &mut self, params: manage::RemoveUserParams, _: manage::RemoveUserResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "removeUser",).entered(); + let who: &str = pry!(pry!(pry!(params.get()).get_user()).get_username()); + tracing::trace!(params.user = who, "method call"); + if let Err(e) = self.session.users.del_user(who) { tracing::warn!("Failed to delete user: {:?}", e); } else { tracing::info!("Deleted user {}", who); } + tracing::trace!("method return"); Promise::ok(()) } } @@ -106,9 +141,17 @@ impl search::Server for Users { params: search::GetUserByNameParams, mut result: search::GetUserByNameResults, ) -> Promise<(), ::capnp::Error> { + let _guard = self.span.enter(); + let _span = tracing::trace_span!(target: TARGET, "getUserByName",).entered(); + let username: &str = pry!(pry!(params.get()).get_username()); + + tracing::trace!(params.username = username, "method call"); + let userref = UserRef::new(username.to_string()); User::build_optional(&self.session, Some(userref), result.get()); + + tracing::trace!("method return"); Promise::ok(()) } } diff --git a/bffhd/session/mod.rs b/bffhd/session/mod.rs index 609eefd..8533640 100644 --- a/bffhd/session/mod.rs +++ b/bffhd/session/mod.rs @@ -3,6 +3,7 @@ use crate::authorization::roles::Roles; use crate::resources::Resource; use crate::users::{db, UserRef}; use crate::Users; +use tracing::Span; #[derive(Clone)] pub struct SessionManager { @@ -19,8 +20,14 @@ impl SessionManager { pub fn open(&self, uid: impl AsRef) -> Option { let uid = uid.as_ref(); if let Some(user) = self.users.get_user(uid) { - tracing::trace!(uid, ?user, "opening new session for user"); + let span = tracing::info_span!( + target: "bffh::api", + "session", + uid = uid, + ); + tracing::trace!(parent: &span, uid, ?user, "opening session"); Some(SessionHandle { + span, users: self.users.clone(), roles: self.roles.clone(), user: UserRef::new(user.id), @@ -33,6 +40,8 @@ impl SessionManager { #[derive(Clone)] pub struct SessionHandle { + pub span: Span, + pub users: Users, pub roles: Roles, From 257fbf5506201daa85c4126e1410a8e49243a3eb Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 24 Jun 2022 14:35:19 +0200 Subject: [PATCH 42/51] Output plentiful trace info for API calls --- bffhd/capnp/authenticationsystem.rs | 17 ++++++++++++++--- bffhd/capnp/connection.rs | 4 ++-- bffhd/capnp/mod.rs | 2 +- bffhd/initiators/mod.rs | 29 ++++++++++++++++++++++++----- bffhd/session/mod.rs | 3 ++- 5 files changed, 43 insertions(+), 12 deletions(-) diff --git a/bffhd/capnp/authenticationsystem.rs b/bffhd/capnp/authenticationsystem.rs index d530dc5..56b1530 100644 --- a/bffhd/capnp/authenticationsystem.rs +++ b/bffhd/capnp/authenticationsystem.rs @@ -1,6 +1,7 @@ use capnp::capability::Promise; use capnp::Error; use capnp_rpc::pry; +use rsasl::mechname::Mechname; use rsasl::property::AuthId; use rsasl::session::{Session, Step}; use std::fmt; @@ -23,8 +24,18 @@ pub struct Authentication { } impl Authentication { - pub fn new(session: Session, sessionmanager: SessionManager) -> Self { - let span = tracing::info_span!(target: TARGET, "Authentication",); + pub fn new( + parent: &Span, + mechanism: &Mechname, /* TODO: this is stored in session as well, get it out of there. */ + session: Session, + sessionmanager: SessionManager, + ) -> Self { + let span = tracing::info_span!( + target: TARGET, + parent: parent, + "Authentication", + mechanism = mechanism.as_str() + ); tracing::trace!( target: TARGET, parent: &span, @@ -121,7 +132,7 @@ impl AuthenticationSystem for Authentication { "Authentication didn't provide an authid as required".to_string(), ) })); - let session = pry!(manager.open(uid.as_ref()).ok_or_else(|| { + let session = pry!(manager.open(&self.span, uid.as_ref()).ok_or_else(|| { tracing::warn!(uid = uid.as_str(), "Failed to lookup the given user"); capnp::Error::failed("Failed to lookup the given user".to_string()) })); diff --git a/bffhd/capnp/connection.rs b/bffhd/capnp/connection.rs index 7506649..9595ed9 100644 --- a/bffhd/capnp/connection.rs +++ b/bffhd/capnp/connection.rs @@ -90,7 +90,7 @@ impl bootstrap::Server for BootCap { "mechanisms", ) .entered(); - tracing::trace!("method call"); + tracing::trace!(target: "bffh::api", "method call"); let builder = result.get(); let mechs: Vec<_> = self @@ -149,7 +149,7 @@ impl bootstrap::Server for BootCap { let mechname = Mechname::new(mechanism.as_bytes()); let auth = if let Ok(mechname) = mechname { if let Ok(session) = self.authentication.start(mechname) { - Authentication::new(session, self.sessionmanager.clone()) + Authentication::new(&self.span, mechname, session, self.sessionmanager.clone()) } else { Authentication::invalid_mechanism() } diff --git a/bffhd/capnp/mod.rs b/bffhd/capnp/mod.rs index 9dc3db1..70345f7 100644 --- a/bffhd/capnp/mod.rs +++ b/bffhd/capnp/mod.rs @@ -165,7 +165,7 @@ impl APIServer { let connection_span = tracing::info_span!( target: "bffh::api", - "Bootstrap", + "connection", %peer.ip, peer.port, ); diff --git a/bffhd/initiators/mod.rs b/bffhd/initiators/mod.rs index e4c9714..3e24f75 100644 --- a/bffhd/initiators/mod.rs +++ b/bffhd/initiators/mod.rs @@ -17,6 +17,7 @@ use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; +use tracing::Span; use url::Url; mod dummy; @@ -33,12 +34,17 @@ pub trait Initiator: Future { #[derive(Clone)] pub struct InitiatorCallbacks { + span: Span, resource: Resource, sessions: SessionManager, } impl InitiatorCallbacks { - pub fn new(resource: Resource, sessions: SessionManager) -> Self { - Self { resource, sessions } + pub fn new(span: Span, resource: Resource, sessions: SessionManager) -> Self { + Self { + span, + resource, + sessions, + } } pub async fn try_update(&mut self, session: SessionHandle, status: Status) { @@ -46,17 +52,19 @@ impl InitiatorCallbacks { } pub fn open_session(&self, uid: &str) -> Option { - self.sessions.open(uid) + self.sessions.open(&self.span, uid) } } pub struct InitiatorDriver { + span: Span, name: String, initiator: Box, } impl InitiatorDriver { pub fn new( + span: Span, name: String, params: &HashMap, resource: Resource, @@ -65,9 +73,13 @@ impl InitiatorDriver { where I: 'static + Initiator + Unpin + Send, { - let callbacks = InitiatorCallbacks::new(resource, sessions); + let callbacks = InitiatorCallbacks::new(span.clone(), resource, sessions); let initiator = Box::new(I::new(params, callbacks)?); - Ok(Self { name, initiator }) + Ok(Self { + span, + name, + initiator, + }) } } @@ -133,15 +145,22 @@ fn load_single( resource: Resource, sessions: &SessionManager, ) -> Option { + let span = tracing::info_span!( + "initiator", + name = %name, + module = %module_name, + ); tracing::info!(%name, %module_name, ?params, "Loading initiator"); let o = match module_name.as_ref() { "Dummy" => Some(InitiatorDriver::new::( + span, name.clone(), params, resource, sessions.clone(), )), "Process" => Some(InitiatorDriver::new::( + span, name.clone(), params, resource, diff --git a/bffhd/session/mod.rs b/bffhd/session/mod.rs index 8533640..87eb902 100644 --- a/bffhd/session/mod.rs +++ b/bffhd/session/mod.rs @@ -17,11 +17,12 @@ impl SessionManager { } // TODO: make infallible - pub fn open(&self, uid: impl AsRef) -> Option { + pub fn open(&self, parent: &Span, uid: impl AsRef) -> Option { let uid = uid.as_ref(); if let Some(user) = self.users.get_user(uid) { let span = tracing::info_span!( target: "bffh::api", + parent: parent, "session", uid = uid, ); From c9a8ef7db4d0f6f980f9a9a974fc49375b4d5cc0 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 24 Jun 2022 15:14:38 +0200 Subject: [PATCH 43/51] Return a better error when --load is given a directory Closes: #55 --- bffhd/users/mod.rs | 35 +++++++++++++++++++++++++++++++++-- bin/bffhd/main.rs | 14 +++++--------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/bffhd/users/mod.rs b/bffhd/users/mod.rs index 98d4b54..8471dbf 100644 --- a/bffhd/users/mod.rs +++ b/bffhd/users/mod.rs @@ -4,9 +4,11 @@ use rkyv::{Archive, Deserialize, Infallible, Serialize}; use std::collections::HashMap; use std::fmt::{Display, Formatter, Write}; -use miette::{Context, IntoDiagnostic}; +use clap::ArgMatches; +use miette::{Context, Diagnostic, IntoDiagnostic, SourceOffset, SourceSpan}; use std::path::Path; use std::sync::Arc; +use thiserror::Error; pub mod db; @@ -100,7 +102,36 @@ impl Users { self.userdb.delete(uid) } - pub fn load_file>(&self, path: P) -> miette::Result<()> { + pub fn load_file(&self, path_str: &str) -> miette::Result<()> { + let path: &Path = Path::new(path_str); + if path.is_dir() { + #[derive(Debug, Error, Diagnostic)] + #[error("load takes a file, not a directory")] + #[diagnostic( + code(load::file), + url("https://gitlab.com/fabinfra/fabaccess/bffh/-/issues/55") + )] + struct LoadIsDirError { + #[source_code] + src: String, + + #[label("path provided")] + dir_path: SourceSpan, + + #[help] + help: String, + } + + Err(LoadIsDirError { + src: format!("--load {}", path_str), + dir_path: (7, path_str.as_bytes().len()).into(), + help: format!( + "Provide a path to a file instead, e.g. {}/users.toml", + path_str + ), + })?; + return Ok(()); + } let f = std::fs::read(path).into_diagnostic()?; let map: HashMap = toml::from_slice(&f).into_diagnostic()?; diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 27b9146..30ee060 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -122,15 +122,11 @@ fn main() -> miette::Result<()> { unimplemented!() } else if matches.is_present("load") { let bffh = Diflouroborane::new(config)?; - if let Err(error) = bffh.users.load_file(matches.value_of("load").unwrap()) { - tracing::error!( - "failed to load users from {}: {}", - matches.value_of("load").unwrap(), - error, - ); - } else { - tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); - } + + bffh.users.load_file(matches.value_of("load").unwrap())?; + + tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); + return Ok(()); } else { let keylog = matches.value_of("keylog"); From 7a0a50dc3fa127056db60323862774f45f2aace0 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 24 Jun 2022 15:17:05 +0200 Subject: [PATCH 44/51] Start taking control over exit on argument parsing failure --- bin/bffhd/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 30ee060..23b2a0f 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -75,7 +75,12 @@ fn main() -> miette::Result<()> { .max_values(1) .min_values(0) .default_missing_value("")) - .get_matches(); + .try_get_matches(); + + let matches = match matches { + Ok(m) => m, + Err(error) => error.exit(), + }; let configpath = matches .value_of("config") From a79293add1d9fde3f02ea2a0ea8a497ed9490503 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Mon, 11 Jul 2022 12:14:49 +0200 Subject: [PATCH 45/51] Better error wrapper type --- bffhd/error.rs | 189 ++++++++++++++++++++++--------------------------- bffhd/lib.rs | 8 ++- 2 files changed, 91 insertions(+), 106 deletions(-) diff --git a/bffhd/error.rs b/bffhd/error.rs index 61db8a2..e0af43b 100644 --- a/bffhd/error.rs +++ b/bffhd/error.rs @@ -1,116 +1,97 @@ +use miette::{Diagnostic, LabeledSpan, Severity, SourceCode}; +use std::error; +use std::fmt::{Display, Formatter}; +use std::io; use thiserror::Error; -use crate::db; -use rsasl::error::SessionError; -use std::any::TypeId; -use std::error::Error as StdError; -use std::fmt; -use std::fmt::Display; -use std::io; - -use crate::resources::state::db::StateDBError; -use backtrace::{Backtrace, BacktraceFmt, PrintFmt}; -use miette::{Diagnostic, LabeledSpan, Severity, SourceCode}; - -#[derive(Debug)] -pub struct TracedError { - pub inner: E, - pub backtrace: Backtrace, +pub trait Description { + const DESCRIPTION: Option<&'static str> = None; + const CODE: &'static str; + const HELP: Option<&'static str> = None; + const URL: Option<&'static str> = None; } -impl fmt::Display for TracedError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - writeln!(f, "Error: {}", self.inner)?; - - let cwd = std::env::current_dir(); - let mut print_path = - move |fmt: &mut fmt::Formatter<'_>, path: backtrace::BytesOrWideString<'_>| { - let path = path.into_path_buf(); - if let Ok(cwd) = &cwd { - if let Ok(suffix) = path.strip_prefix(cwd) { - return fmt::Display::fmt(&suffix.display(), fmt); - } - } - fmt::Display::fmt(&path.display(), fmt) - }; - let mut bf = BacktraceFmt::new(f, PrintFmt::Short, &mut print_path); - bf.add_context()?; - - Ok(()) - } -} - -impl StdError for TracedError { - fn source(&self) -> Option<&(dyn StdError + 'static)> { - self.inner.source() - } -} - -impl Diagnostic for TracedError { - #[inline(always)] - fn code<'a>(&'a self) -> Option> { - self.inner.code() - } - - #[inline(always)] - fn severity(&self) -> Option { - self.inner.severity() - } - - #[inline(always)] - fn help<'a>(&'a self) -> Option> { - self.inner.help() - } - - #[inline(always)] - fn url<'a>(&'a self) -> Option> { - self.inner.url() - } - - #[inline(always)] - fn source_code(&self) -> Option<&dyn SourceCode> { - self.inner.source_code() - } - - #[inline(always)] - fn labels(&self) -> Option + '_>> { - self.inner.labels() - } - - #[inline(always)] - fn related<'a>(&'a self) -> Option + 'a>> { - self.inner.related() - } - - #[inline(always)] - fn diagnostic_source(&self) -> Option<&dyn Diagnostic> { - self.inner.diagnostic_source() - } +pub fn wrap(error: Source) -> Error { + Error::new::(error) } #[derive(Debug, Error, Diagnostic)] -/// Shared error type -pub enum BffhError { - #[error("SASL error: {0:?}")] - SASL(SessionError), - #[error("IO error: {0}")] - IO(#[from] io::Error), - #[error("IO error: {0}")] - Boxed(#[from] Box), - #[error("IO error: {0}")] - Capnp(#[from] capnp::Error), - #[error("IO error: {0}")] - DB(#[from] db::Error), - #[error("You do not have the permission required to do that.")] - Denied, - #[error("State DB operation failed")] - StateDB(#[from] StateDBError), +pub enum Source { + #[error("io error occured")] + Io( + #[source] + #[from] + io::Error, + ), } -impl From for BffhError { - fn from(e: SessionError) -> Self { - Self::SASL(e) +#[derive(Debug)] +pub struct Error { + description: Option<&'static str>, + code: &'static str, + severity: Option, + help: Option<&'static str>, + url: Option<&'static str>, + source: Source, +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + Display::fmt(&self.source, f) } } -pub type Result = std::result::Result; +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(&self.source) + } + + fn description(&self) -> &str { + if let Some(desc) = self.description { + desc + } else { + self.source.description() + } + } +} + +impl Error { + pub fn new(source: Source) -> Self { + Self { + description: D::DESCRIPTION, + code: D::CODE, + severity: source.severity(), + help: D::HELP, + url: D::URL, + source, + } + } +} + +impl miette::Diagnostic for Error { + fn code<'a>(&'a self) -> Option> { + Some(Box::new(self.code)) + } + + fn severity(&self) -> Option { + self.severity + } + + fn help<'a>(&'a self) -> Option> { + self.help.map(|r| { + let b: Box = Box::new(r); + b + }) + } + + fn url<'a>(&'a self) -> Option> { + self.url.map(|r| { + let b: Box = Box::new(r); + b + }) + } + + fn diagnostic_source(&self) -> Option<&dyn Diagnostic> { + Some(&self.source) + } +} diff --git a/bffhd/lib.rs b/bffhd/lib.rs index ec64ef5..f0b60c7 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -76,6 +76,11 @@ pub struct Diflouroborane { pub static RESOURCES: OnceCell = OnceCell::new(); +struct SignalHandlerErr; +impl error::Description for SignalHandlerErr { + const CODE: &'static str = "signals::new"; +} + impl Diflouroborane { pub fn new(config: Config) -> miette::Result { let mut server = logging::init(&config.logging); @@ -140,8 +145,7 @@ impl Diflouroborane { pub fn run(&mut self) -> miette::Result<()> { let _guard = self.span.enter(); let mut signals = signal_hook_async_std::Signals::new(&[SIGINT, SIGQUIT, SIGTERM]) - .into_diagnostic() - .wrap_err("Failed to construct signal handler")?; + .map_err(|ioerr| error::wrap::(ioerr.into()))?; let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone()); let authentication = AuthenticationHandle::new(self.users.clone()); From 70c94feced47db0e8ca8bb27f2a45d0a6a9f0616 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Mon, 11 Jul 2022 12:27:51 +0200 Subject: [PATCH 46/51] Implement password change functionality --- bffhd/capnp/user.rs | 33 +++++++++++++++++++++++++-------- bffhd/users/db.rs | 17 ++++++++++++++--- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/bffhd/capnp/user.rs b/bffhd/capnp/user.rs index 3dcb1c6..4333a86 100644 --- a/bffhd/capnp/user.rs +++ b/bffhd/capnp/user.rs @@ -79,12 +79,21 @@ impl info::Server for User { impl manage::Server for User { fn pwd( &mut self, - _params: manage::PwdParams, + params: manage::PwdParams, _results: manage::PwdResults, ) -> Promise<(), ::capnp::Error> { - Promise::err(::capnp::Error::unimplemented( - "method not implemented".to_string(), - )) + let params = pry!(params.get()); + let old_pw = pry!(params.get_old_pwd()); + let new_pw = pry!(params.get_new_pwd()); + + let uid = self.user.get_username(); + if let Some(mut user) = self.session.users.get_user(uid) { + if let Ok(true) = user.check_password(old_pw.as_bytes()) { + user.set_pw(new_pw.as_bytes()); + self.session.users.put_user(uid, &user); + } + } + Promise::ok(()) } } @@ -148,9 +157,17 @@ impl admin::Server for User { Promise::ok(()) } - fn pwd(&mut self, _: admin::PwdParams, _: admin::PwdResults) -> Promise<(), ::capnp::Error> { - Promise::err(::capnp::Error::unimplemented( - "method not implemented".to_string(), - )) + fn pwd( + &mut self, + param: admin::PwdParams, + _: admin::PwdResults, + ) -> Promise<(), ::capnp::Error> { + let new_pw = pry!(pry!(param.get()).get_new_pwd()); + let uid = self.user.get_username(); + if let Some(mut user) = self.session.users.get_user(uid) { + user.set_pw(new_pw.as_bytes()); + self.session.users.put_user(uid, &user); + } + Promise::ok(()) } } diff --git a/bffhd/users/db.rs b/bffhd/users/db.rs index ffd9816..a8a804a 100644 --- a/bffhd/users/db.rs +++ b/bffhd/users/db.rs @@ -27,6 +27,12 @@ pub struct User { pub userdata: UserData, } +fn hash_pw(pw: &[u8]) -> argon2::Result { + let config = argon2::Config::default(); + let salt: [u8; 16] = rand::random(); + argon2::hash_encoded(pw, &salt, &config) +} + impl User { pub fn check_password(&self, pwd: &[u8]) -> miette::Result { if let Some(ref encoded) = self.userdata.passwd { @@ -39,9 +45,7 @@ impl User { } pub fn new_with_plain_pw(username: &str, password: impl AsRef<[u8]>) -> Self { - let config = argon2::Config::default(); - let salt: [u8; 16] = rand::random(); - let hash = argon2::hash_encoded(password.as_ref(), &salt, &config) + let hash = hash_pw(password.as_ref()) .expect(&format!("Failed to hash password for {}: ", username)); tracing::debug!("Hashed pw for {} to {}", username, hash); @@ -53,6 +57,13 @@ impl User { }, } } + + pub fn set_pw(&mut self, password: impl AsRef<[u8]>) { + self.userdata.passwd = Some(hash_pw(password.as_ref()).expect(&format!( + "failed to update hashed password for {}", + &self.id + ))); + } } #[derive( From 218a3165710604247ec3336b94f89e9af898afc8 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sun, 24 Jul 2022 16:07:49 +0200 Subject: [PATCH 47/51] Fix log format settings --- Cargo.lock | 1 + Cargo.toml | 1 + bffhd/audit.rs | 1 + bffhd/lib.rs | 20 +++++++++++++++++++ bffhd/logging.rs | 51 ++++++++++++++++++++++++++++++++++++++---------- 5 files changed, 64 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f01992f..cc70b38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -992,6 +992,7 @@ dependencies = [ "inventory", "lazy_static", "libc", + "lightproc", "linkme", "lmdb-rkv", "miette", diff --git a/Cargo.toml b/Cargo.toml index fdae5ba..581c6bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ dirs = "4.0.0" # Runtime executor = { path = "runtime/executor" } +lightproc = { path = "runtime/lightproc" } console = { path = "runtime/console" } # Catch&Handle POSIX process signals diff --git a/bffhd/audit.rs b/bffhd/audit.rs index 35f0340..0bf135c 100644 --- a/bffhd/audit.rs +++ b/bffhd/audit.rs @@ -10,6 +10,7 @@ use serde_json::Serializer; pub static AUDIT: OnceCell = OnceCell::new(); +// TODO: Make the audit log a tracing layer #[derive(Debug)] pub struct AuditLog { writer: Mutex>, diff --git a/bffhd/lib.rs b/bffhd/lib.rs index f0b60c7..422813a 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -61,9 +61,11 @@ use crate::tls::TlsConfig; use crate::users::db::UserDB; use crate::users::Users; use executor::pool::Executor; +use lightproc::recoverable_handle::RecoverableHandle; use signal_hook::consts::signal::*; use tracing::Span; + pub struct Diflouroborane { config: Config, executor: Executor<'static>, @@ -82,6 +84,9 @@ impl error::Description for SignalHandlerErr { } impl Diflouroborane { + pub fn setup() { + } + pub fn new(config: Config) -> miette::Result { let mut server = logging::init(&config.logging); let span = tracing::info_span!( @@ -189,3 +194,18 @@ impl Diflouroborane { Ok(()) } } + +struct ShutdownHandler { + tasks: Vec>, +} +impl ShutdownHandler { + pub fn new(tasks: Vec>) -> Self { + Self { tasks } + } + + pub fn shutdown(&mut self) { + for handle in self.tasks.drain(..) { + handle.cancel() + } + } +} \ No newline at end of file diff --git a/bffhd/logging.rs b/bffhd/logging.rs index 51d9832..8e7f100 100644 --- a/bffhd/logging.rs +++ b/bffhd/logging.rs @@ -1,7 +1,9 @@ -use tracing_subscriber::EnvFilter; - +use std::path::Path; +use tracing_subscriber::{EnvFilter, reload}; use serde::{Deserialize, Serialize}; +use tracing_subscriber::fmt::format::Format; use tracing_subscriber::prelude::*; +use tracing_subscriber::reload::Handle; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LogConfig { @@ -25,8 +27,22 @@ impl Default for LogConfig { } } +pub enum LogOutput<'a> { + Journald, + Stdout, + File(&'a Path), +} +pub struct LogConfig2<'a, F> { + output: LogOutput<'a>, + filter_str: Option<&'a str>, + format: Format +} + pub fn init(config: &LogConfig) -> console::Server { - let (console, server) = console::ConsoleLayer::new(); + let subscriber = tracing_subscriber::registry(); + + let (console_layer, server) = console::ConsoleLayer::new(); + let subscriber = subscriber.with(console_layer); let filter = if let Some(ref filter) = config.filter { EnvFilter::new(filter.as_str()) @@ -34,14 +50,29 @@ pub fn init(config: &LogConfig) -> console::Server { EnvFilter::from_env("BFFH_LOG") }; - let format = &config.format; - // TODO: Restore output format settings being settable - let fmt_layer = tracing_subscriber::fmt::layer().with_filter(filter); + let format = config.format.to_lowercase(); - tracing_subscriber::registry() - .with(fmt_layer) - .with(console) - .init(); + let fmt_layer = tracing_subscriber::fmt::layer(); + + match format.as_ref() { + "pretty" => { + let fmt_layer = fmt_layer + .pretty() + .with_filter(filter); + subscriber.with(fmt_layer).init(); + } + "compact" => { + let fmt_layer = fmt_layer + .compact() + .with_filter(filter); + subscriber.with(fmt_layer).init(); + } + _ => { + let fmt_layer = fmt_layer + .with_filter(filter); + subscriber.with(fmt_layer).init(); + } + } tracing::info!(format = format.as_str(), "Logging initialized"); From aeaae4cd7b610a4e57a00b50baa71b02ecd66d4a Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sun, 24 Jul 2022 16:39:33 +0200 Subject: [PATCH 48/51] Add dumping the user db --- bffhd/capnp/user_system.rs | 3 ++- bffhd/lib.rs | 6 ++---- bffhd/logging.rs | 17 ++++++--------- bffhd/users/db.rs | 6 +++--- bffhd/users/mod.rs | 42 +++++++++++++++++++++++++++++++++++++- bin/bffhd/main.rs | 29 ++++++++++++++++++++++++-- 6 files changed, 81 insertions(+), 22 deletions(-) diff --git a/bffhd/capnp/user_system.rs b/bffhd/capnp/user_system.rs index 2c735d9..2d40a44 100644 --- a/bffhd/capnp/user_system.rs +++ b/bffhd/capnp/user_system.rs @@ -56,7 +56,8 @@ impl manage::Server for Users { .get_all() .map_err(|e| capnp::Error::failed(format!("UserDB error: {:?}", e)))); let mut builder = result.get().init_user_list(users.len() as u32); - for (i, (_, user)) in users.into_iter().enumerate() { + for (i, (id, userdata)) in users.into_iter().enumerate() { + let user = db::User { id, userdata }; User::fill(&self.session, user, builder.reborrow().get(i as u32)); } diff --git a/bffhd/lib.rs b/bffhd/lib.rs index 422813a..81dd9ea 100644 --- a/bffhd/lib.rs +++ b/bffhd/lib.rs @@ -65,7 +65,6 @@ use lightproc::recoverable_handle::RecoverableHandle; use signal_hook::consts::signal::*; use tracing::Span; - pub struct Diflouroborane { config: Config, executor: Executor<'static>, @@ -84,8 +83,7 @@ impl error::Description for SignalHandlerErr { } impl Diflouroborane { - pub fn setup() { - } + pub fn setup() {} pub fn new(config: Config) -> miette::Result { let mut server = logging::init(&config.logging); @@ -208,4 +206,4 @@ impl ShutdownHandler { handle.cancel() } } -} \ No newline at end of file +} diff --git a/bffhd/logging.rs b/bffhd/logging.rs index 8e7f100..1fdb2c6 100644 --- a/bffhd/logging.rs +++ b/bffhd/logging.rs @@ -1,9 +1,9 @@ -use std::path::Path; -use tracing_subscriber::{EnvFilter, reload}; use serde::{Deserialize, Serialize}; +use std::path::Path; use tracing_subscriber::fmt::format::Format; use tracing_subscriber::prelude::*; use tracing_subscriber::reload::Handle; +use tracing_subscriber::{reload, EnvFilter}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LogConfig { @@ -35,7 +35,7 @@ pub enum LogOutput<'a> { pub struct LogConfig2<'a, F> { output: LogOutput<'a>, filter_str: Option<&'a str>, - format: Format + format: Format, } pub fn init(config: &LogConfig) -> console::Server { @@ -56,20 +56,15 @@ pub fn init(config: &LogConfig) -> console::Server { match format.as_ref() { "pretty" => { - let fmt_layer = fmt_layer - .pretty() - .with_filter(filter); + let fmt_layer = fmt_layer.pretty().with_filter(filter); subscriber.with(fmt_layer).init(); } "compact" => { - let fmt_layer = fmt_layer - .compact() - .with_filter(filter); + let fmt_layer = fmt_layer.compact().with_filter(filter); subscriber.with(fmt_layer).init(); } _ => { - let fmt_layer = fmt_layer - .with_filter(filter); + let fmt_layer = fmt_layer.with_filter(filter); subscriber.with(fmt_layer).init(); } } diff --git a/bffhd/users/db.rs b/bffhd/users/db.rs index a8a804a..cc13b20 100644 --- a/bffhd/users/db.rs +++ b/bffhd/users/db.rs @@ -187,15 +187,15 @@ impl UserDB { Ok(()) } - pub fn get_all(&self) -> Result, db::Error> { + pub fn get_all(&self) -> Result, db::Error> { let txn = self.env.begin_ro_txn()?; let iter = self.db.get_all(&txn)?; - let mut out = Vec::new(); + let mut out = HashMap::new(); for (uid, user) in iter { let uid = unsafe { std::str::from_utf8_unchecked(uid).to_string() }; let user: User = Deserialize::::deserialize(user.as_ref(), &mut Infallible).unwrap(); - out.push((uid, user)); + out.insert(uid, user.userdata); } Ok(out) diff --git a/bffhd/users/mod.rs b/bffhd/users/mod.rs index 8471dbf..01360e2 100644 --- a/bffhd/users/mod.rs +++ b/bffhd/users/mod.rs @@ -1,8 +1,11 @@ +use std::fs; + use lmdb::{Environment, Transaction}; use once_cell::sync::OnceCell; use rkyv::{Archive, Deserialize, Infallible, Serialize}; use std::collections::HashMap; -use std::fmt::{Display, Formatter, Write}; +use std::fmt::{Display, Formatter}; +use std::io::Write; use clap::ArgMatches; use miette::{Context, Diagnostic, IntoDiagnostic, SourceOffset, SourceSpan}; @@ -166,4 +169,41 @@ impl Users { txn.commit().map_err(crate::db::Error::from)?; Ok(()) } + + pub fn dump_file(&self, path_str: &str, force: bool) -> miette::Result { + let path = Path::new(path_str); + let exists = path.exists(); + if exists { + if !force { + #[derive(Debug, Error, Diagnostic)] + #[error("given file already exists, refusing to clobber")] + #[diagnostic(code(dump::clobber))] + struct DumpFileExists { + #[source_code] + src: String, + + #[label("file provided")] + dir_path: SourceSpan, + + #[help] + help: &'static str, + } + + Err(DumpFileExists { + src: format!("--load {}", path_str), + dir_path: (7, path_str.as_bytes().len()).into(), + help: "to force overwriting the file add `--force` as argument", + })?; + } else { + tracing::info!("output file already exists, overwriting due to `--force`"); + } + } + let mut file = fs::File::create(path).into_diagnostic()?; + + let users = self.userdb.get_all()?; + let encoded = toml::ser::to_vec(&users).into_diagnostic()?; + file.write_all(&encoded[..]).into_diagnostic()?; + + Ok(0) + } } diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 23b2a0f..d52cbca 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -1,4 +1,4 @@ -use clap::{Arg, Command}; +use clap::{Arg, Command, ValueHint}; use diflouroborane::{config, Diflouroborane}; use std::str::FromStr; @@ -61,6 +61,20 @@ fn main() -> miette::Result<()> { .help("Dump all internal databases") .long("dump") .conflicts_with("load")) + .arg( + Arg::new("dump-users") + .help("Dump the users db to the given file as TOML") + .long("dump-users") + .takes_value(true) + .value_name("FILE") + .value_hint(ValueHint::AnyPath) + .default_missing_value("users.toml") + .conflicts_with("load")) + .arg( + Arg::new("force") + .help("force ops that may clobber") + .long("force") + ) .arg( Arg::new("load") .help("Load values into the internal databases") @@ -124,7 +138,18 @@ fn main() -> miette::Result<()> { let mut config = config::read(&PathBuf::from_str(configpath).unwrap()).unwrap(); if matches.is_present("dump") { - unimplemented!() + return Err(miette::miette!("DB Dumping is currently not implemented, except for the users db, using `--dump-users`")); + } else if matches.is_present("dump-users") { + let bffh = Diflouroborane::new(config)?; + + let number = bffh.users.dump_file( + matches.value_of("dump-users").unwrap(), + matches.is_present("force"), + )?; + + tracing::info!("successfully dumped {} users", number); + + return Ok(()); } else if matches.is_present("load") { let bffh = Diflouroborane::new(config)?; From 9346e433e10ddb9f0bfdce4f6f3fafecd0309d71 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sun, 24 Jul 2022 17:11:28 +0200 Subject: [PATCH 49/51] Refactor Config into dhall module --- bffhd/config/dhall.rs | 165 +++++++++++++++++++++++++++++++++++++++++- bffhd/config/mod.rs | 155 +-------------------------------------- 2 files changed, 168 insertions(+), 152 deletions(-) diff --git a/bffhd/config/dhall.rs b/bffhd/config/dhall.rs index 169e39f..8e3e873 100644 --- a/bffhd/config/dhall.rs +++ b/bffhd/config/dhall.rs @@ -1,6 +1,169 @@ -use crate::Config; +use std::collections::HashMap; +use std::default::Default; +use std::error::Error; +use std::fmt::{Debug, Display}; +use std::marker::PhantomData; +use std::path::PathBuf; + +use serde::{Deserialize, Serialize}; + +use crate::authorization::permissions::PrivilegesBuf; +use crate::authorization::roles::Role; +use crate::capnp::{Listen, TlsListen}; +use crate::logging::LogConfig; + use std::path::Path; +use miette::IntoDiagnostic; + +#[derive(Debug)] +struct DhallConfig<'a> { + path: &'a Path, +} pub fn read_config_file(path: impl AsRef) -> Result { serde_dhall::from_file(path).parse().map_err(Into::into) } + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +/// A description of a machine +/// +/// This is the struct that a machine is serialized to/from. +/// Combining this with the actual state of the system will return a machine +pub struct MachineDescription { + /// The name of the machine. Doesn't need to be unique but is what humans will be presented. + pub name: String, + + /// An optional description of the Machine. + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" + )] + pub description: Option, + + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" + )] + pub wiki: Option, + + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" + )] + pub category: Option, + + /// The permission required + #[serde(flatten)] + pub privs: PrivilegesBuf, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Config { + /// A list of address/port pairs to listen on. + pub listens: Vec, + + /// Machine descriptions to load + pub machines: HashMap, + + /// Actors to load and their configuration options + pub actors: HashMap, + + /// Initiators to load and their configuration options + pub initiators: HashMap, + + pub mqtt_url: String, + + pub actor_connections: Vec<(String, String)>, + pub init_connections: Vec<(String, String)>, + + pub db_path: PathBuf, + pub auditlog_path: PathBuf, + + pub roles: HashMap, + + #[serde(flatten)] + pub tlsconfig: TlsListen, + + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tlskeylog: Option, + + #[serde(default, skip)] + pub verbosity: isize, + + #[serde(default, skip)] + pub logging: LogConfig, +} + +impl Config { + pub fn is_quiet(&self) -> bool { + self.verbosity < 0 + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ModuleConfig { + pub module: String, + pub params: HashMap, +} + +pub(crate) fn deser_option<'de, D, T>(d: D) -> std::result::Result, D::Error> + where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de>, +{ + Ok(T::deserialize(d).ok()) +} + +impl Default for Config { + fn default() -> Self { + let mut actors: HashMap = HashMap::new(); + let mut initiators: HashMap = HashMap::new(); + let machines = HashMap::new(); + + actors.insert( + "Actor".to_string(), + ModuleConfig { + module: "Shelly".to_string(), + params: HashMap::new(), + }, + ); + initiators.insert( + "Initiator".to_string(), + ModuleConfig { + module: "TCP-Listen".to_string(), + params: HashMap::new(), + }, + ); + + Config { + listens: vec![Listen { + address: "127.0.0.1".to_string(), + port: None, + }], + actors, + initiators, + machines, + mqtt_url: "tcp://localhost:1883".to_string(), + actor_connections: vec![("Testmachine".to_string(), "Actor".to_string())], + init_connections: vec![("Initiator".to_string(), "Testmachine".to_string())], + + db_path: PathBuf::from("/run/bffh/database"), + auditlog_path: PathBuf::from("/var/log/bffh/audit.log"), + roles: HashMap::new(), + + tlsconfig: TlsListen { + certfile: PathBuf::from("./bffh.crt"), + keyfile: PathBuf::from("./bffh.key"), + ..Default::default() + }, + + tlskeylog: None, + verbosity: 0, + logging: LogConfig::default(), + } + } +} diff --git a/bffhd/config/mod.rs b/bffhd/config/mod.rs index fe02283..3adabb9 100644 --- a/bffhd/config/mod.rs +++ b/bffhd/config/mod.rs @@ -1,157 +1,10 @@ -use std::collections::HashMap; -use std::default::Default; -use std::path::PathBuf; - -use serde::{Deserialize, Serialize}; - mod dhall; pub use dhall::read_config_file as read; +pub use dhall::{Config, ModuleConfig, MachineDescription}; +pub(crate) use dhall::deser_option; -use crate::authorization::permissions::PrivilegesBuf; -use crate::authorization::roles::Role; -use crate::capnp::{Listen, TlsListen}; -use crate::logging::LogConfig; +struct ConfigBuilder; +impl ConfigBuilder { -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(deny_unknown_fields)] -/// A description of a machine -/// -/// This is the struct that a machine is serialized to/from. -/// Combining this with the actual state of the system will return a machine -pub struct MachineDescription { - /// The name of the machine. Doesn't need to be unique but is what humans will be presented. - pub name: String, - - /// An optional description of the Machine. - #[serde( - default, - skip_serializing_if = "Option::is_none", - deserialize_with = "deser_option" - )] - pub description: Option, - - #[serde( - default, - skip_serializing_if = "Option::is_none", - deserialize_with = "deser_option" - )] - pub wiki: Option, - - #[serde( - default, - skip_serializing_if = "Option::is_none", - deserialize_with = "deser_option" - )] - pub category: Option, - - /// The permission required - #[serde(flatten)] - pub privs: PrivilegesBuf, } -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Config { - /// A list of address/port pairs to listen on. - pub listens: Vec, - - /// Machine descriptions to load - pub machines: HashMap, - - /// Actors to load and their configuration options - pub actors: HashMap, - - /// Initiators to load and their configuration options - pub initiators: HashMap, - - pub mqtt_url: String, - - pub actor_connections: Vec<(String, String)>, - pub init_connections: Vec<(String, String)>, - - pub db_path: PathBuf, - pub auditlog_path: PathBuf, - - pub roles: HashMap, - - #[serde(flatten)] - pub tlsconfig: TlsListen, - - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tlskeylog: Option, - - #[serde(default, skip)] - pub verbosity: isize, - - #[serde(default, skip)] - pub logging: LogConfig, -} - -impl Config { - pub fn is_quiet(&self) -> bool { - self.verbosity < 0 - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ModuleConfig { - pub module: String, - pub params: HashMap, -} - -pub(crate) fn deser_option<'de, D, T>(d: D) -> std::result::Result, D::Error> -where - D: serde::Deserializer<'de>, - T: serde::Deserialize<'de>, -{ - Ok(T::deserialize(d).ok()) -} - -impl Default for Config { - fn default() -> Self { - let mut actors: HashMap = HashMap::new(); - let mut initiators: HashMap = HashMap::new(); - let machines = HashMap::new(); - - actors.insert( - "Actor".to_string(), - ModuleConfig { - module: "Shelly".to_string(), - params: HashMap::new(), - }, - ); - initiators.insert( - "Initiator".to_string(), - ModuleConfig { - module: "TCP-Listen".to_string(), - params: HashMap::new(), - }, - ); - - Config { - listens: vec![Listen { - address: "127.0.0.1".to_string(), - port: None, - }], - actors, - initiators, - machines, - mqtt_url: "tcp://localhost:1883".to_string(), - actor_connections: vec![("Testmachine".to_string(), "Actor".to_string())], - init_connections: vec![("Initiator".to_string(), "Testmachine".to_string())], - - db_path: PathBuf::from("/run/bffh/database"), - auditlog_path: PathBuf::from("/var/log/bffh/audit.log"), - roles: HashMap::new(), - - tlsconfig: TlsListen { - certfile: PathBuf::from("./bffh.crt"), - keyfile: PathBuf::from("./bffh.key"), - ..Default::default() - }, - - tlskeylog: None, - verbosity: 0, - logging: LogConfig::default(), - } - } -} From e3423c7786dc7143eb3f8cd6df2f1d7d700bee90 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sun, 24 Jul 2022 17:51:12 +0200 Subject: [PATCH 50/51] Improve error messages on missing config --- bffhd/config/dhall.rs | 26 +++++++++++----------- bffhd/config/mod.rs | 52 ++++++++++++++++++++++++++++++++++++++----- bin/bffhd/main.rs | 2 +- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/bffhd/config/dhall.rs b/bffhd/config/dhall.rs index 8e3e873..b933a0b 100644 --- a/bffhd/config/dhall.rs +++ b/bffhd/config/dhall.rs @@ -12,8 +12,8 @@ use crate::authorization::roles::Role; use crate::capnp::{Listen, TlsListen}; use crate::logging::LogConfig; -use std::path::Path; use miette::IntoDiagnostic; +use std::path::Path; #[derive(Debug)] struct DhallConfig<'a> { @@ -36,23 +36,23 @@ pub struct MachineDescription { /// An optional description of the Machine. #[serde( - default, - skip_serializing_if = "Option::is_none", - deserialize_with = "deser_option" + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" )] pub description: Option, #[serde( - default, - skip_serializing_if = "Option::is_none", - deserialize_with = "deser_option" + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" )] pub wiki: Option, #[serde( - default, - skip_serializing_if = "Option::is_none", - deserialize_with = "deser_option" + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deser_option" )] pub category: Option, @@ -111,9 +111,9 @@ pub struct ModuleConfig { } pub(crate) fn deser_option<'de, D, T>(d: D) -> std::result::Result, D::Error> - where - D: serde::Deserializer<'de>, - T: serde::Deserialize<'de>, +where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de>, { Ok(T::deserialize(d).ok()) } diff --git a/bffhd/config/mod.rs b/bffhd/config/mod.rs index 3adabb9..dfce376 100644 --- a/bffhd/config/mod.rs +++ b/bffhd/config/mod.rs @@ -1,10 +1,50 @@ -mod dhall; -pub use dhall::read_config_file as read; -pub use dhall::{Config, ModuleConfig, MachineDescription}; +use std::path::Path; + +use miette::Diagnostic; +use thiserror::Error; + pub(crate) use dhall::deser_option; +pub use dhall::{Config, MachineDescription, ModuleConfig}; +mod dhall; -struct ConfigBuilder; -impl ConfigBuilder { - +#[derive(Debug, Error, Diagnostic)] +pub enum ConfigError { + #[error("The config file '{0}' does not exist or is not readable")] + #[diagnostic( + code(config::notfound), + help("Make sure the config file and the directory it's in are readable by the user running bffh") + )] + NotFound(String), + #[error("The path '{0}' does not point to a file")] + #[diagnostic( + code(config::notafile), + help("The config must be a file in the dhall format") + )] + NotAFile(String), + #[error("failed to parse config: {0}")] + #[diagnostic(code(config::parse))] + Parse( + #[from] + #[source] + serde_dhall::Error, + ), } +pub fn read(file: impl AsRef) -> Result { + let path = file.as_ref(); + if !path.exists() { + return Err(ConfigError::NotFound(path.to_string_lossy().to_string())); + } + if !path.is_file() { + return Err(ConfigError::NotAFile(path.to_string_lossy().to_string())); + } + let mut config = dhall::read_config_file(file)?; + for (envvar, value) in std::env::vars() { + match envvar.as_str() { + // Do things like this? + // "BFFH_LOG" => config.logging.filter = Some(value), + _ => {} + } + } + Ok(config) +} diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index d52cbca..fff25b7 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -135,7 +135,7 @@ fn main() -> miette::Result<()> { } } - let mut config = config::read(&PathBuf::from_str(configpath).unwrap()).unwrap(); + let mut config = config::read(&PathBuf::from_str(configpath).unwrap())?; if matches.is_present("dump") { return Err(miette::miette!("DB Dumping is currently not implemented, except for the users db, using `--dump-users`")); From ec1cac944348adc83dec9f8755d3a446edf65de9 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Mon, 22 Aug 2022 19:05:57 +0200 Subject: [PATCH 51/51] Update process initiator to make shelly-timeout doable --- bffhd/initiators/mod.rs | 4 ++ bffhd/initiators/process.rs | 83 ++++++++++++++++++++++++++++++++----- bffhd/resources/mod.rs | 2 +- 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/bffhd/initiators/mod.rs b/bffhd/initiators/mod.rs index 3e24f75..f20ee9d 100644 --- a/bffhd/initiators/mod.rs +++ b/bffhd/initiators/mod.rs @@ -51,6 +51,10 @@ impl InitiatorCallbacks { self.resource.try_update(session, status).await } + pub fn set_status(&mut self, status: Status) { + self.resource.set_status(status) + } + pub fn open_session(&self, uid: &str) -> Option { self.sessions.open(&self.span, uid) } diff --git a/bffhd/initiators/process.rs b/bffhd/initiators/process.rs index 74de4f5..d714ec3 100644 --- a/bffhd/initiators/process.rs +++ b/bffhd/initiators/process.rs @@ -2,7 +2,7 @@ use super::Initiator; use super::InitiatorCallbacks; use crate::resources::state::State; use crate::utils::linebuffer::LineBuffer; -use async_process::{Child, ChildStdout, Command, Stdio}; +use async_process::{Child, ChildStderr, ChildStdout, Command, Stdio}; use futures_lite::{ready, AsyncRead}; use miette::{miette, IntoDiagnostic}; use serde::{Deserialize, Serialize}; @@ -11,11 +11,12 @@ use std::future::Future; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; +use crate::resources::modules::fabaccess::Status; #[derive(Debug, Serialize, Deserialize)] pub enum InputMessage { #[serde(rename = "state")] - SetState(State), + SetState(Status), } #[derive(Serialize, Deserialize)] @@ -26,6 +27,7 @@ pub struct Process { pub args: Vec, state: Option, buffer: LineBuffer, + err_buffer: LineBuffer, callbacks: InitiatorCallbacks, } @@ -42,6 +44,10 @@ impl Process { .stdout .take() .expect("Child just spawned with piped stdout has no stdout"), + child + .stderr + .take() + .expect("Child just spawned with piped stderr has no stderr"), child, )); Ok(()) @@ -49,13 +55,15 @@ impl Process { } struct ProcessState { - pub child: Child, pub stdout: ChildStdout, + pub stderr: ChildStderr, + pub stderr_closed: bool, + pub child: Child, } impl ProcessState { - pub fn new(stdout: ChildStdout, child: Child) -> Self { - Self { stdout, child } + pub fn new(stdout: ChildStdout, stderr: ChildStderr, child: Child) -> Self { + Self { stdout, stderr, stderr_closed: false, child } } fn try_process(&mut self, buffer: &[u8], callbacks: &mut InitiatorCallbacks) -> usize { @@ -77,11 +85,24 @@ impl ProcessState { } fn process_line(&mut self, line: &[u8], callbacks: &mut InitiatorCallbacks) { - match serde_json::from_slice::(line) { - Ok(state) => { - tracing::trace!(?state, "got new state for process initiator"); + if !line.is_empty() { + let res = std::str::from_utf8(line); + if let Err(error) = &res { + tracing::warn!(%error, "Initiator sent line with invalid UTF-8"); + return; + } + let string = res.unwrap().trim(); + // Ignore whitespace-only lines + if !string.is_empty() { + match serde_json::from_str::(res.unwrap()) { + Ok(state) => { + tracing::trace!(?state, "got new state for process initiator"); + let InputMessage::SetState(status) = state; + callbacks.set_status(status); + } + Err(error) => tracing::warn!(%error, "process initiator did not send a valid line"), + } } - Err(error) => tracing::warn!(%error, "process initiator did not send a valid line"), } } } @@ -93,6 +114,7 @@ impl Future for Process { if let Process { state: Some(state), buffer, + err_buffer, callbacks, .. } = self.get_mut() @@ -129,6 +151,44 @@ impl Future for Process { let processed = state.try_process(buffer, callbacks); buffer.consume(processed); + if !state.stderr_closed { + let stderr = &mut state.stderr; + loop { + let buf = err_buffer.get_mut_write(512); + match AsyncRead::poll_read(Pin::new(stderr), cx, buf) { + Poll::Pending => break, + Poll::Ready(Ok(read)) => { + err_buffer.advance_valid(read); + continue; + } + Poll::Ready(Err(error)) => { + tracing::warn!(%error, "reading from child stderr errored"); + state.stderr_closed = true; + break; + } + } + } + } + + { + let mut consumed = 0; + + while let Some(idx) = buffer[consumed..].iter().position(|b| *b == b'\n') { + if idx == 0 { + consumed += 1; + continue; + } + let line = &buffer[consumed..(consumed + idx)]; + match std::str::from_utf8(line) { + Ok(line) => tracing::debug!(line, "initiator STDERR"), + Err(error) => tracing::debug!(%error, + "invalid UTF-8 on initiator STDERR"), + } + consumed = idx; + } + err_buffer.consume(consumed); + } + return Poll::Pending; } } @@ -142,8 +202,8 @@ impl Future for Process { impl Initiator for Process { fn new(params: &HashMap, callbacks: InitiatorCallbacks) -> miette::Result - where - Self: Sized, + where + Self: Sized, { let cmd = params .get("cmd") @@ -158,6 +218,7 @@ impl Initiator for Process { args, state: None, buffer: LineBuffer::new(), + err_buffer: LineBuffer::new(), callbacks, }; this.spawn().into_diagnostic()?; diff --git a/bffhd/resources/mod.rs b/bffhd/resources/mod.rs index c222467..369efe3 100644 --- a/bffhd/resources/mod.rs +++ b/bffhd/resources/mod.rs @@ -166,7 +166,7 @@ impl Resource { self.inner.set_state(archived) } - fn set_status(&self, state: Status) { + pub fn set_status(&self, state: Status) { let old = self.inner.get_state(); let oldref: &Archived = old.as_ref(); let previous: &Archived> = &oldref.inner.previous;