diff --git a/api/schema b/api/schema index c9283eb..2406e77 160000 --- a/api/schema +++ b/api/schema @@ -1 +1 @@ -Subproject commit c9283ebd696ed6dd428a7c3d24820889f7ab4bf3 +Subproject commit 2406e77fb9fd2ce3d6e183742521a5d9c9cf77af diff --git a/api/src/schema/connection_capnp.rs b/api/src/schema/connection_capnp.rs index 3724891..a66946d 100644 --- a/api/src/schema/connection_capnp.rs +++ b/api/src/schema/connection_capnp.rs @@ -1209,16 +1209,25 @@ pub mod session { self.reader.total_size() } #[inline] - pub fn get_machine_system(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 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 { - 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 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 { - 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 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() } } @@ -1271,28 +1280,49 @@ pub mod session { self.builder.into_reader().total_size() } #[inline] - pub fn get_machine_system(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)} + 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::Client) { - self.builder.get_pointer_field(0).set_capability(value.client.hook); + 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 get_user_system(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)} + 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 set_user_system(&mut self, value: crate::schema::usersystem_capnp::user_system::Client) { - self.builder.get_pointer_field(1).set_capability(value.client.hook); + 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 get_permission_system(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)} + 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 set_permission_system(&mut self, value: crate::schema::permissionsystem_capnp::permission_system::Client) { - self.builder.get_pointer_field(2).set_capability(value.client.hook); + 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() } } @@ -1303,14 +1333,14 @@ pub mod session { } } impl Pipeline { - pub fn get_machine_system(&self) -> crate::schema::machinesystem_capnp::machine_system::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(0).as_cap()) + 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::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(1).as_cap()) + 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::Client { - ::capnp::capability::FromClientHook::new(self._typeless.get_pointer_field(2).as_cap()) + 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 { diff --git a/api/src/schema/machinesystem_capnp.rs b/api/src/schema/machinesystem_capnp.rs index 06fec62..459e648 100644 --- a/api/src/schema/machinesystem_capnp.rs +++ b/api/src/schema/machinesystem_capnp.rs @@ -3,94 +3,130 @@ // source: machinesystem.capnp - pub mod machine_system { - #![allow(unused_variables)] - pub type InfoParams<> = ::capnp::capability::Params; - pub type InfoResults<> = ::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 <'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; } - 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 { + #[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 Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } + impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { + fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { + Reader { reader, } } } - impl Client { - pub fn info_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) + + 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)?)) } } - pub trait Server<> { - fn info(&mut self, _: InfoParams<>, _: InfoResults<>) -> ::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 <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader } } - 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 <'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 <_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.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())) } - } + + 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 mod _private { + + 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; } @@ -717,245 +753,4 @@ pub mod machine_system { } } } - - pub mod 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 = 0xe531_7e00_9ffa_0a21; - } - } - - pub mod 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_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 = 0xd675_edfa_cb72_2594; - } - } } diff --git a/api/src/schema/permissionsystem_capnp.rs b/api/src/schema/permissionsystem_capnp.rs index 61efe65..48ecfca 100644 --- a/api/src/schema/permissionsystem_capnp.rs +++ b/api/src/schema/permissionsystem_capnp.rs @@ -3,101 +3,145 @@ // source: permissionsystem.capnp - pub mod permission_system { - #![allow(unused_variables)] - pub type InfoParams<> = ::capnp::capability::Params; - pub type InfoResults<> = ::capnp::capability::Results; - pub type ManageParams<> = ::capnp::capability::Params; - pub type ManageResults<> = ::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 <'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; } - 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 { + #[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 Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } + impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { + fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { + Reader { reader, } } } - impl Client { - pub fn info_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn manage_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) + + 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)?)) } } - pub trait Server<> { - fn info(&mut self, _: InfoParams<>, _: InfoResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn manage(&mut self, _: ManageParams<>, _: ManageResults<>) -> ::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 <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader } } - 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 <'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 <_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.info(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.manage(::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())) } - } + + 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 mod _private { + + 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; } @@ -525,486 +569,4 @@ pub mod permission_system { pub const TYPE_ID: u64 = 0xfd2c_0c85_d50a_57e6; } } - - pub mod 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 = 0xe10f_22a8_fd60_fc8a; - } - } - - pub mod 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_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::permissionsystem_capnp::permission_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::permissionsystem_capnp::permission_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 = 0xc85c_26ea_dff7_6440; - } - } - - pub mod manage_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 = 0x9a88_ca08_11fa_11f0; - } - } - - pub mod manage_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_manage(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_manage(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_manage(&mut self, value: crate::schema::permissionsystem_capnp::permission_system::manage::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_manage(&self) -> crate::schema::permissionsystem_capnp::permission_system::manage::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 = 0xca25_54ce_2a90_861e; - } - } } diff --git a/api/src/schema/usersystem_capnp.rs b/api/src/schema/usersystem_capnp.rs index 2cfdcfb..b92eaa4 100644 --- a/api/src/schema/usersystem_capnp.rs +++ b/api/src/schema/usersystem_capnp.rs @@ -3,101 +3,145 @@ // source: usersystem.capnp - pub mod user_system { - #![allow(unused_variables)] - pub type InfoParams<> = ::capnp::capability::Params; - pub type InfoResults<> = ::capnp::capability::Results; - pub type ManageParams<> = ::capnp::capability::Params; - pub type ManageResults<> = ::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 <'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; } - 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 { + #[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 Clone for Client { - fn clone(&self) -> Client { - Client { client: ::capnp::capability::Client::new(self.client.hook.add_ref()), } + impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { + fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Reader<'a,> { + Reader { reader, } } } - impl Client { - pub fn info_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 0, None) - } - pub fn manage_request(&self) -> ::capnp::capability::Request { - self.client.new_call(_private::TYPE_ID, 1, None) + + 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)?)) } } - pub trait Server<> { - fn info(&mut self, _: InfoParams<>, _: InfoResults<>) -> ::capnp::capability::Promise<(), ::capnp::Error> { ::capnp::capability::Promise::err(::capnp::Error::unimplemented("method not implemented".to_string())) } - fn manage(&mut self, _: ManageParams<>, _: ManageResults<>) -> ::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 <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader } } - 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 <'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 <_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.info(::capnp::private::capability::internal_get_typed_params(params), ::capnp::private::capability::internal_get_typed_results(results)), - 1 => server.manage(::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())) } - } + + 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 mod _private { + + 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); + } + } + + 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()) + } + } + mod _private { + use capnp::private::layout; + pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 2 }; pub const TYPE_ID: u64 = 0xdabf_c8b5_9d3c_0019; } @@ -105,7 +149,7 @@ pub mod user_system { pub mod info { #![allow(unused_variables)] pub type GetUserSelfParams<> = ::capnp::capability::Params; - pub type GetUserSelfResults<> = ::capnp::capability::Results; + pub type GetUserSelfResults<> = ::capnp::capability::Results; pub struct Client { pub client: ::capnp::capability::Client, @@ -149,7 +193,7 @@ pub mod user_system { } } impl Client { - pub fn get_user_self_request(&self) -> ::capnp::capability::Request { + pub fn get_user_self_request(&self) -> ::capnp::capability::Request { self.client.new_call(_private::TYPE_ID, 0, None) } } @@ -304,156 +348,6 @@ pub mod user_system { pub const TYPE_ID: u64 = 0x9f81_544f_0c89_4070; } } - - pub mod get_user_self_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(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_dummy(self) -> u8 { - 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_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_dummy(self) -> u8 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_dummy(&mut self, value: u8) { - self.builder.set_data_field::(0, value); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> 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: 1, pointers: 1 }; - pub const TYPE_ID: u64 = 0xb1bf_8c1a_3514_95f6; - } - } } @@ -462,8 +356,8 @@ pub mod user_system { 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 AddUserResults<> = ::capnp::capability::Results; + pub type RemoveUserParams<> = ::capnp::capability::Params; pub type RemoveUserResults<> = ::capnp::capability::Results; pub struct Client { @@ -511,10 +405,10 @@ pub mod user_system { 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 { + 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 { + pub fn remove_user_request(&self) -> ::capnp::capability::Request { self.client.new_call(_private::TYPE_ID, 2, None) } } @@ -966,294 +860,6 @@ pub mod user_system { } } - pub mod add_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() - } - #[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 = 0xb55b_3841_289d_1685; - } - } - - 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() - } - #[inline] - pub fn get_dummy(self) -> u8 { - 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_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_dummy(self) -> u8 { - self.builder.get_data_field::(0) - } - #[inline] - pub fn set_dummy(&mut self, value: u8) { - self.builder.set_data_field::(0, value); - } - } - - pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } - impl ::capnp::capability::FromTypelessPipeline for Pipeline { - fn new(typeless: ::capnp::any_pointer::Pipeline) -> 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: 1, pointers: 1 }; - pub const TYPE_ID: u64 = 0xf372_72f8_16fd_0b97; - } - } - pub mod remove_user_results { #[derive(Copy, Clone)] pub struct Owned(()); @@ -1367,486 +973,4 @@ pub mod user_system { } } } - - pub mod 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 = 0xbb8b_0f51_8ae5_00b7; - } - } - - pub mod 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_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::usersystem_capnp::user_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::usersystem_capnp::user_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 = 0xb303_06be_9d64_7746; - } - } - - pub mod manage_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 = 0xbf53_3c1e_c4b4_a8d3; - } - } - - pub mod manage_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_manage(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_manage(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_manage(&mut self, value: crate::schema::usersystem_capnp::user_system::manage::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_manage(&self) -> crate::schema::usersystem_capnp::user_system::manage::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 = 0xda93_03ae_556e_6504; - } - } } diff --git a/bffhd/capnp/machinesystem.rs b/bffhd/capnp/machinesystem.rs index a666fd5..52607fb 100644 --- a/bffhd/capnp/machinesystem.rs +++ b/bffhd/capnp/machinesystem.rs @@ -1,7 +1,7 @@ use crate::session::SessionHandle; use api::machinesystem_capnp::machine_system::{ - info, InfoParams, InfoResults, Server as MachineSystem, + info, }; use capnp::capability::Promise; use capnp_rpc::pry; @@ -23,14 +23,6 @@ impl Machines { } } -impl MachineSystem for Machines { - fn info(&mut self, _: InfoParams, mut result: InfoResults) -> Promise<(), ::capnp::Error> { - // TODO permission checking - result.get().set_info(capnp_rpc::new_client(self.clone())); - Promise::ok(()) - } -} - impl info::Server for Machines { fn get_machine_list( &mut self, diff --git a/bffhd/capnp/permissionsystem.rs b/bffhd/capnp/permissionsystem.rs index 5a65448..7d556c0 100644 --- a/bffhd/capnp/permissionsystem.rs +++ b/bffhd/capnp/permissionsystem.rs @@ -1,4 +1,4 @@ -use api::permissionsystem_capnp::permission_system::Server as PermissionSystem; +use api::permissionsystem_capnp::permission_system::info::Server as PermissionSystem; use crate::session::SessionHandle; diff --git a/bffhd/capnp/session.rs b/bffhd/capnp/session.rs index 7d2f1eb..a7c4541 100644 --- a/bffhd/capnp/session.rs +++ b/bffhd/capnp/session.rs @@ -1,4 +1,5 @@ use api::authenticationsystem_capnp::response::successful::Builder; +use crate::authorization::permissions::Permission; use crate::capnp::machinesystem::Machines; @@ -17,8 +18,24 @@ impl APISession { pub fn build(session: SessionHandle, builder: Builder) { let mut builder = builder.init_session(); - builder.set_machine_system(capnp_rpc::new_client(Machines::new(session.clone()))); - builder.set_user_system(capnp_rpc::new_client(Users::new(session.clone()))); - builder.set_permission_system(capnp_rpc::new_client(Permissions::new(session))); + + { + let mut b = builder.reborrow().init_machine_system(); + b.set_info(capnp_rpc::new_client(Machines::new(session.clone()))); + } + + { + let mut b = builder.reborrow().init_user_system(); + let u = Users::new(session.clone()); + if session.has_perm(Permission::new("bffh.users.manage")) { + b.set_manage(capnp_rpc::new_client(u.clone())); + } + b.set_info(capnp_rpc::new_client(u)); + } + + { + let mut b = builder.init_permission_system(); + b.set_info(capnp_rpc::new_client(Permissions::new(session))); + } } } \ No newline at end of file diff --git a/bffhd/capnp/user_system.rs b/bffhd/capnp/user_system.rs index 2cfb2d0..02df34c 100644 --- a/bffhd/capnp/user_system.rs +++ b/bffhd/capnp/user_system.rs @@ -2,7 +2,7 @@ use capnp::capability::Promise; use capnp_rpc::pry; use libc::user; use api::usersystem_capnp::user_system::{ - info, manage, Server as UserSystem, + info, manage, self as system, }; use crate::authorization::permissions::Permission; @@ -22,34 +22,13 @@ impl Users { } } -impl system::Server for Users { - fn info( - &mut self, - _: system::InfoParams, - mut result: system::InfoResults, - ) -> Promise<(), ::capnp::Error> { - result.get().set_info(capnp_rpc::new_client(self.clone())); - Promise::ok(()) - } - fn manage( - &mut self, - _: system::ManageParams, - mut result: system::ManageResults, - ) -> Promise<(), ::capnp::Error> { - if self.session.has_perm(Permission::new("bffh.users.manage")) { - result.get().set_manage(capnp_rpc::new_client(self.clone())); - } - Promise::ok(()) - } -} - impl info::Server for Users { fn get_user_self( &mut self, _: info::GetUserSelfParams, mut result: info::GetUserSelfResults, ) -> Promise<(), ::capnp::Error> { - let builder = result.get().init_user(); + let builder = result.get(); User::build(self.session.clone(), builder); Promise::ok(()) } diff --git a/bffhd/resources/modules/fabaccess.rs b/bffhd/resources/modules/fabaccess.rs index d30c4b9..735c522 100644 --- a/bffhd/resources/modules/fabaccess.rs +++ b/bffhd/resources/modules/fabaccess.rs @@ -6,7 +6,7 @@ use rkyv::{Archive, Archived, Deserialize, Infallible}; use std::str::FromStr; -use crate::oidvalue; +//use crate::oidvalue; use crate::resources::state::{State}; @@ -137,4 +137,4 @@ pub static OID_TYPE: Lazy = Lazy::new(|| ObjectIdentifier::from_str("1.3.6.1.4.1.48398.612.1.14").unwrap()); pub static OID_VALUE: Lazy = Lazy::new(|| ObjectIdentifier::from_str("1.3.6.1.4.1.48398.612.2.4").unwrap()); -oidvalue!(OID_TYPE, MachineState, ArchivedMachineState); +//oidvalue!(OID_TYPE, MachineState, ArchivedMachineState); diff --git a/bffhd/resources/state/value.rs b/bffhd/resources/state/value.rs index e2e3b4c..a1649a0 100644 --- a/bffhd/resources/state/value.rs +++ b/bffhd/resources/state/value.rs @@ -1,10 +1,7 @@ use std::{any::Any, fmt, hash::Hash, ptr, str::FromStr}; use ptr_meta::{DynMetadata, Pointee}; -use rkyv::{ - out_field, Archive, ArchivePointee, ArchiveUnsized, Archived, ArchivedMetadata, Deserialize, - DeserializeUnsized, Fallible, Serialize, SerializeUnsized, -}; +use rkyv::{out_field, Archive, ArchivePointee, ArchiveUnsized, Archived, ArchivedMetadata, Deserialize, DeserializeUnsized, Fallible, Serialize, SerializeUnsized, RelPtr}; use rkyv_dyn::{DynDeserializer, DynError, DynSerializer}; @@ -20,7 +17,396 @@ use std::alloc::Layout; use std::collections::HashMap; use std::fmt::Formatter; use std::mem::MaybeUninit; +use std::ops::Deref; +use std::sync::atomic::{AtomicUsize, Ordering}; +use rkyv::boxed::{ArchivedBox, BoxResolver}; +use rkyv::vec::ArchivedVec; +#[repr(transparent)] +struct MetaBox(Box); +impl From> for MetaBox { + fn from(b: Box) -> Self { + Self(b) + } +} + +#[repr(transparent)] +struct ArchivedMetaBox(RelPtr); +impl ArchivedMetaBox { + #[inline] + pub fn get(&self) -> &T { + unsafe { &*self.0.as_ptr() } + } +} + +impl AsRef for ArchivedMetaBox { + fn as_ref(&self) -> &T { + self.get() + } +} + +impl Deref for ArchivedMetaBox { + type Target = T; + + #[inline] + fn deref(&self) -> &Self::Target { + self.get() + } +} + +// State built as +struct NewStateBuilder { + inner: Vec>, +} + +// turns into +struct NewState { + inner: ArchivedVec> +} +impl NewState { + pub fn get_value(&self) -> Option<&T> { + /* + let target_oid = T::type_oid(); + + let values = self.inner.as_slice(); + for v in values { + let oid: &Archived = &v.metadata().type_oid; + if &target_oid.deref() == &oid.deref() { + let value = unsafe { &*v.as_ptr().cast() }; + return Some(value); + } + } + + None + */ + unimplemented!() + } +} + +// for usage. +// The important part is that both `SerializeValue` and `Value` tell us their OIDs. State will +// usually consist of only a very small number of parts, most of the time just one, so linear +// search will be the best. +// `dyn Value` is Archived using custom sauce Metadata that will store the OID of the state +// value, allowing us to cast the object (reasonably) safely. Thus we can also add a +// method `get_part(&self) -> Option<&T>` +// ArchivedBox is just a RelPtr into the object; so we'd use an `ArchivedValue`. +// We can freely modify the memory of the value, so caching vtables is possible & sensible? +// For dumping / loading values using serde we have to be able to serialize a `dyn Value` and to +// deserialize a `dyn SerializeValue`. +// This means, for every type T that's a value we must have: +// - impl SerializeValue for T, which probably implies impl Value for T? +// - impl Value for Archived +// - impl serde::Deserialize for T +// - impl serde::Serialize for Archived +// - impl rkyv::Archive, rkyv::Serialize for T + +#[ptr_meta::pointee] +/// Trait that values in the State Builder have to implement +/// +/// It requires serde::Deserialize and rkyv::SerializeUnsized to be implemented. +/// +/// it is assumed that there is a 1:1 mapping between a SerializeStateValue and a StateValue +/// implementation. Every `T` implementing the former has exactly *one* `Archived` implementing +/// the latter. +/// +/// The archived version of any implementation must implement [ArchivedStateValue](trait@ArchivedStateValue). +pub trait SerializeStateValue: SerializeDynOid {} + +#[ptr_meta::pointee] +/// Trait that (rkyv'ed) values in the State Object have to implement. +/// +/// It requires serde::Serialize to be implemented. +/// +/// It must be Sync since the State is sent as a signal to all connected actors by reference. +/// It must be Send since the DB thread and the signal thread may be different. +pub trait ArchivedStateValue: Send + Sync {} + +/// Serializing a trait object by storing an OID alongside +/// +/// This trait is a dependency for [SerializeStateValue](trait@SerializeStateValue). It is by +/// default implemented for all `T where T: for<'a> Serialize, T::Archived: TypeOid`. +pub trait SerializeDynOid { + /// Return the OID associated with the **Archived** type, i.e. `Archived`. + /// + /// This OID will be serialized alongside the trait object and is used to retrieve the + /// correct vtable when loading the state from DB. + fn archived_type_oid(&self) -> &'static ObjectIdentifier; + + /// Serialize this type into a [`DynSerializer`](trait@DynSerializer) + fn serialize_dynoid(&self, serializer: &mut dyn DynSerializer) -> Result; +} + +/// Types with an associated OID +/// +/// This trait is required by the default implementation of [SerializeDynOid](trait@SerializeDynOid), +/// providing the OID that is serialized alongside the state object to be able to correctly cast +/// it when accessing state from the DB. +pub trait TypeOid { + fn type_oid() -> &'static ObjectIdentifier; + fn type_name() -> &'static str; +} + +impl SerializeDynOid for T + where + T: for<'a> Serialize, + T::Archived: TypeOid, +{ + fn archived_type_oid(&self) -> &'static ObjectIdentifier { + Archived::::type_oid() + } + + fn serialize_dynoid(&self, serializer: &mut dyn DynSerializer) -> Result { + serializer.serialize_value(self) + } +} + +impl ArchivePointee for dyn ArchivedStateValue { + type ArchivedMetadata = ArchivedStateValueMetadata; + + fn pointer_metadata(archived: &Self::ArchivedMetadata) -> ::Metadata { + archived.pointer_metadata() + } +} + +impl ArchiveUnsized for dyn SerializeStateValue { + type Archived = dyn ArchivedStateValue; + type MetadataResolver = ::Resolver; + + unsafe fn resolve_metadata( + &self, + pos: usize, + resolver: Self::MetadataResolver, + out: *mut ArchivedMetadata, // => ArchivedStateValueMetadata + ) { + let (oid_pos, oid) = out_field!(out.type_oid); + let type_oid = self.archived_type_oid(); + type_oid.resolve(pos + oid_pos, resolver, oid); + + let (_vtable_cache_pos, vtable_cache) = out_field!(out.vtable_cache); + *vtable_cache = AtomicUsize::default(); + } +} + +impl SerializeUnsized for dyn SerializeStateValue { + fn serialize_unsized(&self, mut serializer: &mut S) -> Result { + self.serialize_dynoid(&mut serializer) + .map_err(|e| *e.downcast::().unwrap()) + } + + fn serialize_metadata(&self, serializer: &mut S) -> Result { + let oid = self.archived_type_oid(); + oid.serialize(serializer) + } +} + +#[derive(Debug)] +pub struct ArchivedStateValueMetadata { + pub type_oid: Archived, + vtable_cache: AtomicUsize, +} + +impl ArchivedStateValueMetadata { + // TODO: `usize as *const VTable` is not sane. + pub fn vtable(&self) -> usize { + let val = self.vtable_cache.load(Ordering::Relaxed); + if val != 0 { + return val; + } + + let val = IMPL_REGISTRY + .get(ImplId::from_type_oid(&self.type_oid)) + .expect(&format!("Unregistered type oid {:?}", self.type_oid)) + .vtable; + self.vtable_cache.store(val, Ordering::Relaxed); + return val; + } + + pub fn pointer_metadata(&self) -> DynMetadata { + unsafe { core::mem::transmute(self.vtable()) } + } +} + +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] +/// OID of an [ArchivedStateValue](trait@ArchivedStateValue) implementation. +/// +/// Used by the global type registry of all implementations to look up the vtables of state values +/// when accessing it from DB and when (de-)serializing it using serde. +struct ImplId<'a> { + type_oid: &'a [u8], +} + +impl<'a> ImplId<'a> { + fn from_type_oid(type_oid: &'a [u8]) -> Self { + Self { type_oid } + } +} + +impl ImplId<'static> { + fn new() -> Self { + Self { + type_oid: &T::type_oid(), + } + } +} + +#[derive(Copy, Clone, Debug)] +struct ImplData<'a> { + pub vtable: usize, + pub name: &'a str, + pub info: ImplDebugInfo, +} + +#[derive(Copy, Clone, Debug)] +pub struct ImplDebugInfo { + pub file: &'static str, + pub line: u32, + pub column: u32, +} + +#[derive(Debug)] +/// State Value Implementation Entry +/// +/// To register a state implementation you must call [inventory::collect](macro@inventory::collect) +/// macro for an Entry constructed for your type on top level. Your type will have to have +/// implementations of [TypeOid](trait@TypeOid) and [RegisteredImpl](trait@RegisteredImpl) +/// Alternatively you can use the +/// [statevalue_register](macro@crate::statevalue_register) macro with your OID as first and type +/// as second parameter like so: +/// +/// ```no_run +/// struct MyStruct; +/// statevalue_register!(ObjectIdentifier::from_str("1.3.6.1.4.1.48398.612.1.14").unwrap(), MyStruct) +/// ``` +pub struct ImplEntry<'a> { + id: ImplId<'a>, + data: ImplData<'a>, +} +inventory::collect!(ImplEntry<'static>); + +impl ImplEntry<'_> { + pub fn new() -> Self { + Self { + id: ImplId::new::(), + data: ImplData { + vtable: ::vtable(), + name: ::type_name(), + info: ::debug_info(), + }, + } + } +} + +#[derive(Debug)] +struct ImplRegistry { + oid_to_data: HashMap, ImplData<'static>>, +} + +impl ImplRegistry { + fn new() -> Self { + Self { + oid_to_data: HashMap::new(), + } + } + + fn add_entry(&mut self, entry: &'static ImplEntry) { + let old_val = self.oid_to_data.insert(entry.id, entry.data); + + if let Some(old) = old_val { + eprintln!("Value impl oid conflict for {:?}", entry.id.type_oid); + eprintln!( + "Existing impl registered at {}:{}:{}", + old.info.file, old.info.line, old.info.column + ); + eprintln!( + "New impl registered at {}:{}:{}", + entry.data.info.file, entry.data.info.line, entry.data.info.column + ); + } + } + + fn get(&self, type_oid: ImplId) -> Option { + self.oid_to_data.get(&type_oid).map(|d| *d) + } +} +lazy_static::lazy_static! { + // FIXME: Dynamic modules *will* break this. + static ref IMPL_REGISTRY: ImplRegistry = { + let mut reg = ImplRegistry::new(); + for entry in inventory::iter:: { + reg.add_entry(entry); + } + reg + }; +} + +pub unsafe trait RegisteredImpl { + fn vtable() -> usize; + fn debug_info() -> ImplDebugInfo; +} + +#[doc(hidden)] +#[macro_use] +pub mod macros { + #[macro_export] + macro_rules! debug_info { + () => { + $crate::resources::state::value::ImplDebugInfo { + file: ::core::file!(), + line: ::core::line!(), + column: ::core::column!(), + } + }; + } + + #[macro_export] + macro_rules! statevalue_typeoid { + ( $x:ident, $y:ty, $z:ty ) => { + impl $crate::resources::state::value::TypeOid for $z { + fn type_oid() -> &'static $crate::utils::oid::ObjectIdentifier { + &$x + } + + fn type_name() -> &'static str { + stringify!($y) + } + } + } + } + + #[macro_export] + macro_rules! statevalue_registeredimpl { + ( $z:ty ) => { + unsafe impl $crate::resources::state::value::RegisteredImpl for $z { + fn vtable() -> usize { + unsafe { + ::core::mem::transmute(ptr_meta::metadata( + ::core::ptr::null::<$z>() as *const dyn $crate::resources::state::value::ArchivedStateValue + )) + } + } + fn debug_info() -> $crate::resources::state::value::ImplDebugInfo { + $crate::debug_info!() + } + } + } + } + + #[macro_export] + macro_rules! statevalue_register { + ( $x:ident, $y:ty ) => { + $crate::oidvalue! {$x, $y, $y} + }; + ( $x:ident, $y:ty, $z:ty ) => { + $crate::statevalue_typeoid! { $x, $y, $z } + $crate::statevalue_registeredimpl! { $z } + + ::inventory::submit! {$crate::resources::state::value::ImplEntry::new::<$z>()} + }; + } +} + +/* /// Adding a custom type to BFFH state management: /// /// 1. Implement `serde`'s [`Serialize`](serde::Serialize) and [`Deserialize`](serde::Deserialize) @@ -204,7 +590,6 @@ impl<'de> serde::de::DeserializeSeed<'de> for InitIntoSelf { pub trait TypeOid { fn type_oid() -> &'static ObjectIdentifier; fn type_name() -> &'static str; - fn type_desc() -> &'static str; } impl SerializeUnsized for dyn SerializeValue { @@ -219,12 +604,6 @@ impl SerializeUnsized for dyn Serializ } } -/// Serialize dynamic types by storing an OID alongside -pub trait SerializeDynOid { - fn serialize_dynoid(&self, serializer: &mut dyn DynSerializer) -> Result; - fn archived_type_oid(&self) -> &'static ObjectIdentifier; -} - impl SerializeDynOid for T where T: for<'a> Serialize, @@ -254,16 +633,12 @@ pub trait DeserializeDynOid { #[ptr_meta::pointee] pub trait SerializeValue: Value + SerializeDynOid { - fn dyn_clone(&self) -> Box; } impl SerializeValue for T where T::Archived: RegisteredImpl, { - fn dyn_clone(&self) -> Box { - Box::new(self.clone()) - } } impl PartialEq for dyn SerializeValue { @@ -323,230 +698,9 @@ impl ArchiveUnsized for dyn SerializeValue { } } -#[derive(Debug)] -pub struct ArchivedValueMetadata { - pub type_oid: Archived, -} -impl ArchivedValueMetadata { - pub unsafe fn emplace(type_oid: Archived, out: *mut Self) { - let p = ptr::addr_of_mut!((*out).type_oid); - ptr::write(p, type_oid); - } - pub fn vtable(&self) -> usize { - IMPL_REGISTRY - .get(ImplId::from_type_oid(&self.type_oid)) - .expect(&format!( - "Unregistered \ - type \ - oid \ - {:?}", - self.type_oid - )) - .vtable - } - pub fn pointer_metadata(&self) -> DynMetadata { - unsafe { core::mem::transmute(self.vtable()) } - } -} - -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] -pub struct ImplId<'a> { - type_oid: &'a [u8], -} - -impl<'a> ImplId<'a> { - pub fn from_type_oid(type_oid: &'a [u8]) -> Self { - Self { type_oid } - } -} - -impl ImplId<'static> { - fn new() -> Self { - Self { - type_oid: &T::type_oid(), - } - } -} - -#[derive(Copy, Clone, Debug)] -struct ImplData<'a> { - pub vtable: usize, - pub name: &'a str, - pub desc: &'a str, - pub info: ImplDebugInfo, -} - -#[derive(Copy, Clone, Debug)] -#[doc(hidden)] -pub struct ImplDebugInfo { - pub file: &'static str, - pub line: u32, - pub column: u32, -} - -impl ImplData<'_> { - pub unsafe fn pointer_metadata(&self) -> DynMetadata { - core::mem::transmute(self.vtable) - } -} - -#[derive(Debug)] -pub struct ImplEntry<'a> { - id: ImplId<'a>, - data: ImplData<'a>, -} -inventory::collect!(ImplEntry<'static>); - -impl ImplEntry<'_> { - #[doc(hidden)] - pub fn new() -> Self { - Self { - id: ImplId::new::(), - data: ImplData { - vtable: ::vtable(), - name: ::type_name(), - desc: ::type_desc(), - info: ::debug_info(), - }, - } - } -} - -#[derive(Debug)] -struct ImplRegistry { - oid_to_data: HashMap, ImplData<'static>>, -} - -impl ImplRegistry { - fn new() -> Self { - Self { - oid_to_data: HashMap::new(), - } - } - - fn add_entry(&mut self, entry: &'static ImplEntry) { - let old_val = self.oid_to_data.insert(entry.id, entry.data); - - if let Some(old) = old_val { - eprintln!("Value impl oid conflict for {:?}", entry.id.type_oid); - eprintln!( - "Existing impl registered at {}:{}:{}", - old.info.file, old.info.line, old.info.column - ); - eprintln!( - "New impl registered at {}:{}:{}", - entry.data.info.file, entry.data.info.line, entry.data.info.column - ); - } - assert!(old_val.is_none()); - } - - fn get(&self, type_oid: ImplId) -> Option { - self.oid_to_data.get(&type_oid).map(|d| *d) - } -} - -lazy_static::lazy_static! { - // FIXME: Dynamic modules *will* break this. - static ref IMPL_REGISTRY: ImplRegistry = { - let mut reg = ImplRegistry::new(); - for entry in inventory::iter:: { - reg.add_entry(entry); - } - reg - }; -} - -pub unsafe trait RegisteredImpl { - fn vtable() -> usize; - fn debug_info() -> ImplDebugInfo; -} - -#[macro_use] -pub mod macros { - #[macro_export] - macro_rules! debug_info { - () => { - $crate::resources::state::value::ImplDebugInfo { - file: ::core::file!(), - line: ::core::line!(), - column: ::core::column!(), - } - }; - } - #[macro_export] - macro_rules! oiddeser { - ( $y:ty, $z:ty ) => { - impl $crate::resources::state::value::DeserializeDynOid for $y - where - $y: for<'a> ::rkyv::Deserialize<$z, (dyn ::rkyv_dyn::DynDeserializer + 'a)>, - { - unsafe fn deserialize_dynoid( - &self, - deserializer: &mut dyn ::rkyv_dyn::DynDeserializer, - alloc: &mut dyn FnMut(::core::alloc::Layout) -> *mut u8, - ) -> Result<*mut (), ::rkyv_dyn::DynError> { - let ptr = alloc(::core::alloc::Layout::new::<$z>()).cast::<$z>(); - ptr.write(self.deserialize(deserializer)?); - Ok(ptr as *mut ()) - } - - fn deserialize_dynoid_metadata( - &self, - _: &mut dyn ::rkyv_dyn::DynDeserializer, - ) -> ::std::result::Result<::Metadata, ::rkyv_dyn::DynError> { - unsafe { - Ok(core::mem::transmute(ptr_meta::metadata( - ::core::ptr::null::<$z>() as *const dyn $crate::resources::state::value::SerializeValue, - ))) - } - } - } - }; - } - #[macro_export] - macro_rules! oidvalue { - ( $x:ident, $y:ty ) => { - $crate::oidvalue! {$x, $y, $y} - }; - ( $x:ident, $y:ty, $z:ty ) => { - $crate::oiddeser! {$z, $y} - - impl $crate::resources::state::value::TypeOid for $z { - fn type_oid() -> &'static $crate::utils::oid::ObjectIdentifier { - &$x - } - - fn type_name() -> &'static str { - stringify!($y) - } - - fn type_desc() -> &'static str { - "builtin" - } - } - unsafe impl $crate::resources::state::value::RegisteredImpl for $z { - fn vtable() -> usize { - unsafe { - ::core::mem::transmute(ptr_meta::metadata( - ::core::ptr::null::<$z>() as *const dyn $crate::resources::state::value::DeserializeValue - )) - } - } - fn debug_info() -> $crate::resources::state::value::ImplDebugInfo { - $crate::debug_info!() - } - } - - ::inventory::submit! {$crate::resources::state::value::ImplEntry::new::<$z>()} - }; - } -} lazy_static::lazy_static! { @@ -646,3 +800,5 @@ mod tests { } } } + + */ \ No newline at end of file diff --git a/examples/bffh.dhall b/examples/bffh.dhall index b0a6a31..d8cab77 100644 --- a/examples/bffh.dhall +++ b/examples/bffh.dhall @@ -23,7 +23,7 @@ -- If bffh can not bind a port for the specified combination if will log an error but *continue with the remaining ports* { address = "127.0.0.1", port = 59661 }, { address = "::1", port = 59661 }, - { address = "192.168.0.114", port = 59661 } + { address = "steak.fritz.box", port = 59661 } ], -- Configure TLS. BFFH requires a PEM-encoded certificate and the associated key as two separate files