#[derive(Clone, Debug, Default)]
pub struct GetRequestView<'a> {
pub block_number: u64,
pub block_hash: &'a [u8],
pub omit_deleted: bool,
pub key: &'a [u8],
}
impl<'a> ::buffa::MessageView<'a> for GetRequestView<'a> {
type Owned = super::super::GetRequest;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.block_number = ::buffa::types::decode_uint64(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.block_hash = ::buffa::types::borrow_bytes(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.omit_deleted = ::buffa::types::decode_bool(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.key = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::GetRequest, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::GetRequest, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::GetRequest {
block_number: self.block_number,
block_hash: (self.block_hash).to_vec(),
omit_deleted: self.omit_deleted,
key: (self.key).to_vec(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for GetRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if self.block_number != 0u64 {
size += 1u64 + ::buffa::types::uint64_encoded_len(self.block_number) as u64;
}
if !self.block_hash.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.block_hash) as u64;
}
if self.omit_deleted {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if !self.key.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.key) as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.block_number != 0u64 {
::buffa::types::put_uint64_field(1u32, self.block_number, buf);
}
if !self.block_hash.is_empty() {
::buffa::types::put_shared_bytes_field(2u32, &self.block_hash, buf);
}
if self.omit_deleted {
::buffa::types::put_bool_field(3u32, self.omit_deleted, buf);
}
if !self.key.is_empty() {
::buffa::types::put_shared_bytes_field(4u32, &self.key, buf);
}
}
}
impl<'a> ::buffa::MessageName for GetRequestView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "GetRequest";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.GetRequest";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.GetRequest";
}
::buffa::impl_default_view_instance!(GetRequestView);
::buffa::impl_view_reborrow!(GetRequestView);
#[derive(Clone, Debug)]
pub struct GetRequestOwnedView(::buffa::OwnedView<GetRequestView<'static>>);
impl GetRequestOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetRequestOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::GetRequest,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &GetRequestView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::GetRequest {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn block_number(&self) -> u64 {
self.0.reborrow().block_number
}
#[must_use]
pub fn block_hash(&self) -> &'_ [u8] {
self.0.reborrow().block_hash
}
#[must_use]
pub fn omit_deleted(&self) -> bool {
self.0.reborrow().omit_deleted
}
#[must_use]
pub fn key(&self) -> &'_ [u8] {
self.0.reborrow().key
}
}
impl ::core::convert::From<::buffa::OwnedView<GetRequestView<'static>>>
for GetRequestOwnedView {
fn from(inner: ::buffa::OwnedView<GetRequestView<'static>>) -> Self {
GetRequestOwnedView(inner)
}
}
impl ::core::convert::From<GetRequestOwnedView>
for ::buffa::OwnedView<GetRequestView<'static>> {
fn from(wrapper: GetRequestOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<GetRequestView<'static>>>
for GetRequestOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<GetRequestView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::GetRequest {
type View<'a> = GetRequestView<'a>;
type ViewHandle = GetRequestOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct GetResponseView<'a> {
pub block_reached: bool,
pub code: ::buffa::EnumValue<super::super::ResponseCode>,
pub value: ::buffa::MessageFieldView<
::buffa_types::google::protobuf::__buffa::view::AnyView<'a>,
>,
}
impl<'a> ::buffa::MessageView<'a> for GetResponseView<'a> {
type Owned = super::super::GetResponse;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.block_reached = ::buffa::types::decode_bool(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.code = ::buffa::EnumValue::from(
::buffa::types::decode_int32(&mut cur)?,
);
}
5u32 => {
::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(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::GetResponse, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::GetResponse, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::GetResponse {
block_reached: self.block_reached,
code: self.code,
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> ::buffa::ViewEncode<'a> for GetResponseView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if self.block_reached {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
{
let val = self.code.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) 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)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.block_reached {
::buffa::types::put_bool_field(3u32, self.block_reached, buf);
}
{
let val = self.code.to_i32();
if val != 0 {
::buffa::types::put_int32_field(4u32, val, buf);
}
}
if self.value.is_set() {
::buffa::types::put_len_delimited_header(
5u32,
u64::from(__cache.consume_next()),
buf,
);
self.value.write_to(__cache, buf);
}
}
}
impl<'a> ::buffa::MessageName for GetResponseView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "GetResponse";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.GetResponse";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.GetResponse";
}
::buffa::impl_default_view_instance!(GetResponseView);
::buffa::impl_view_reborrow!(GetResponseView);
#[derive(Clone, Debug)]
pub struct GetResponseOwnedView(::buffa::OwnedView<GetResponseView<'static>>);
impl GetResponseOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetResponseOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::GetResponse,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &GetResponseView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::GetResponse {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn block_reached(&self) -> bool {
self.0.reborrow().block_reached
}
#[must_use]
pub fn code(&self) -> ::buffa::EnumValue<super::super::ResponseCode> {
self.0.reborrow().code
}
#[must_use]
pub fn value(
&self,
) -> &::buffa::MessageFieldView<
::buffa_types::google::protobuf::__buffa::view::AnyView<'_>,
> {
&self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<GetResponseView<'static>>>
for GetResponseOwnedView {
fn from(inner: ::buffa::OwnedView<GetResponseView<'static>>) -> Self {
GetResponseOwnedView(inner)
}
}
impl ::core::convert::From<GetResponseOwnedView>
for ::buffa::OwnedView<GetResponseView<'static>> {
fn from(wrapper: GetResponseOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<GetResponseView<'static>>>
for GetResponseOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<GetResponseView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::GetResponse {
type View<'a> = GetResponseView<'a>;
type ViewHandle = GetResponseOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct GetAllRequestView<'a> {
pub block_number: u64,
pub block_hash: &'a [u8],
pub omit_deleted: bool,
pub keys: ::buffa::RepeatedView<'a, &'a [u8]>,
}
impl<'a> ::buffa::MessageView<'a> for GetAllRequestView<'a> {
type Owned = super::super::GetAllRequest;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.block_number = ::buffa::types::decode_uint64(&mut cur)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.block_hash = ::buffa::types::borrow_bytes(&mut cur)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.omit_deleted = ::buffa::types::decode_bool(&mut cur)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::borrow_bytes(&mut cur)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
view.keys.push(__elem);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::GetAllRequest, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::GetAllRequest, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::GetAllRequest {
block_number: self.block_number,
block_hash: (self.block_hash).to_vec(),
omit_deleted: self.omit_deleted,
keys: self.keys.iter().map(|b| (b).to_vec()).collect(),
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for GetAllRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if self.block_number != 0u64 {
size += 1u64 + ::buffa::types::uint64_encoded_len(self.block_number) as u64;
}
if !self.block_hash.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.block_hash) as u64;
}
if self.omit_deleted {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
for v in &self.keys {
size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.block_number != 0u64 {
::buffa::types::put_uint64_field(1u32, self.block_number, buf);
}
if !self.block_hash.is_empty() {
::buffa::types::put_shared_bytes_field(2u32, &self.block_hash, buf);
}
if self.omit_deleted {
::buffa::types::put_bool_field(3u32, self.omit_deleted, buf);
}
for v in &self.keys {
::buffa::types::put_shared_bytes_field(4u32, v, buf);
}
}
}
impl<'a> ::buffa::MessageName for GetAllRequestView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "GetAllRequest";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.GetAllRequest";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.GetAllRequest";
}
::buffa::impl_default_view_instance!(GetAllRequestView);
::buffa::impl_view_reborrow!(GetAllRequestView);
#[derive(Clone, Debug)]
pub struct GetAllRequestOwnedView(::buffa::OwnedView<GetAllRequestView<'static>>);
impl GetAllRequestOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetAllRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetAllRequestOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::GetAllRequest,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetAllRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &GetAllRequestView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::GetAllRequest {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn block_number(&self) -> u64 {
self.0.reborrow().block_number
}
#[must_use]
pub fn block_hash(&self) -> &'_ [u8] {
self.0.reborrow().block_hash
}
#[must_use]
pub fn omit_deleted(&self) -> bool {
self.0.reborrow().omit_deleted
}
#[must_use]
pub fn keys(&self) -> &::buffa::RepeatedView<'_, &'_ [u8]> {
&self.0.reborrow().keys
}
}
impl ::core::convert::From<::buffa::OwnedView<GetAllRequestView<'static>>>
for GetAllRequestOwnedView {
fn from(inner: ::buffa::OwnedView<GetAllRequestView<'static>>) -> Self {
GetAllRequestOwnedView(inner)
}
}
impl ::core::convert::From<GetAllRequestOwnedView>
for ::buffa::OwnedView<GetAllRequestView<'static>> {
fn from(wrapper: GetAllRequestOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<GetAllRequestView<'static>>>
for GetAllRequestOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<GetAllRequestView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::GetAllRequest {
type View<'a> = GetAllRequestView<'a>;
type ViewHandle = GetAllRequestOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct ResponseEntryView<'a> {
pub key: &'a [u8],
pub response: ::buffa::MessageFieldView<
super::super::__buffa::view::GetResponseView<'a>,
>,
}
impl<'a> ::buffa::MessageView<'a> for ResponseEntryView<'a> {
type Owned = super::super::ResponseEntry;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.key = ::buffa::types::borrow_bytes(&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)?;
match view.response.as_mut() {
Some(existing) => {
::buffa::MessageView::merge_into_view(existing, sub, __sub_ctx)?
}
None => {
view.response = ::buffa::MessageFieldView::set(
<super::super::__buffa::view::GetResponseView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
}
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::ResponseEntry, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::ResponseEntry, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::ResponseEntry {
key: (self.key).to_vec(),
response: match self.response.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::GetResponse,
::buffa::Inline<super::super::GetResponse>,
>::some(v.to_owned_from_source(__buffa_src)?)
}
None => ::buffa::MessageField::none(),
},
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for ResponseEntryView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.key.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.key) as u64;
}
if self.response.is_set() {
let __slot = __cache.reserve();
let inner_size = self.response.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)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.key.is_empty() {
::buffa::types::put_shared_bytes_field(1u32, &self.key, buf);
}
if self.response.is_set() {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
self.response.write_to(__cache, buf);
}
}
}
impl<'a> ::buffa::MessageName for ResponseEntryView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "ResponseEntry";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.ResponseEntry";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.ResponseEntry";
}
::buffa::impl_default_view_instance!(ResponseEntryView);
::buffa::impl_view_reborrow!(ResponseEntryView);
#[derive(Clone, Debug)]
pub struct ResponseEntryOwnedView(::buffa::OwnedView<ResponseEntryView<'static>>);
impl ResponseEntryOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ResponseEntryOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ResponseEntryOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::ResponseEntry,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
ResponseEntryOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &ResponseEntryView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::ResponseEntry {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn key(&self) -> &'_ [u8] {
self.0.reborrow().key
}
#[must_use]
pub fn response(
&self,
) -> &::buffa::MessageFieldView<super::super::__buffa::view::GetResponseView<'_>> {
&self.0.reborrow().response
}
}
impl ::core::convert::From<::buffa::OwnedView<ResponseEntryView<'static>>>
for ResponseEntryOwnedView {
fn from(inner: ::buffa::OwnedView<ResponseEntryView<'static>>) -> Self {
ResponseEntryOwnedView(inner)
}
}
impl ::core::convert::From<ResponseEntryOwnedView>
for ::buffa::OwnedView<ResponseEntryView<'static>> {
fn from(wrapper: ResponseEntryOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<ResponseEntryView<'static>>>
for ResponseEntryOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<ResponseEntryView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::ResponseEntry {
type View<'a> = ResponseEntryView<'a>;
type ViewHandle = ResponseEntryOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct GetAllResponseView<'a> {
pub entries: ::buffa::RepeatedView<
'a,
super::super::__buffa::view::ResponseEntryView<'a>,
>,
pub block_reached: bool,
}
impl<'a> ::buffa::MessageView<'a> for GetAllResponseView<'a> {
type Owned = super::super::GetAllResponse;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.block_reached = ::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::<
super::super::__buffa::view::ResponseEntryView,
>(),
)?;
view.entries
.push(
<super::super::__buffa::view::ResponseEntryView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::GetAllResponse, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::GetAllResponse, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::GetAllResponse {
entries: self
.entries
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
block_reached: self.block_reached,
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for GetAllResponseView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
for v in &self.entries {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if self.block_reached {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
for v in &self.entries {
::buffa::types::put_len_delimited_header(
1u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
if self.block_reached {
::buffa::types::put_bool_field(2u32, self.block_reached, buf);
}
}
}
impl<'a> ::buffa::MessageName for GetAllResponseView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "GetAllResponse";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.GetAllResponse";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.GetAllResponse";
}
::buffa::impl_default_view_instance!(GetAllResponseView);
::buffa::impl_view_reborrow!(GetAllResponseView);
#[derive(Clone, Debug)]
pub struct GetAllResponseOwnedView(::buffa::OwnedView<GetAllResponseView<'static>>);
impl GetAllResponseOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetAllResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetAllResponseOwnedView(
::buffa::OwnedView::decode_with_options(bytes, opts)?,
),
)
}
pub fn from_owned(
msg: &super::super::GetAllResponse,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
GetAllResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &GetAllResponseView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::GetAllResponse {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn entries(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::ResponseEntryView<'_>> {
&self.0.reborrow().entries
}
#[must_use]
pub fn block_reached(&self) -> bool {
self.0.reborrow().block_reached
}
}
impl ::core::convert::From<::buffa::OwnedView<GetAllResponseView<'static>>>
for GetAllResponseOwnedView {
fn from(inner: ::buffa::OwnedView<GetAllResponseView<'static>>) -> Self {
GetAllResponseOwnedView(inner)
}
}
impl ::core::convert::From<GetAllResponseOwnedView>
for ::buffa::OwnedView<GetAllResponseView<'static>> {
fn from(wrapper: GetAllResponseOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<GetAllResponseView<'static>>>
for GetAllResponseOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<GetAllResponseView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::GetAllResponse {
type View<'a> = GetAllResponseView<'a>;
type ViewHandle = GetAllResponseOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct EntryView<'a> {
pub key: &'a [u8],
pub value: ::buffa::MessageFieldView<
::buffa_types::google::protobuf::__buffa::view::AnyView<'a>,
>,
}
impl<'a> ::buffa::MessageView<'a> for EntryView<'a> {
type Owned = super::super::Entry;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.key = ::buffa::types::borrow_bytes(&mut cur)?;
}
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(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Entry, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Entry, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Entry {
key: (self.key).to_vec(),
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> ::buffa::ViewEncode<'a> for EntryView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.key.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.key) 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)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.key.is_empty() {
::buffa::types::put_shared_bytes_field(2u32, &self.key, buf);
}
if self.value.is_set() {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
self.value.write_to(__cache, buf);
}
}
}
impl<'a> ::buffa::MessageName for EntryView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "Entry";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.Entry";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.Entry";
}
::buffa::impl_default_view_instance!(EntryView);
::buffa::impl_view_reborrow!(EntryView);
#[derive(Clone, Debug)]
pub struct EntryOwnedView(::buffa::OwnedView<EntryView<'static>>);
impl EntryOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(EntryOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
EntryOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Entry,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(EntryOwnedView(::buffa::OwnedView::from_owned(msg)?))
}
#[must_use]
pub fn view(&self) -> &EntryView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Entry {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn key(&self) -> &'_ [u8] {
self.0.reborrow().key
}
#[must_use]
pub fn value(
&self,
) -> &::buffa::MessageFieldView<
::buffa_types::google::protobuf::__buffa::view::AnyView<'_>,
> {
&self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<EntryView<'static>>> for EntryOwnedView {
fn from(inner: ::buffa::OwnedView<EntryView<'static>>) -> Self {
EntryOwnedView(inner)
}
}
impl ::core::convert::From<EntryOwnedView> for ::buffa::OwnedView<EntryView<'static>> {
fn from(wrapper: EntryOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<EntryView<'static>>> for EntryOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<EntryView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Entry {
type View<'a> = EntryView<'a>;
type ViewHandle = EntryOwnedView;
}
#[derive(Clone, Debug, Default)]
pub struct EntriesView<'a> {
pub entries: ::buffa::RepeatedView<'a, super::super::__buffa::view::EntryView<'a>>,
}
impl<'a> ::buffa::MessageView<'a> for EntriesView<'a> {
type Owned = super::super::Entries;
fn decode_view(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 as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
_before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = 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::<super::super::__buffa::view::EntryView>(),
)?;
view.entries
.push(
<super::super::__buffa::view::EntryView as ::buffa::MessageView>::decode_view_ctx(
sub,
__sub_ctx,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Entries, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Entries, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Entries {
entries: self
.entries
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
..::core::default::Default::default()
})
}
}
impl<'a> ::buffa::ViewEncode<'a> for EntriesView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
for v in &self.entries {
let __slot = __cache.reserve();
let inner_size = v.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)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
for v in &self.entries {
::buffa::types::put_len_delimited_header(
1u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
}
}
impl<'a> ::buffa::MessageName for EntriesView<'a> {
const PACKAGE: &'static str = "sf.substreams.foundational_store.v1";
const NAME: &'static str = "Entries";
const FULL_NAME: &'static str = "sf.substreams.foundational_store.v1.Entries";
const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.foundational_store.v1.Entries";
}
::buffa::impl_default_view_instance!(EntriesView);
::buffa::impl_view_reborrow!(EntriesView);
#[derive(Clone, Debug)]
pub struct EntriesOwnedView(::buffa::OwnedView<EntriesView<'static>>);
impl EntriesOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(EntriesOwnedView(::buffa::OwnedView::decode(bytes)?))
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
EntriesOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Entries,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
EntriesOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &EntriesView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Entries {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn entries(
&self,
) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::EntryView<'_>> {
&self.0.reborrow().entries
}
}
impl ::core::convert::From<::buffa::OwnedView<EntriesView<'static>>>
for EntriesOwnedView {
fn from(inner: ::buffa::OwnedView<EntriesView<'static>>) -> Self {
EntriesOwnedView(inner)
}
}
impl ::core::convert::From<EntriesOwnedView>
for ::buffa::OwnedView<EntriesView<'static>> {
fn from(wrapper: EntriesOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<EntriesView<'static>>>
for EntriesOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<EntriesView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Entries {
type View<'a> = EntriesView<'a>;
type ViewHandle = EntriesOwnedView;
}