substreams 0.8.0-beta

Substreams SDK - A streaming data engine for The Graph - by StreamingFast
Documentation
// @generated by buffa-codegen. DO NOT EDIT.
// source: sf/substreams/index/v1/keys.proto

#[derive(Clone, PartialEq, Default)]
pub struct Keys {
    /// Field 1: `keys`
    pub keys: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
}
impl ::core::fmt::Debug for Keys {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Keys").field("keys", &self.keys).finish()
    }
}
impl Keys {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.index.v1.Keys";
}
::buffa::impl_default_instance!(Keys);
impl ::buffa::MessageName for Keys {
    const PACKAGE: &'static str = "sf.substreams.index.v1";
    const NAME: &'static str = "Keys";
    const FULL_NAME: &'static str = "sf.substreams.index.v1.Keys";
    const TYPE_URL: &'static str = "type.googleapis.com/sf.substreams.index.v1.Keys";
}
impl ::buffa::Message for Keys {
    /// Returns the total encoded size in bytes.
    ///
    /// Accumulates in `u64` (which cannot overflow for in-memory
    /// data) and saturates to `u32` at return, so a message whose
    /// encoded size exceeds the 2 GiB protobuf limit yields a value
    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
    /// points reject, never a silently wrapped size.
    #[allow(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.keys {
            size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
        }
        ::buffa::saturate_size(size)
    }
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        for v in &self.keys {
            ::buffa::types::put_string_field(1u32, v, buf);
        }
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                let __elem = ::buffa::types::decode_string(buf)?;
                ctx.register_element_memory(
                    ::buffa::__private::element_footprint(&__elem),
                )?;
                self.keys.push(__elem);
            }
            _ => {
                ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
            }
        }
        ::core::result::Result::Ok(())
    }
    fn clear(&mut self) {
        self.keys.clear();
    }
}