impl relevant proto changes

This commit is contained in:
Nadja Reitzenstein 2022-04-27 20:27:14 +02:00
parent 1070d9e6eb
commit b6c9b61511
2 changed files with 141 additions and 3 deletions

View File

@ -357,7 +357,7 @@ pub mod user_system {
pub type GetUserListResults<> = ::capnp::capability::Results<crate::schema::usersystem_capnp::user_system::manage::get_user_list_results::Owned>;
pub type AddUserParams<> = ::capnp::capability::Params<crate::schema::usersystem_capnp::user_system::manage::add_user_params::Owned>;
pub type AddUserResults<> = ::capnp::capability::Results<crate::schema::user_capnp::user::Owned>;
pub type RemoveUserParams<> = ::capnp::capability::Params<crate::schema::user_capnp::user::Owned>;
pub type RemoveUserParams<> = ::capnp::capability::Params<crate::schema::usersystem_capnp::user_system::manage::remove_user_params::Owned>;
pub type RemoveUserResults<> = ::capnp::capability::Results<crate::schema::usersystem_capnp::user_system::manage::remove_user_results::Owned>;
pub struct Client {
@ -408,7 +408,7 @@ pub mod user_system {
pub fn add_user_request(&self) -> ::capnp::capability::Request<crate::schema::usersystem_capnp::user_system::manage::add_user_params::Owned,crate::schema::user_capnp::user::Owned> {
self.client.new_call(_private::TYPE_ID, 1, None)
}
pub fn remove_user_request(&self) -> ::capnp::capability::Request<crate::schema::user_capnp::user::Owned,crate::schema::usersystem_capnp::user_system::manage::remove_user_results::Owned> {
pub fn remove_user_request(&self) -> ::capnp::capability::Request<crate::schema::usersystem_capnp::user_system::manage::remove_user_params::Owned,crate::schema::usersystem_capnp::user_system::manage::remove_user_results::Owned> {
self.client.new_call(_private::TYPE_ID, 2, None)
}
}
@ -860,6 +860,144 @@ pub mod user_system {
}
}
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<Reader<'a,>> {
::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<crate::schema::user_capnp::user::Reader<'a>> {
::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<Builder<'a,>> {
::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<crate::schema::user_capnp::user::Builder<'a>> {
::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None)
}
#[inline]
pub fn set_user(&mut self, value: crate::schema::user_capnp::user::Reader<'_>) -> ::capnp::Result<()> {
::capnp::traits::SetPointerBuilder::set_pointer_builder(self.builder.get_pointer_field(0), value, false)
}
#[inline]
pub fn init_user(self, ) -> crate::schema::user_capnp::user::Builder<'a> {
::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0)
}
pub fn has_user(&self) -> bool {
!self.builder.get_pointer_field(0).is_null()
}
}
pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline }
impl ::capnp::capability::FromTypelessPipeline for Pipeline {
fn new(typeless: ::capnp::any_pointer::Pipeline) -> Pipeline {
Pipeline { _typeless: typeless, }
}
}
impl Pipeline {
pub fn get_user(&self) -> crate::schema::user_capnp::user::Pipeline {
::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0))
}
}
mod _private {
use capnp::private::layout;
pub const STRUCT_SIZE: layout::StructSize = layout::StructSize { data: 0, pointers: 1 };
pub const TYPE_ID: u64 = 0xf372_72f8_16fd_0b97;
}
}
pub mod remove_user_results {
#[derive(Copy, Clone)]
pub struct Owned(());

View File

@ -82,7 +82,7 @@ impl manage::Server for Users {
params: manage::RemoveUserParams,
_: manage::RemoveUserResults,
) -> Promise<(), ::capnp::Error> {
let who: &str = pry!(pry!(params.get()).get_username());
let who: &str = pry!(pry!(pry!(params.get()).get_user()).get_username());
if let Err(e) = self.session.users.del_user(who) {
tracing::warn!("Failed to delete user: {:?}", e);