#[derive(Clone, PartialEq, Default)]
pub struct Blob {
pub raw_size: ::core::option::Option<i32>,
pub data: ::core::option::Option<__buffa::oneof::blob::Data>,
}
impl ::core::fmt::Debug for Blob {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Blob")
.field("raw_size", &self.raw_size)
.field("data", &self.data)
.finish()
}
}
impl Blob {
pub const TYPE_URL: &'static str = "type.googleapis.com/OSMPBF.Blob";
}
impl Blob {
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_raw_size(mut self, value: i32) -> Self {
self.raw_size = Some(value);
self
}
}
::buffa::impl_default_instance!(Blob);
impl ::buffa::MessageName for Blob {
const PACKAGE: &'static str = "OSMPBF";
const NAME: &'static str = "Blob";
const FULL_NAME: &'static str = "OSMPBF.Blob";
const TYPE_URL: &'static str = "type.googleapis.com/OSMPBF.Blob";
}
impl ::buffa::Message for Blob {
#[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;
if let ::core::option::Option::Some(ref v) = self.data {
match v {
__buffa::oneof::blob::Data::Raw(x) => {
size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
}
__buffa::oneof::blob::Data::ZlibData(x) => {
size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
}
__buffa::oneof::blob::Data::LzmaData(x) => {
size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
}
__buffa::oneof::blob::Data::OBSOLETEBzip2Data(x) => {
size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
}
__buffa::oneof::blob::Data::Lz4Data(x) => {
size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
}
__buffa::oneof::blob::Data::ZstdData(x) => {
size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
}
}
}
if let Some(v) = self.raw_size {
size += 1u64 + ::buffa::types::int32_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 _;
if let ::core::option::Option::Some(ref v) = self.data {
match v {
__buffa::oneof::blob::Data::Raw(x) => {
::buffa::types::put_shared_bytes_field(1u32, x, buf);
}
__buffa::oneof::blob::Data::ZlibData(x) => {
::buffa::types::put_shared_bytes_field(3u32, x, buf);
}
__buffa::oneof::blob::Data::LzmaData(x) => {
::buffa::types::put_shared_bytes_field(4u32, x, buf);
}
__buffa::oneof::blob::Data::OBSOLETEBzip2Data(x) => {
::buffa::types::put_shared_bytes_field(5u32, x, buf);
}
__buffa::oneof::blob::Data::Lz4Data(x) => {
::buffa::types::put_shared_bytes_field(6u32, x, buf);
}
__buffa::oneof::blob::Data::ZstdData(x) => {
::buffa::types::put_shared_bytes_field(7u32, x, buf);
}
}
}
if let Some(v) = self.raw_size {
::buffa::types::put_int32_field(2u32, 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,
)?;
self.data = ::core::option::Option::Some(
__buffa::oneof::blob::Data::Raw(::buffa::types::decode_bytes(buf)?),
);
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
self.data = ::core::option::Option::Some(
__buffa::oneof::blob::Data::ZlibData(
::buffa::types::decode_bytes(buf)?,
),
);
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
self.data = ::core::option::Option::Some(
__buffa::oneof::blob::Data::LzmaData(
::buffa::types::decode_bytes(buf)?,
),
);
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
self.data = ::core::option::Option::Some(
__buffa::oneof::blob::Data::OBSOLETEBzip2Data(
::buffa::types::decode_bytes(buf)?,
),
);
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
self.data = ::core::option::Option::Some(
__buffa::oneof::blob::Data::Lz4Data(
::buffa::types::decode_bytes(buf)?,
),
);
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
self.data = ::core::option::Option::Some(
__buffa::oneof::blob::Data::ZstdData(
::buffa::types::decode_bytes(buf)?,
),
);
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.raw_size = ::core::option::Option::Some(
::buffa::types::decode_int32(buf)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.data = ::core::option::Option::None;
self.raw_size = ::core::option::Option::None;
}
}
pub mod blob {
#[allow(unused_imports)]
use super::*;
#[doc(inline)]
pub use super::__buffa::oneof::blob::Data;
#[doc(inline)]
pub use super::__buffa::view::oneof::blob::Data as DataView;
}
#[derive(Clone, PartialEq, Default)]
pub struct BlobHeader {
pub r#type: ::buffa::alloc::string::String,
pub indexdata: ::core::option::Option<::buffa::alloc::vec::Vec<u8>>,
pub datasize: i32,
}
impl ::core::fmt::Debug for BlobHeader {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("BlobHeader")
.field("type", &self.r#type)
.field("indexdata", &self.indexdata)
.field("datasize", &self.datasize)
.finish()
}
}
impl BlobHeader {
pub const TYPE_URL: &'static str = "type.googleapis.com/OSMPBF.BlobHeader";
}
impl BlobHeader {
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_indexdata(
mut self,
value: impl Into<::buffa::alloc::vec::Vec<u8>>,
) -> Self {
self.indexdata = Some(value.into());
self
}
}
::buffa::impl_default_instance!(BlobHeader);
impl ::buffa::MessageName for BlobHeader {
const PACKAGE: &'static str = "OSMPBF";
const NAME: &'static str = "BlobHeader";
const FULL_NAME: &'static str = "OSMPBF.BlobHeader";
const TYPE_URL: &'static str = "type.googleapis.com/OSMPBF.BlobHeader";
}
impl ::buffa::Message for BlobHeader {
#[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;
size += 1u64 + ::buffa::types::string_encoded_len(&self.r#type) as u64;
if let Some(ref v) = self.indexdata {
size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64;
}
size += 1u64 + ::buffa::types::int32_encoded_len(self.datasize) 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 _;
::buffa::types::put_string_field(1u32, &self.r#type, buf);
if let Some(ref v) = self.indexdata {
::buffa::types::put_shared_bytes_field(2u32, v, buf);
}
::buffa::types::put_int32_field(3u32, self.datasize, 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,
)?;
::buffa::types::merge_string(&mut self.r#type, buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_bytes(
self.indexdata.get_or_insert_with(::buffa::alloc::vec::Vec::new),
buf,
)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.datasize = ::buffa::types::decode_int32(buf)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.r#type.clear();
self.indexdata = ::core::option::Option::None;
self.datasize = 0i32;
}
}