From 6510335a63e7f84ff725b00e2efe4abdbf92ce1e Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sat, 19 Nov 2022 06:49:18 +0000 Subject: [PATCH] remove 'FromStructReader' trait --- capnp-rpc/src/rpc_capnp.rs | 284 +++++++-------- capnp-rpc/src/rpc_twoparty_capnp.rs | 84 ++--- capnp/src/capability.rs | 4 +- capnp/src/private/read_limiter.rs | 6 +- capnp/src/struct_list.rs | 7 +- capnp/src/traits.rs | 6 +- capnpc/src/codegen.rs | 14 +- capnpc/src/schema_capnp.rs | 522 ++++++++++++++-------------- 8 files changed, 461 insertions(+), 466 deletions(-) diff --git a/capnp-rpc/src/rpc_capnp.rs b/capnp-rpc/src/rpc_capnp.rs index 65c730954..fdacce950 100644 --- a/capnp-rpc/src/rpc_capnp.rs +++ b/capnp-rpc/src/rpc_capnp.rs @@ -18,15 +18,15 @@ pub mod message { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -232,13 +232,13 @@ pub mod message { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -570,15 +570,15 @@ pub mod bootstrap { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -650,13 +650,13 @@ pub mod bootstrap { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -715,15 +715,15 @@ pub mod call { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -777,7 +777,7 @@ pub mod call { } #[inline] pub fn get_send_results_to(self) -> crate::rpc_capnp::call::send_results_to::Reader<'a> { - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() } #[inline] pub fn get_allow_third_party_tail_call(self) -> bool { @@ -819,13 +819,13 @@ pub mod call { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -943,15 +943,15 @@ pub mod call { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1037,13 +1037,13 @@ pub mod call { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1128,15 +1128,15 @@ pub mod return_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1255,13 +1255,13 @@ pub mod return_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1412,15 +1412,15 @@ pub mod finish { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1488,13 +1488,13 @@ pub mod finish { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1546,15 +1546,15 @@ pub mod resolve { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1644,13 +1644,13 @@ pub mod resolve { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1744,15 +1744,15 @@ pub mod release { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1820,13 +1820,13 @@ pub mod release { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1876,15 +1876,15 @@ pub mod disembargo { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1918,7 +1918,7 @@ pub mod disembargo { } #[inline] pub fn get_context(self) -> crate::rpc_capnp::disembargo::context::Reader<'a> { - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() } } @@ -1956,13 +1956,13 @@ pub mod disembargo { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2029,15 +2029,15 @@ pub mod disembargo { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2123,13 +2123,13 @@ pub mod disembargo { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2217,15 +2217,15 @@ pub mod provide { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2305,13 +2305,13 @@ pub mod provide { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2389,15 +2389,15 @@ pub mod accept { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2473,13 +2473,13 @@ pub mod accept { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2546,15 +2546,15 @@ pub mod join { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2634,13 +2634,13 @@ pub mod join { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2720,15 +2720,15 @@ pub mod message_target { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2809,13 +2809,13 @@ pub mod message_target { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2891,15 +2891,15 @@ pub mod payload { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2975,13 +2975,13 @@ pub mod payload { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3050,15 +3050,15 @@ pub mod cap_descriptor { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3168,13 +3168,13 @@ pub mod cap_descriptor { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3311,15 +3311,15 @@ pub mod promised_answer { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3391,13 +3391,13 @@ pub mod promised_answer { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3456,15 +3456,15 @@ pub mod promised_answer { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3540,13 +3540,13 @@ pub mod promised_answer { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3612,15 +3612,15 @@ pub mod third_party_cap_descriptor { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3692,13 +3692,13 @@ pub mod third_party_cap_descriptor { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3757,15 +3757,15 @@ pub mod exception { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3853,13 +3853,13 @@ pub mod exception { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { diff --git a/capnp-rpc/src/rpc_twoparty_capnp.rs b/capnp-rpc/src/rpc_twoparty_capnp.rs index 7d3f76b5d..b3aa04255 100644 --- a/capnp-rpc/src/rpc_twoparty_capnp.rs +++ b/capnp-rpc/src/rpc_twoparty_capnp.rs @@ -40,15 +40,15 @@ pub mod vat_id { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -112,13 +112,13 @@ pub mod vat_id { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -160,15 +160,15 @@ pub mod provision_id { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -232,13 +232,13 @@ pub mod provision_id { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -280,15 +280,15 @@ pub mod recipient_id { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -348,13 +348,13 @@ pub mod recipient_id { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -388,15 +388,15 @@ pub mod third_party_cap_id { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -456,13 +456,13 @@ pub mod third_party_cap_id { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -496,15 +496,15 @@ pub mod join_key_part { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -576,13 +576,13 @@ pub mod join_key_part { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -640,15 +640,15 @@ pub mod join_result { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -724,13 +724,13 @@ pub mod join_result { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { diff --git a/capnp/src/capability.rs b/capnp/src/capability.rs index b327cfff3..9d72aafe5 100644 --- a/capnp/src/capability.rs +++ b/capnp/src/capability.rs @@ -93,7 +93,7 @@ impl Future for Promise { #[cfg(feature = "rpc_try")] impl std::ops::Try for Promise { - type Output = Promise; + type Output = Self; type Residual = Result; fn from_output(output: Self::Output) -> Self { @@ -110,7 +110,7 @@ impl std::ops::FromResidual for Promise { fn from_residual(residual: ::Residual) -> Self { match residual { Ok(_) => unimplemented!(), - Err(e) => Promise::err(e), + Err(e) => Self::err(e), } } } diff --git a/capnp/src/private/read_limiter.rs b/capnp/src/private/read_limiter.rs index 06089e064..40c6b2880 100644 --- a/capnp/src/private/read_limiter.rs +++ b/capnp/src/private/read_limiter.rs @@ -34,13 +34,13 @@ mod sync { } impl ReadLimiter { - pub fn new(limit: Option) -> ReadLimiter { + pub fn new(limit: Option) -> Self { match limit { - Some(value) => ReadLimiter { + Some(value) => Self { limit: AtomicUsize::new(value), error_on_limit_exceeded: true, }, - None => ReadLimiter { + None => Self { limit: AtomicUsize::new(usize::MAX), error_on_limit_exceeded: false, }, diff --git a/capnp/src/struct_list.rs b/capnp/src/struct_list.rs index f421f98c2..33054185d 100644 --- a/capnp/src/struct_list.rs +++ b/capnp/src/struct_list.rs @@ -27,8 +27,7 @@ use crate::private::layout::{ InlineComposite, ListBuilder, ListReader, PointerBuilder, PointerReader, }; use crate::traits::{ - FromPointerBuilder, FromPointerReader, FromStructBuilder, FromStructReader, HasStructSize, - IndexMove, ListIter, + FromPointerBuilder, FromPointerReader, FromStructBuilder, HasStructSize, IndexMove, ListIter, }; use crate::Result; @@ -130,14 +129,14 @@ where /// equal to `len()`. pub fn get(self, index: u32) -> T::Reader<'a> { assert!(index < self.len()); - FromStructReader::new(self.reader.get_struct_element(index)) + self.reader.get_struct_element(index).into() } /// Gets the element at position `index`. Returns `None` if `index` /// is greater than or equal to `len()`. pub fn try_get(self, index: u32) -> Option> { if index < self.len() { - Some(FromStructReader::new(self.reader.get_struct_element(index))) + Some(self.reader.get_struct_element(index).into()) } else { None } diff --git a/capnp/src/traits.rs b/capnp/src/traits.rs index 7ce0ef33e..30a0b2f87 100644 --- a/capnp/src/traits.rs +++ b/capnp/src/traits.rs @@ -26,10 +26,6 @@ use crate::Result; use core::marker::PhantomData; -pub trait FromStructReader<'a> { - fn new(reader: StructReader<'a>) -> Self; -} - pub trait HasStructSize { const STRUCT_SIZE: StructSize; } @@ -69,7 +65,7 @@ pub trait Owned { } pub trait OwnedStruct { - type Reader<'a>: FromStructReader<'a> + SetPointerBuilder + IntoInternalStructReader<'a>; + type Reader<'a>: From> + SetPointerBuilder + IntoInternalStructReader<'a>; type Builder<'a>: FromStructBuilder<'a> + HasStructSize; } diff --git a/capnpc/src/codegen.rs b/capnpc/src/codegen.rs index 22c23b0eb..5cdc916a1 100644 --- a/capnpc/src/codegen.rs +++ b/capnpc/src/codegen.rs @@ -601,7 +601,7 @@ pub fn getter_text( } let getter_code = if is_reader { - Line("::capnp::traits::FromStructReader::new(self.reader)".to_string()) + Line("self.reader.into()".to_string()) } else { Line("::capnp::traits::FromStructBuilder::new(self.builder)".to_string()) }; @@ -1773,12 +1773,12 @@ fn generate_node( params.params, params.where_clause)), Indent(Box::new(Branch(vec!(Line("const TYPE_ID: u64 = _private::TYPE_ID;".to_string()))))), Line("}".to_string()))), - Line(format!("impl <'a,{0}> ::capnp::traits::FromStructReader<'a> for Reader<'a,{0}> {1} {{", + Line(format!("impl <'a,{0}> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,{0}> {1} {{", params.params, params.where_clause)), Indent( Box::new(Branch(vec!( - Line("fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self {".to_string()), - Indent(Box::new(Line(format!("Self {{ reader, {} }}", params.phantom_data_value)))), + Line("fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self {".to_string()), + Indent(Box::new(Line(format!("Reader {{ reader, {} }}", params.phantom_data_value)))), Line("}".to_string()))))), Line("}".to_string()), BlankLine, @@ -1787,7 +1787,7 @@ fn generate_node( Indent( Box::new(Branch(vec!( Line("fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result {".to_string()), - Indent(Box::new(Line("::core::result::Result::Ok(::capnp::traits::FromStructReader::new(reader.get_struct(default)?))".to_string()))), + Indent(Box::new(Line("::core::result::Result::Ok(reader.get_struct(default)?.into())".to_string()))), Line("}".to_string()))))), Line("}".to_string()), BlankLine, @@ -1873,13 +1873,13 @@ fn generate_node( Indent( Box::new(Branch(vec![ Line(format!("pub fn into_reader(self) -> Reader<'a,{}> {{", params.params)), - Indent(Box::new(Line("::capnp::traits::FromStructReader::new(self.builder.into_reader())".to_string()))), + Indent(Box::new(Line("self.builder.into_reader().into()".to_string()))), Line("}".to_string()), Line(format!("pub fn reborrow(&mut self) -> Builder<'_,{}> {{", params.params)), Indent(Box::new(Line("Builder { .. *self }".to_string()))), Line("}".to_string()), Line(format!("pub fn reborrow_as_reader(&self) -> Reader<'_,{}> {{", params.params)), - Indent(Box::new(Line("::capnp::traits::FromStructReader::new(self.builder.into_reader())".to_string()))), + Indent(Box::new(Line("self.builder.into_reader().into()".to_string()))), Line("}".to_string()), BlankLine, diff --git a/capnpc/src/schema_capnp.rs b/capnpc/src/schema_capnp.rs index 666757636..a29165843 100644 --- a/capnpc/src/schema_capnp.rs +++ b/capnpc/src/schema_capnp.rs @@ -18,15 +18,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -108,27 +108,27 @@ pub mod node { } 1 => { ::core::result::Result::Ok(Struct( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 2 => { ::core::result::Result::Ok(Enum( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 3 => { ::core::result::Result::Ok(Interface( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 4 => { ::core::result::Result::Ok(Const( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 5 => { ::core::result::Result::Ok(Annotation( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } x => ::core::result::Result::Err(::capnp::NotInSchema(x)) @@ -170,13 +170,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -405,15 +405,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -481,13 +481,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -537,15 +537,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -617,13 +617,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -681,15 +681,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -769,13 +769,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -848,15 +848,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -924,13 +924,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -981,15 +981,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1081,13 +1081,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1185,15 +1185,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1261,13 +1261,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1317,15 +1317,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1401,13 +1401,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1473,15 +1473,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1557,13 +1557,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1635,15 +1635,15 @@ pub mod node { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1759,13 +1759,13 @@ pub mod node { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -1917,15 +1917,15 @@ pub mod field { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -1975,19 +1975,19 @@ pub mod field { } #[inline] pub fn get_ordinal(self) -> crate::schema_capnp::field::ordinal::Reader<'a> { - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() } #[inline] pub fn which(self) -> ::core::result::Result, ::capnp::NotInSchema> { match self.reader.get_data_field::(4) { 0 => { ::core::result::Result::Ok(Slot( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 1 => { ::core::result::Result::Ok(Group( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } x => ::core::result::Result::Err(::capnp::NotInSchema(x)) @@ -2029,13 +2029,13 @@ pub mod field { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2167,15 +2167,15 @@ pub mod field { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2259,13 +2259,13 @@ pub mod field { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2353,15 +2353,15 @@ pub mod field { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2425,13 +2425,13 @@ pub mod field { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2475,15 +2475,15 @@ pub mod field { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2559,13 +2559,13 @@ pub mod field { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2631,15 +2631,15 @@ pub mod enumerant { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2719,13 +2719,13 @@ pub mod enumerant { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2799,15 +2799,15 @@ pub mod superclass { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -2879,13 +2879,13 @@ pub mod superclass { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -2946,15 +2946,15 @@ pub mod method { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3066,13 +3066,13 @@ pub mod method { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3218,15 +3218,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3325,27 +3325,27 @@ pub mod type_ { } 14 => { ::core::result::Result::Ok(List( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 15 => { ::core::result::Result::Ok(Enum( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 16 => { ::core::result::Result::Ok(Struct( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 17 => { ::core::result::Result::Ok(Interface( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 18 => { ::core::result::Result::Ok(AnyPointer( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } x => ::core::result::Result::Err(::capnp::NotInSchema(x)) @@ -3387,13 +3387,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3643,15 +3643,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3719,13 +3719,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3778,15 +3778,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -3858,13 +3858,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -3925,15 +3925,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4005,13 +4005,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4072,15 +4072,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4152,13 +4152,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4221,15 +4221,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4258,17 +4258,17 @@ pub mod type_ { match self.reader.get_data_field::(4) { 0 => { ::core::result::Result::Ok(Unconstrained( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 1 => { ::core::result::Result::Ok(Parameter( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } 2 => { ::core::result::Result::Ok(ImplicitMethodParameter( - ::capnp::traits::FromStructReader::new(self.reader) + self.reader.into() )) } x => ::core::result::Result::Err(::capnp::NotInSchema(x)) @@ -4310,13 +4310,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4398,15 +4398,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4492,13 +4492,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4582,15 +4582,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4658,13 +4658,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4714,15 +4714,15 @@ pub mod type_ { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4786,13 +4786,13 @@ pub mod type_ { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4836,15 +4836,15 @@ pub mod brand { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -4912,13 +4912,13 @@ pub mod brand { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -4969,15 +4969,15 @@ pub mod brand { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -5062,13 +5062,13 @@ pub mod brand { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -5153,15 +5153,15 @@ pub mod brand { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -5242,13 +5242,13 @@ pub mod brand { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -5326,15 +5326,15 @@ pub mod value { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -5520,13 +5520,13 @@ pub mod value { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -5818,15 +5818,15 @@ pub mod annotation { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -5906,13 +5906,13 @@ pub mod annotation { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -6028,15 +6028,15 @@ pub mod capnp_version { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -6108,13 +6108,13 @@ pub mod capnp_version { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -6172,15 +6172,15 @@ pub mod code_generator_request { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl<'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -6272,13 +6272,13 @@ pub mod code_generator_request { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -6378,15 +6378,15 @@ pub mod code_generator_request { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -6466,13 +6466,13 @@ pub mod code_generator_request { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { @@ -6545,15 +6545,15 @@ pub mod code_generator_request { impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,> { const TYPE_ID: u64 = _private::TYPE_ID; } - impl <'a,> ::capnp::traits::FromStructReader<'a> for Reader<'a,> { - fn new(reader: ::capnp::private::layout::StructReader<'a>) -> Self { - Self { reader, } + impl <'a,> From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { + fn from(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)?)) + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [capnp::Word]>) -> ::capnp::Result> { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) } } @@ -6625,13 +6625,13 @@ pub mod code_generator_request { impl <'a,> Builder<'a,> { pub fn into_reader(self) -> Reader<'a,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn reborrow(&mut self) -> Builder<'_,> { Builder { .. *self } } pub fn reborrow_as_reader(&self) -> Reader<'_,> { - ::capnp::traits::FromStructReader::new(self.builder.into_reader()) + self.builder.into_reader().into() } pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> {