#[derive(Clone, Debug, Default)]
pub struct KeyLazyView<'a> {
pub bytes: &'a [u8],
}
impl<'a> KeyLazyView<'a> {
#[doc(hidden)]
pub fn _decode_lazy_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_lazy(buf, ctx)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.bytes = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::LazyMessageView<'a> for KeyLazyView<'a> {
type Owned = super::super::Key;
fn decode_lazy(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
Self::_decode_lazy_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_lazy_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_lazy_ctx(buf, ctx)
}
fn merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
self._merge_lazy(buf, ctx)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Key, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
#[allow(unused_imports)]
use ::buffa::MessageView as _;
let __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes> = ::core::option::Option::None;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Key {
bytes: (self.bytes).to_vec(),
..::core::default::Default::default()
})
}
}
impl<'a> KeyLazyView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
pub fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
let mut size = 0u64;
if !self.bytes.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.bytes) as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
pub fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
if !self.bytes.is_empty() {
::buffa::types::put_shared_bytes_field(1u32, &self.bytes, buf);
}
}
#[inline]
pub fn encode(&self, buf: &mut impl ::buffa::EncodeSink) {
self.try_encode(buf).unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encode(
&self,
buf: &mut impl ::buffa::EncodeSink,
) -> ::core::result::Result<(), ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
::buffa::checked_encode_size(self.compute_size(&mut __cache))?;
self.write_to(&mut __cache, buf);
::core::result::Result::Ok(())
}
#[inline]
#[must_use]
pub fn encoded_len(&self) -> u32 {
self.try_encoded_len().unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encoded_len(&self) -> ::core::result::Result<u32, ::buffa::EncodeError> {
::buffa::checked_encode_size(self.compute_size(&mut ::buffa::SizeCache::new()))
}
#[inline]
#[must_use]
pub fn encode_to_vec(&self) -> ::buffa::alloc::vec::Vec<u8> {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf
}
pub fn try_encode_to_vec(
&self,
) -> ::core::result::Result<::buffa::alloc::vec::Vec<u8>, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf)
}
#[inline]
#[must_use]
pub fn encode_to_bytes(&self) -> ::buffa::bytes::Bytes {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf.freeze()
}
pub fn try_encode_to_bytes(
&self,
) -> ::core::result::Result<::buffa::bytes::Bytes, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf.freeze())
}
}
impl<'a> ::buffa::MessageName for KeyLazyView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.model.v2";
const NAME: &'static str = "Key";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.model.v2.Key";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.model.v2.Key";
}
#[derive(Clone, Debug, Default)]
pub struct KeysLazyView<'a> {
pub keys: ::buffa::LazyRepeatedView<
'a,
super::super::__buffa::lazy_view::KeyLazyView<'a>,
>,
}
impl<'a> KeysLazyView<'a> {
#[doc(hidden)]
pub fn _decode_lazy_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_lazy(buf, ctx)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(::core::mem::size_of::<&'a [u8]>())?;
view.keys.push_bytes(sub, __sub_ctx);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::LazyMessageView<'a> for KeysLazyView<'a> {
type Owned = super::super::Keys;
fn decode_lazy(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
Self::_decode_lazy_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_lazy_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_lazy_ctx(buf, ctx)
}
fn merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
self._merge_lazy(buf, ctx)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Keys, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
#[allow(unused_imports)]
use ::buffa::MessageView as _;
let __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes> = ::core::option::Option::None;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Keys {
keys: {
let mut __out = ::buffa::alloc::vec::Vec::with_capacity(self.keys.len());
for __r in self.keys.iter() {
__out.push(__r?.to_owned_message()?);
}
__out
},
..::core::default::Default::default()
})
}
}
impl<'a> KeysLazyView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
pub fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
let mut size = 0u64;
for __frag in self.keys.raw_elements() {
size
+= 1u64 + ::buffa::encoding::varint_len(__frag.len() as u64) as u64
+ __frag.len() as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
pub fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
for __frag in self.keys.raw_elements() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__frag.len() as u64, buf);
buf.put_slice(__frag);
}
}
#[inline]
pub fn encode(&self, buf: &mut impl ::buffa::EncodeSink) {
self.try_encode(buf).unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encode(
&self,
buf: &mut impl ::buffa::EncodeSink,
) -> ::core::result::Result<(), ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
::buffa::checked_encode_size(self.compute_size(&mut __cache))?;
self.write_to(&mut __cache, buf);
::core::result::Result::Ok(())
}
#[inline]
#[must_use]
pub fn encoded_len(&self) -> u32 {
self.try_encoded_len().unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encoded_len(&self) -> ::core::result::Result<u32, ::buffa::EncodeError> {
::buffa::checked_encode_size(self.compute_size(&mut ::buffa::SizeCache::new()))
}
#[inline]
#[must_use]
pub fn encode_to_vec(&self) -> ::buffa::alloc::vec::Vec<u8> {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf
}
pub fn try_encode_to_vec(
&self,
) -> ::core::result::Result<::buffa::alloc::vec::Vec<u8>, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf)
}
#[inline]
#[must_use]
pub fn encode_to_bytes(&self) -> ::buffa::bytes::Bytes {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf.freeze()
}
pub fn try_encode_to_bytes(
&self,
) -> ::core::result::Result<::buffa::bytes::Bytes, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf.freeze())
}
}
impl<'a> ::buffa::MessageName for KeysLazyView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.model.v2";
const NAME: &'static str = "Keys";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.model.v2.Keys";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.model.v2.Keys";
}
#[derive(Clone, Debug, Default)]
pub struct EntryLazyView<'a> {
pub key: ::buffa::LazyMessageFieldView<
'a,
super::super::__buffa::lazy_view::KeyLazyView<'a>,
>,
pub value: ::buffa::MessageFieldView<
::buffa_types::google::protobuf::__buffa::view::AnyView<'a>,
>,
}
impl<'a> EntryLazyView<'a> {
#[doc(hidden)]
pub fn _decode_lazy_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_lazy(buf, ctx)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(::core::mem::size_of::<&'a [u8]>())?;
view.key.push_fragment(sub, __sub_ctx);
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.value.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(
existing,
sub,
__sub_ctx,
)?
}
None => {
view.value = ::buffa::MessageFieldView::set(
<::buffa_types::google::protobuf::__buffa::view::AnyView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::LazyMessageView<'a> for EntryLazyView<'a> {
type Owned = super::super::Entry;
fn decode_lazy(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
Self::_decode_lazy_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_lazy_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_lazy_ctx(buf, ctx)
}
fn merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
self._merge_lazy(buf, ctx)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Entry, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
#[allow(unused_imports)]
use ::buffa::MessageView as _;
let __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes> = ::core::option::Option::None;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Entry {
key: match self.key.get()? {
::core::option::Option::Some(v) => {
::buffa::MessageField::<
super::super::Key,
::buffa::Inline<super::super::Key>,
>::some(v.to_owned_message()?)
}
::core::option::Option::None => ::buffa::MessageField::none(),
},
value: match self.value.as_option() {
Some(v) => {
::buffa::MessageField::<
::buffa_types::google::protobuf::Any,
::buffa::Inline<::buffa_types::google::protobuf::Any>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
..::core::default::Default::default()
})
}
}
impl<'a> EntryLazyView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
pub fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
let mut size = 0u64;
for __frag in self.key.fragments() {
size
+= 1u64 + ::buffa::encoding::varint_len(__frag.len() as u64) as u64
+ __frag.len() as u64;
}
if self.value.is_set() {
let __slot = __cache.reserve();
let inner_size = self.value.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
pub fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
for __frag in self.key.fragments() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__frag.len() as u64, buf);
buf.put_slice(__frag);
}
if self.value.is_set() {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
self.value.write_to(__cache, buf);
}
}
#[inline]
pub fn encode(&self, buf: &mut impl ::buffa::EncodeSink) {
self.try_encode(buf).unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encode(
&self,
buf: &mut impl ::buffa::EncodeSink,
) -> ::core::result::Result<(), ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
::buffa::checked_encode_size(self.compute_size(&mut __cache))?;
self.write_to(&mut __cache, buf);
::core::result::Result::Ok(())
}
#[inline]
#[must_use]
pub fn encoded_len(&self) -> u32 {
self.try_encoded_len().unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encoded_len(&self) -> ::core::result::Result<u32, ::buffa::EncodeError> {
::buffa::checked_encode_size(self.compute_size(&mut ::buffa::SizeCache::new()))
}
#[inline]
#[must_use]
pub fn encode_to_vec(&self) -> ::buffa::alloc::vec::Vec<u8> {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf
}
pub fn try_encode_to_vec(
&self,
) -> ::core::result::Result<::buffa::alloc::vec::Vec<u8>, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf)
}
#[inline]
#[must_use]
pub fn encode_to_bytes(&self) -> ::buffa::bytes::Bytes {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf.freeze()
}
pub fn try_encode_to_bytes(
&self,
) -> ::core::result::Result<::buffa::bytes::Bytes, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf.freeze())
}
}
impl<'a> ::buffa::MessageName for EntryLazyView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.model.v2";
const NAME: &'static str = "Entry";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.model.v2.Entry";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.model.v2.Entry";
}
#[derive(Clone, Debug, Default)]
pub struct SinkEntriesLazyView<'a> {
pub entries: ::buffa::LazyRepeatedView<
'a,
super::super::__buffa::lazy_view::EntryLazyView<'a>,
>,
pub if_not_exist: bool,
}
impl<'a> SinkEntriesLazyView<'a> {
#[doc(hidden)]
pub fn _decode_lazy_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_lazy(buf, ctx)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.if_not_exist = ::buffa::types::decode_bool(&mut cur)?;
}
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(::core::mem::size_of::<&'a [u8]>())?;
view.entries.push_bytes(sub, __sub_ctx);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::LazyMessageView<'a> for SinkEntriesLazyView<'a> {
type Owned = super::super::SinkEntries;
fn decode_lazy(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
Self::_decode_lazy_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_lazy_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_lazy_ctx(buf, ctx)
}
fn merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
self._merge_lazy(buf, ctx)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::SinkEntries, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
#[allow(unused_imports)]
use ::buffa::MessageView as _;
let __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes> = ::core::option::Option::None;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::SinkEntries {
entries: {
let mut __out = ::buffa::alloc::vec::Vec::with_capacity(
self.entries.len(),
);
for __r in self.entries.iter() {
__out.push(__r?.to_owned_message()?);
}
__out
},
if_not_exist: self.if_not_exist,
..::core::default::Default::default()
})
}
}
impl<'a> SinkEntriesLazyView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
pub fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
let mut size = 0u64;
for __frag in self.entries.raw_elements() {
size
+= 1u64 + ::buffa::encoding::varint_len(__frag.len() as u64) as u64
+ __frag.len() as u64;
}
if self.if_not_exist {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
pub fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
for __frag in self.entries.raw_elements() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__frag.len() as u64, buf);
buf.put_slice(__frag);
}
if self.if_not_exist {
::buffa::types::put_bool_field(2u32, self.if_not_exist, buf);
}
}
#[inline]
pub fn encode(&self, buf: &mut impl ::buffa::EncodeSink) {
self.try_encode(buf).unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encode(
&self,
buf: &mut impl ::buffa::EncodeSink,
) -> ::core::result::Result<(), ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
::buffa::checked_encode_size(self.compute_size(&mut __cache))?;
self.write_to(&mut __cache, buf);
::core::result::Result::Ok(())
}
#[inline]
#[must_use]
pub fn encoded_len(&self) -> u32 {
self.try_encoded_len().unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encoded_len(&self) -> ::core::result::Result<u32, ::buffa::EncodeError> {
::buffa::checked_encode_size(self.compute_size(&mut ::buffa::SizeCache::new()))
}
#[inline]
#[must_use]
pub fn encode_to_vec(&self) -> ::buffa::alloc::vec::Vec<u8> {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf
}
pub fn try_encode_to_vec(
&self,
) -> ::core::result::Result<::buffa::alloc::vec::Vec<u8>, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf)
}
#[inline]
#[must_use]
pub fn encode_to_bytes(&self) -> ::buffa::bytes::Bytes {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf.freeze()
}
pub fn try_encode_to_bytes(
&self,
) -> ::core::result::Result<::buffa::bytes::Bytes, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf.freeze())
}
}
impl<'a> ::buffa::MessageName for SinkEntriesLazyView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.model.v2";
const NAME: &'static str = "SinkEntries";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.model.v2.SinkEntries";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.model.v2.SinkEntries";
}
#[derive(Clone, Debug, Default)]
pub struct QueriedEntryLazyView<'a> {
pub code: ::buffa::EnumValue<super::super::ResponseCode>,
pub entry: ::buffa::LazyMessageFieldView<
'a,
super::super::__buffa::lazy_view::EntryLazyView<'a>,
>,
}
impl<'a> QueriedEntryLazyView<'a> {
#[doc(hidden)]
pub fn _decode_lazy_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_lazy(buf, ctx)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.code = ::buffa::EnumValue::from(
::buffa::types::decode_int32(&mut cur)?,
);
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(::core::mem::size_of::<&'a [u8]>())?;
view.entry.push_fragment(sub, __sub_ctx);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::LazyMessageView<'a> for QueriedEntryLazyView<'a> {
type Owned = super::super::QueriedEntry;
fn decode_lazy(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
Self::_decode_lazy_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_lazy_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_lazy_ctx(buf, ctx)
}
fn merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
self._merge_lazy(buf, ctx)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::QueriedEntry, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
#[allow(unused_imports)]
use ::buffa::MessageView as _;
let __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes> = ::core::option::Option::None;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::QueriedEntry {
code: self.code,
entry: match self.entry.get()? {
::core::option::Option::Some(v) => {
::buffa::MessageField::<
super::super::Entry,
::buffa::Inline<super::super::Entry>,
>::some(v.to_owned_message()?)
}
::core::option::Option::None => ::buffa::MessageField::none(),
},
..::core::default::Default::default()
})
}
}
impl<'a> QueriedEntryLazyView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
pub fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
let mut size = 0u64;
{
let val = self.code.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
}
}
for __frag in self.entry.fragments() {
size
+= 1u64 + ::buffa::encoding::varint_len(__frag.len() as u64) as u64
+ __frag.len() as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
pub fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
{
let val = self.code.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
for __frag in self.entry.fragments() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__frag.len() as u64, buf);
buf.put_slice(__frag);
}
}
#[inline]
pub fn encode(&self, buf: &mut impl ::buffa::EncodeSink) {
self.try_encode(buf).unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encode(
&self,
buf: &mut impl ::buffa::EncodeSink,
) -> ::core::result::Result<(), ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
::buffa::checked_encode_size(self.compute_size(&mut __cache))?;
self.write_to(&mut __cache, buf);
::core::result::Result::Ok(())
}
#[inline]
#[must_use]
pub fn encoded_len(&self) -> u32 {
self.try_encoded_len().unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encoded_len(&self) -> ::core::result::Result<u32, ::buffa::EncodeError> {
::buffa::checked_encode_size(self.compute_size(&mut ::buffa::SizeCache::new()))
}
#[inline]
#[must_use]
pub fn encode_to_vec(&self) -> ::buffa::alloc::vec::Vec<u8> {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf
}
pub fn try_encode_to_vec(
&self,
) -> ::core::result::Result<::buffa::alloc::vec::Vec<u8>, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf)
}
#[inline]
#[must_use]
pub fn encode_to_bytes(&self) -> ::buffa::bytes::Bytes {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf.freeze()
}
pub fn try_encode_to_bytes(
&self,
) -> ::core::result::Result<::buffa::bytes::Bytes, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf.freeze())
}
}
impl<'a> ::buffa::MessageName for QueriedEntryLazyView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.model.v2";
const NAME: &'static str = "QueriedEntry";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.model.v2.QueriedEntry";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.model.v2.QueriedEntry";
}
#[derive(Clone, Debug, Default)]
pub struct QueriedEntriesLazyView<'a> {
pub entries: ::buffa::LazyRepeatedView<
'a,
super::super::__buffa::lazy_view::QueriedEntryLazyView<'a>,
>,
}
impl<'a> QueriedEntriesLazyView<'a> {
#[doc(hidden)]
pub fn _decode_lazy_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_lazy(buf, ctx)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __sub_ctx = ctx.descend()?;
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(::core::mem::size_of::<&'a [u8]>())?;
view.entries.push_bytes(sub, __sub_ctx);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::LazyMessageView<'a> for QueriedEntriesLazyView<'a> {
type Owned = super::super::QueriedEntries;
fn decode_lazy(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
Self::_decode_lazy_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_lazy_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_lazy_ctx(buf, ctx)
}
fn merge_lazy(
&mut self,
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
self._merge_lazy(buf, ctx)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::QueriedEntries, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
#[allow(unused_imports)]
use ::buffa::MessageView as _;
let __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes> = ::core::option::Option::None;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::QueriedEntries {
entries: {
let mut __out = ::buffa::alloc::vec::Vec::with_capacity(
self.entries.len(),
);
for __r in self.entries.iter() {
__out.push(__r?.to_owned_message()?);
}
__out
},
..::core::default::Default::default()
})
}
}
impl<'a> QueriedEntriesLazyView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
pub fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
let mut size = 0u64;
for __frag in self.entries.raw_elements() {
size
+= 1u64 + ::buffa::encoding::varint_len(__frag.len() as u64) as u64
+ __frag.len() as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
pub fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
#[allow(unused_imports)]
use ::buffa::ViewEncode as _;
for __frag in self.entries.raw_elements() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__frag.len() as u64, buf);
buf.put_slice(__frag);
}
}
#[inline]
pub fn encode(&self, buf: &mut impl ::buffa::EncodeSink) {
self.try_encode(buf).unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encode(
&self,
buf: &mut impl ::buffa::EncodeSink,
) -> ::core::result::Result<(), ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
::buffa::checked_encode_size(self.compute_size(&mut __cache))?;
self.write_to(&mut __cache, buf);
::core::result::Result::Ok(())
}
#[inline]
#[must_use]
pub fn encoded_len(&self) -> u32 {
self.try_encoded_len().unwrap_or_else(|_| ::buffa::encode_size_overflow())
}
pub fn try_encoded_len(&self) -> ::core::result::Result<u32, ::buffa::EncodeError> {
::buffa::checked_encode_size(self.compute_size(&mut ::buffa::SizeCache::new()))
}
#[inline]
#[must_use]
pub fn encode_to_vec(&self) -> ::buffa::alloc::vec::Vec<u8> {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf
}
pub fn try_encode_to_vec(
&self,
) -> ::core::result::Result<::buffa::alloc::vec::Vec<u8>, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::alloc::vec::Vec::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf)
}
#[inline]
#[must_use]
pub fn encode_to_bytes(&self) -> ::buffa::bytes::Bytes {
let mut __cache = ::buffa::SizeCache::new();
let __size = match ::buffa::checked_encode_size(
self.compute_size(&mut __cache),
) {
::core::result::Result::Ok(__size) => __size as usize,
::core::result::Result::Err(_) => ::buffa::encode_size_overflow(),
};
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
__buf.freeze()
}
pub fn try_encode_to_bytes(
&self,
) -> ::core::result::Result<::buffa::bytes::Bytes, ::buffa::EncodeError> {
let mut __cache = ::buffa::SizeCache::new();
let __size = ::buffa::checked_encode_size(self.compute_size(&mut __cache))?
as usize;
let mut __buf = ::buffa::bytes::BytesMut::with_capacity(__size);
self.write_to(&mut __cache, &mut __buf);
::buffa::debug_assert_two_pass(__buf.len(), __size);
::core::result::Result::Ok(__buf.freeze())
}
}
impl<'a> ::buffa::MessageName for QueriedEntriesLazyView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.model.v2";
const NAME: &'static str = "QueriedEntries";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.model.v2.QueriedEntries";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.model.v2.QueriedEntries";
}