#[allow(warnings, dead_code, unused_imports, unused_macros, unused_mut, unused_variables, nonstandard_style, unreachable_pub, single_use_lifetimes, unused_qualifications, clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)]
#[doc(hidden)]
mod rp_check {
::rapidproto::rp_abi!(1); const C: () = ();
const _: () = crate::example::rp_check::C; }
#[allow(warnings, dead_code, unused_imports, unused_macros, unused_mut, unused_variables, nonstandard_style, unreachable_pub, single_use_lifetimes, unused_qualifications, clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)]
pub mod common {
pub mod weather {
#[derive(Clone, Copy, PartialEq, Eq, Hash, Default)]
#[repr(transparent)]
pub struct Unit(pub i32);
impl ::core::fmt::Debug for Unit {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
::core::fmt::Debug::fmt(&self.classify(), rp_f)
}
}
impl Unit {
pub const UNSPECIFIED: Unit = Unit(0);
pub const CELSIUS: Unit = Unit(1);
pub const FAHRENHEIT: Unit = Unit(2);
#[inline]
#[must_use]
pub fn classify(self) -> UnitClass {
match self.0 {
0 => UnitClass::Unspecified,
1 => UnitClass::Celsius,
2 => UnitClass::Fahrenheit,
rp_other => UnitClass::Unknown(rp_other),
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum UnitClass {
Unspecified,
Celsius,
Fahrenheit,
Unknown(i32),
}
}
}
#[allow(warnings, dead_code, unused_imports, unused_macros, unused_mut, unused_variables, nonstandard_style, unreachable_pub, single_use_lifetimes, unused_qualifications, clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)]
pub mod arena {
pub mod weather {
pub struct Location<'a> {
latitude: f64,
longitude: f64,
_marker: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Location<'a> {
pub fn latitude(&self) -> f64 {
self.latitude
}
pub fn longitude(&self) -> f64 {
self.longitude
}
}
impl<'a> ::core::fmt::Debug for Location<'a> {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut rp_s = rp_f.debug_struct("Location");
{
let rp_v = self.latitude();
if rp_v.to_bits() != 0 {
rp_s.field("latitude", &rp_v);
}
}
{
let rp_v = self.longitude();
if rp_v.to_bits() != 0 {
rp_s.field("longitude", &rp_v);
}
}
rp_s.finish()
}
}
::rapidproto::impl_decode_owned!(Location);
pub struct Station<'a> {
name: ::rapidproto::ProtoStr<'a>,
location: crate::example::arena::weather::Location<'a>,
unit: crate::example::common::weather::Unit,
temperatures: ::rapidproto::PackedSlice<'a, f32>,
note: ::rapidproto::ProtoStr<'a>,
rp_presence: u8,
labels: ::rapidproto::MapView<'a, ::rapidproto::ProtoStr<'a>, ::rapidproto::ProtoStr<'a>>,
status: ::core::option::Option<crate::example::arena::weather::station::Status<'a>>,
}
impl<'a> Station<'a> {
pub fn name(&self) -> ::rapidproto::ProtoStr<'a> {
self.name
}
pub fn location(&self) -> ::core::option::Option<&crate::example::arena::weather::Location<'a>> {
((self.rp_presence & (1 << 0)) != 0).then_some(&self.location)
}
pub fn unit(&self) -> crate::example::common::weather::Unit {
self.unit
}
pub fn temperatures(&self) -> &'a [f32] {
self.temperatures.as_slice()
}
pub fn note(&self) -> ::core::option::Option<::rapidproto::ProtoStr<'a>> {
let mut rp_v = ::core::option::Option::Some(::rapidproto::ProtoStr::new_truncating(self.note.as_bytes()));
if (self.rp_presence & (1 << 1)) == 0 {
rp_v = ::core::option::Option::None;
}
rp_v
}
pub fn labels(&self) -> ::rapidproto::MapView<'a, ::rapidproto::ProtoStr<'a>, ::rapidproto::ProtoStr<'a>> {
self.labels
}
pub fn status(&self) -> ::core::option::Option<&crate::example::arena::weather::station::Status<'a>> {
self.status.as_ref()
}
}
impl<'a> ::core::fmt::Debug for Station<'a> {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut rp_s = rp_f.debug_struct("Station");
{
let rp_v = self.name();
if !rp_v.is_empty() {
rp_s.field("name", &rp_v);
}
}
{
if let ::core::option::Option::Some(rp_v) = self.location() {
rp_s.field("location", &rp_v);
}
}
{
let rp_v = self.unit();
if rp_v.0 != 0 {
rp_s.field("unit", &rp_v);
}
}
{
let rp_v = self.temperatures();
if !rp_v.is_empty() {
rp_s.field("temperatures", &rp_v);
}
}
{
if let ::core::option::Option::Some(rp_v) = self.note() {
rp_s.field("note", &rp_v);
}
}
{
let rp_v = self.labels();
if !rp_v.is_empty() {
rp_s.field("labels", &rp_v);
}
}
if let ::core::option::Option::Some(rp_o) = self.status() {
match rp_o {
crate::example::arena::weather::station::Status::Error(rp_v) => {
rp_s.field("error", rp_v);
}
crate::example::arena::weather::station::Status::UptimeSeconds(rp_v) => {
rp_s.field("uptime_seconds", rp_v);
}
}
}
rp_s.finish()
}
}
::rapidproto::impl_decode_owned!(Station);
pub mod station {
#[derive(Debug)]
pub enum Status<'a> {
Error(::rapidproto::ProtoStr<'a>),
UptimeSeconds(u64),
}
}
pub struct Report<'a> {
stations: ::rapidproto::PackedSlice<'a, crate::example::arena::weather::Station<'a>>,
}
impl<'a> Report<'a> {
pub fn stations(&self) -> &'a [crate::example::arena::weather::Station<'a>] {
self.stations.as_slice()
}
}
impl<'a> ::core::fmt::Debug for Report<'a> {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut rp_s = rp_f.debug_struct("Report");
{
let rp_v = self.stations();
if !rp_v.is_empty() {
rp_s.field("stations", &rp_v);
}
}
rp_s.finish()
}
}
::rapidproto::impl_decode_owned!(Report);
impl<'a> Location<'a> {
pub fn decode(input: &'a [u8], arena: &'a ::rapidproto::Arena<'a>) -> ::core::result::Result<&'a Location<'a>, ::rapidproto::DecodeError> {
if input.len() > u32::MAX as usize {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::InputTooLarge, 0));
}
let rp_root = arena.emplace(|rp_out| Self::rp_decode_into(rp_out, input, arena, 0))?;
::core::result::Result::Ok(&*rp_root)
}
#[inline(always)]
#[doc(hidden)]
pub(in crate::example::arena) fn rp_decode_into<'id>(rp_out: ::rapidproto::Slot<'id, Location<'a>>, rp_body: &'a [u8], _rp_arena: &'a ::rapidproto::Arena<'a>, rp_depth: u32) -> ::core::result::Result<::rapidproto::Init<'id>, ::rapidproto::DecodeError> {
if rp_depth > ::rapidproto::MAX_DECODE_DEPTH {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::DepthLimitExceeded, 0));
}
let mut rp_field_1: f64 = 0.0;
let mut rp_field_2: f64 = 0.0;
let mut rp_rest: &'a [u8] = rp_body;
if rp_rest.first() == ::core::option::Option::Some(&9u8) {
rp_rest = &rp_rest[1..];
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_1 = f64::from_bits(rp_v);
}
if rp_rest.first() == ::core::option::Option::Some(&17u8) {
rp_rest = &rp_rest[1..];
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_2 = f64::from_bits(rp_v);
}
loop {
let rp_b = match rp_rest.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_rest = &rp_rest[1..];
rp_b as u32
} else {
let mut rp_tag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_rest = match ::rapidproto::wire::read_tag(rp_rest, &mut rp_tag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
(rp_tag.field << 3) | rp_tag.wire as u32
};
match rp_tagkey {
9u32 => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_1 = f64::from_bits(rp_v);
}
17u32 => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_2 = f64::from_bits(rp_v);
}
_ => {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
}
::core::result::Result::Ok(rp_out.write(Location {
latitude: rp_field_1,
longitude: rp_field_2,
_marker: ::core::marker::PhantomData,
}))
}
#[inline(always)]
pub(in crate::example::arena) fn rp_default() -> Self {
Location {
latitude: 0.0,
longitude: 0.0,
_marker: ::core::marker::PhantomData,
}
}
}
impl<'a> Station<'a> {
pub fn decode(input: &'a [u8], arena: &'a ::rapidproto::Arena<'a>) -> ::core::result::Result<&'a Station<'a>, ::rapidproto::DecodeError> {
if input.len() > u32::MAX as usize {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::InputTooLarge, 0));
}
let rp_root = arena.emplace(|rp_out| Self::rp_decode_into(rp_out, input, arena, 0))?;
::core::result::Result::Ok(&*rp_root)
}
#[inline(never)]
#[doc(hidden)]
pub(in crate::example::arena) fn rp_decode_into<'id>(rp_out: ::rapidproto::Slot<'id, Station<'a>>, rp_body: &'a [u8], rp_arena: &'a ::rapidproto::Arena<'a>, rp_depth: u32) -> ::core::result::Result<::rapidproto::Init<'id>, ::rapidproto::DecodeError> {
if rp_depth > ::rapidproto::MAX_DECODE_DEPTH {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::DepthLimitExceeded, 0));
}
let mut rp_presence: u8 = 0;
let mut rp_field_1: &'a [u8] = &[];
let mut rp_field_2: crate::example::arena::weather::Location<'a> = <crate::example::arena::weather::Location<'a>>::rp_default();
let mut rp_field_3: crate::example::common::weather::Unit = crate::example::common::weather::Unit(0);
let mut rp_acc_4 = ::rapidproto::DecodeVec::new(rp_arena);
let mut rp_field_8: &'a [u8] = &[];
let mut rp_map_5 = ::rapidproto::DecodeVec::new(rp_arena);
let mut rp_oneof_0: ::core::option::Option<crate::example::arena::weather::station::Status<'a>> = ::core::option::Option::None;
let mut rp_rest: &'a [u8] = rp_body;
if rp_rest.first() == ::core::option::Option::Some(&10u8) {
rp_rest = &rp_rest[1..];
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_1 = rp_p;
}
if rp_rest.first() == ::core::option::Option::Some(&18u8) {
rp_rest = &rp_rest[1..];
if (rp_presence & (1 << 0)) != 0 {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::RepeatedSingularMessage, rp_body.len() - rp_rest.len()).with_field(2));
}
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_2 = ::rapidproto::decode_value(|rp_out| crate::example::arena::weather::Location::rp_decode_into(rp_out, rp_p, rp_arena, rp_depth + 1))?;
rp_presence |= 1 << 0;
}
if rp_rest.first() == ::core::option::Option::Some(&24u8) {
rp_rest = &rp_rest[1..];
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_3 = crate::example::common::weather::Unit(rp_v as i32);
}
while rp_rest.first() == ::core::option::Option::Some(&37u8) {
rp_rest = &rp_rest[1..];
let mut rp_v = 0u32;
rp_rest = match ::rapidproto::wire::read_fixed32(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_acc_4.push(f32::from_bits(rp_v)).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
}
if rp_rest.first() == ::core::option::Option::Some(&34u8) {
rp_rest = &rp_rest[1..];
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
if ::core::cfg!(target_endian = "little") && rp_p.len() % 4 == 0 {
rp_acc_4.extend_from_le_bytes(rp_p).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
} else {
rp_acc_4.reserve(rp_p.len() / 4).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
while !rp_p.is_empty() {
let mut rp_v = 0u32;
rp_p = match ::rapidproto::wire::read_fixed32(rp_p, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len() - rp_p.len())),
};
rp_acc_4.push(f32::from_bits(rp_v)).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
}
}
}
while rp_rest.first() == ::core::option::Option::Some(&42u8) {
rp_rest = &rp_rest[1..];
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_ent_body: &'a [u8] = rp_p;
let mut rp_key: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_val: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_ent: &'a [u8] = rp_ent_body;
loop {
let rp_b = match rp_ent.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_ent = &rp_ent[1..];
rp_b as u32
} else {
let mut rp_etag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_ent = match ::rapidproto::wire::read_tag(rp_ent, &mut rp_etag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
(rp_etag.field << 3) | rp_etag.wire as u32
};
match rp_tagkey {
10u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_key = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
18u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_val = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
_ => {
rp_ent = match ::rapidproto::wire::skip_field(rp_ent, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
}
}
}
rp_map_5.push((rp_key, rp_val)).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
}
if rp_rest.first() == ::core::option::Option::Some(&50u8) {
rp_rest = &rp_rest[1..];
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_oneof_0 = ::core::option::Option::Some(crate::example::arena::weather::station::Status::Error(::rapidproto::ProtoStr::new_truncating(rp_p)));
}
if rp_rest.first() == ::core::option::Option::Some(&56u8) {
rp_rest = &rp_rest[1..];
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_oneof_0 = ::core::option::Option::Some(crate::example::arena::weather::station::Status::UptimeSeconds(rp_v));
}
if rp_rest.first() == ::core::option::Option::Some(&66u8) {
rp_rest = &rp_rest[1..];
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_8 = rp_p;
rp_presence |= 1 << 1;
}
loop {
let rp_b = match rp_rest.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_rest = &rp_rest[1..];
rp_b as u32
} else {
let mut rp_tag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_rest = match ::rapidproto::wire::read_tag(rp_rest, &mut rp_tag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
(rp_tag.field << 3) | rp_tag.wire as u32
};
match rp_tagkey {
10u32 => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_1 = rp_p;
}
18u32 => {
if (rp_presence & (1 << 0)) != 0 {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::RepeatedSingularMessage, rp_body.len() - rp_rest.len()).with_field(2));
}
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_2 = ::rapidproto::decode_value(|rp_out| crate::example::arena::weather::Location::rp_decode_into(rp_out, rp_p, rp_arena, rp_depth + 1))?;
rp_presence |= 1 << 0;
}
24u32 => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_3 = crate::example::common::weather::Unit(rp_v as i32);
}
37u32 => {
let mut rp_v = 0u32;
rp_rest = match ::rapidproto::wire::read_fixed32(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_acc_4.push(f32::from_bits(rp_v)).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
}
34u32 => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
if ::core::cfg!(target_endian = "little") && rp_p.len() % 4 == 0 {
rp_acc_4.extend_from_le_bytes(rp_p).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
} else {
rp_acc_4.reserve(rp_p.len() / 4).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
while !rp_p.is_empty() {
let mut rp_v = 0u32;
rp_p = match ::rapidproto::wire::read_fixed32(rp_p, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len() - rp_p.len())),
};
rp_acc_4.push(f32::from_bits(rp_v)).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
}
}
}
66u32 => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_field_8 = rp_p;
rp_presence |= 1 << 1;
}
42u32 => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_ent_body: &'a [u8] = rp_p;
let mut rp_key: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_val: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_ent: &'a [u8] = rp_ent_body;
loop {
let rp_b = match rp_ent.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_ent = &rp_ent[1..];
rp_b as u32
} else {
let mut rp_etag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_ent = match ::rapidproto::wire::read_tag(rp_ent, &mut rp_etag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
(rp_etag.field << 3) | rp_etag.wire as u32
};
match rp_tagkey {
10u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_key = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
18u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_val = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
_ => {
rp_ent = match ::rapidproto::wire::skip_field(rp_ent, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
}
}
}
rp_map_5.push((rp_key, rp_val)).map_err(|_| ::rapidproto::DecodeError::new(::rapidproto::ErrorKind::ArenaExhausted, 0))?;
}
50u32 => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_oneof_0 = ::core::option::Option::Some(crate::example::arena::weather::station::Status::Error(::rapidproto::ProtoStr::new_truncating(rp_p)));
}
56u32 => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_oneof_0 = ::core::option::Option::Some(crate::example::arena::weather::station::Status::UptimeSeconds(rp_v));
}
_ => {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
}
::core::result::Result::Ok(rp_out.write(Station {
name: ::rapidproto::ProtoStr::new_truncating(rp_field_1),
location: rp_field_2,
unit: rp_field_3,
temperatures: ::rapidproto::PackedSlice::new(rp_acc_4.into_slice()),
note: ::rapidproto::ProtoStr::new_truncating(rp_field_8),
rp_presence,
labels: ::rapidproto::MapView::new(rp_map_5.into_slice()),
status: rp_oneof_0,
}))
}
}
impl<'a> Report<'a> {
pub fn decode(input: &'a [u8], arena: &'a ::rapidproto::Arena<'a>) -> ::core::result::Result<&'a Report<'a>, ::rapidproto::DecodeError> {
if input.len() > u32::MAX as usize {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::InputTooLarge, 0));
}
let rp_root = arena.emplace(|rp_out| Self::rp_decode_into(rp_out, input, arena, 0))?;
::core::result::Result::Ok(&*rp_root)
}
#[inline(always)]
#[doc(hidden)]
pub(in crate::example::arena) fn rp_decode_into<'id>(rp_out: ::rapidproto::Slot<'id, Report<'a>>, rp_body: &'a [u8], rp_arena: &'a ::rapidproto::Arena<'a>, rp_depth: u32) -> ::core::result::Result<::rapidproto::Init<'id>, ::rapidproto::DecodeError> {
if rp_depth > ::rapidproto::MAX_DECODE_DEPTH {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::DepthLimitExceeded, 0));
}
let mut rp_acc_1 = ::rapidproto::DecodeVec::new(rp_arena);
let mut rp_rest: &'a [u8] = rp_body;
while rp_rest.first() == ::core::option::Option::Some(&10u8) {
rp_rest = &rp_rest[1..];
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_acc_1.emplace(|rp_out| crate::example::arena::weather::Station::rp_decode_into(rp_out, rp_p, rp_arena, rp_depth + 1))?;
}
loop {
let rp_b = match rp_rest.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_rest = &rp_rest[1..];
rp_b as u32
} else {
let mut rp_tag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_rest = match ::rapidproto::wire::read_tag(rp_rest, &mut rp_tag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
(rp_tag.field << 3) | rp_tag.wire as u32
};
match rp_tagkey {
10u32 => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
rp_acc_1.emplace(|rp_out| crate::example::arena::weather::Station::rp_decode_into(rp_out, rp_p, rp_arena, rp_depth + 1))?;
}
_ => {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
}
::core::result::Result::Ok(rp_out.write(Report {
stations: ::rapidproto::PackedSlice::new(rp_acc_1.into_slice()),
}))
}
}
}
}
#[allow(warnings, dead_code, unused_imports, unused_macros, unused_mut, unused_variables, nonstandard_style, unreachable_pub, single_use_lifetimes, unused_qualifications, clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)]
#[doc(hidden)]
pub use ::rapidproto::rp_rt;
#[allow(warnings, dead_code, unused_imports, unused_macros, unused_mut, unused_variables, nonstandard_style, unreachable_pub, single_use_lifetimes, unused_qualifications, clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)]
pub mod stream {
pub mod weather {
pub trait LocationVisitor<'a> {
const WANT_latitude: bool = false;
#[inline(always)]
fn on_latitude(&mut self, value: f64) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_longitude: bool = false;
#[inline(always)]
fn on_longitude(&mut self, value: f64) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_UNKNOWN: bool = false;
#[inline(always)]
fn on_unknown(&mut self, value: ::rapidproto::stream::UnknownField<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
}
#[derive(Clone, Copy)]
pub struct Location<'a> {
rp_input: &'a [u8],
}
impl ::core::fmt::Debug for Location<'_> {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
rp_f.debug_struct("Location").field("len", &self.rp_input.len()).finish()
}
}
impl<'a> Location<'a> {
#[inline(always)]
pub fn new(input: &'a [u8]) -> ::core::result::Result<Location<'a>, ::rapidproto::DecodeError> {
if input.len() > u32::MAX as usize {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::InputTooLarge, 0));
}
::core::result::Result::Ok(Location { rp_input: input })
}
#[inline(always)]
pub(in crate::example::stream) fn rp_new(rp_input: &'a [u8]) -> Location<'a> { Location { rp_input } }
#[inline(always)]
pub fn bytes(&self) -> &'a [u8] { self.rp_input }
pub fn decode<V: LocationVisitor<'a>>(self, mut visitor: V) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> {
let rp_body: &'a [u8] = self.rp_input;
let mut rp_rest: &'a [u8] = rp_body;
if rp_rest.first() == ::core::option::Option::Some(&9u8) {
rp_rest = &rp_rest[1..];
if V::WANT_latitude {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_latitude(f64::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 9u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&17u8) {
rp_rest = &rp_rest[1..];
if V::WANT_longitude {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_longitude(f64::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 17u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
loop {
let rp_b = match rp_rest.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_rest = &rp_rest[1..];
rp_b as u32
} else {
let mut rp_tag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_rest = match ::rapidproto::wire::read_tag(rp_rest, &mut rp_tag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
(rp_tag.field << 3) | rp_tag.wire as u32
};
match rp_tagkey {
9u32 if V::WANT_latitude => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_latitude(f64::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
17u32 if V::WANT_longitude => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_fixed64(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_longitude(f64::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
_ => {
if V::WANT_UNKNOWN && !::core::matches!(rp_tagkey >> 3, 1 | 2) {
let rp_before = rp_rest;
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_u = ::rapidproto::stream::UnknownField::new(rp_tagkey, &rp_before[..rp_before.len() - rp_rest.len()]);
match visitor.on_unknown(rp_u)? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
}
}
::core::result::Result::Ok(::rapidproto::stream::Flow::Continue)
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! __rp_7example_7weather8Location {
($($f:ident => $c:expr),* $(,)?) => { $crate::example::stream::weather::location_stream!(@f [[]] $($f => $c,)*) };
($s:expr; {$($f:ident => $c:expr),* $(,)?}) => { $crate::example::stream::weather::location_stream!(@f [[$s]] $($f => $c,)*) };
(@f [$($a:tt)*] latitude => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::location_stream!(@f [$($a)* WANT_latitude on_latitude: ::core::primitive::f64 = $c;] $($r)*) };
(@f [$($a:tt)*] longitude => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::location_stream!(@f [$($a)* WANT_longitude on_longitude: ::core::primitive::f64 = $c;] $($r)*) };
(@f [$($a:tt)*] unknown => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::location_stream!(@f [$($a)* WANT_UNKNOWN on_unknown: $crate::example::rp_rt::stream::UnknownField<'rp_a> = $c;] $($r)*) };
(@f $a:tt $bad:ident => $c:expr, $($r:tt)*) => { ::core::compile_error!(::core::concat!("unknown field `", ::core::stringify!($bad), "` for this message; selectable fields: latitude, longitude, unknown")) };
(@f $a:tt) => { $crate::example::rp_rt::stream_visitor!($crate::example::stream::weather::LocationVisitor<'rp_a> $a) };
}
#[doc(inline)]
pub use __rp_7example_7weather8Location as location_stream;
pub trait StationVisitor<'a> {
const WANT_name: bool = false;
#[inline(always)]
fn on_name(&mut self, value: ::rapidproto::ProtoStr<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_location: bool = false;
#[inline(always)]
fn on_location(&mut self, value: crate::example::stream::weather::Location<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_unit: bool = false;
#[inline(always)]
fn on_unit(&mut self, value: crate::example::common::weather::Unit) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_temperatures: bool = false;
#[inline(always)]
fn on_temperatures(&mut self, value: f32) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_note: bool = false;
#[inline(always)]
fn on_note(&mut self, value: ::rapidproto::ProtoStr<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_labels: bool = false;
#[inline(always)]
fn on_labels(&mut self, value: (::rapidproto::ProtoStr<'a>, ::rapidproto::ProtoStr<'a>)) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_error: bool = false;
#[inline(always)]
fn on_error(&mut self, value: ::rapidproto::ProtoStr<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_uptime_seconds: bool = false;
#[inline(always)]
fn on_uptime_seconds(&mut self, value: u64) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_UNKNOWN: bool = false;
#[inline(always)]
fn on_unknown(&mut self, value: ::rapidproto::stream::UnknownField<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
}
#[derive(Clone, Copy)]
pub struct Station<'a> {
rp_input: &'a [u8],
}
impl ::core::fmt::Debug for Station<'_> {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
rp_f.debug_struct("Station").field("len", &self.rp_input.len()).finish()
}
}
impl<'a> Station<'a> {
#[inline(always)]
pub fn new(input: &'a [u8]) -> ::core::result::Result<Station<'a>, ::rapidproto::DecodeError> {
if input.len() > u32::MAX as usize {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::InputTooLarge, 0));
}
::core::result::Result::Ok(Station { rp_input: input })
}
#[inline(always)]
pub(in crate::example::stream) fn rp_new(rp_input: &'a [u8]) -> Station<'a> { Station { rp_input } }
#[inline(always)]
pub fn bytes(&self) -> &'a [u8] { self.rp_input }
pub fn decode<V: StationVisitor<'a>>(self, mut visitor: V) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> {
let rp_body: &'a [u8] = self.rp_input;
let mut rp_rest: &'a [u8] = rp_body;
if rp_rest.first() == ::core::option::Option::Some(&10u8) {
rp_rest = &rp_rest[1..];
if V::WANT_name {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_name(::rapidproto::ProtoStr::new_truncating(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 10u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&18u8) {
rp_rest = &rp_rest[1..];
if V::WANT_location {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_location(crate::example::stream::weather::Location::rp_new(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 18u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&24u8) {
rp_rest = &rp_rest[1..];
if V::WANT_unit {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint_inline(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_unit(crate::example::common::weather::Unit(rp_v as i32))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 24u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
while rp_rest.first() == ::core::option::Option::Some(&37u8) {
rp_rest = &rp_rest[1..];
if V::WANT_temperatures {
let mut rp_v = 0u32;
rp_rest = match ::rapidproto::wire::read_fixed32(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_temperatures(f32::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 37u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&34u8) {
rp_rest = &rp_rest[1..];
if V::WANT_temperatures {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
while !rp_p.is_empty() {
let mut rp_v = 0u32;
rp_p = match ::rapidproto::wire::read_fixed32(rp_p, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len() - rp_p.len())),
};
match visitor.on_temperatures(f32::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 34u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
while rp_rest.first() == ::core::option::Option::Some(&42u8) {
rp_rest = &rp_rest[1..];
if V::WANT_labels {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_ent_body: &'a [u8] = rp_p;
let mut rp_key: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_val: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_ent: &'a [u8] = rp_ent_body;
loop {
let rp_b = match rp_ent.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_ent = &rp_ent[1..];
rp_b as u32
} else {
let mut rp_etag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_ent = match ::rapidproto::wire::read_tag(rp_ent, &mut rp_etag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
(rp_etag.field << 3) | rp_etag.wire as u32
};
match rp_tagkey {
10u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_key = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
18u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_val = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
_ => {
rp_ent = match ::rapidproto::wire::skip_field(rp_ent, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
}
}
}
match visitor.on_labels((rp_key, rp_val))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 42u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&50u8) {
rp_rest = &rp_rest[1..];
if V::WANT_error {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_error(::rapidproto::ProtoStr::new_truncating(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 50u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&56u8) {
rp_rest = &rp_rest[1..];
if V::WANT_uptime_seconds {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint_inline(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_uptime_seconds(rp_v)? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 56u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
if rp_rest.first() == ::core::option::Option::Some(&66u8) {
rp_rest = &rp_rest[1..];
if V::WANT_note {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_note(::rapidproto::ProtoStr::new_truncating(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 66u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
loop {
let rp_b = match rp_rest.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_rest = &rp_rest[1..];
rp_b as u32
} else {
let mut rp_tag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_rest = match ::rapidproto::wire::read_tag(rp_rest, &mut rp_tag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
(rp_tag.field << 3) | rp_tag.wire as u32
};
match rp_tagkey {
10u32 if V::WANT_name => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_name(::rapidproto::ProtoStr::new_truncating(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
18u32 if V::WANT_location => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_location(crate::example::stream::weather::Location::rp_new(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
24u32 if V::WANT_unit => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint_inline(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_unit(crate::example::common::weather::Unit(rp_v as i32))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
37u32 if V::WANT_temperatures => {
let mut rp_v = 0u32;
rp_rest = match ::rapidproto::wire::read_fixed32(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_temperatures(f32::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
34u32 if V::WANT_temperatures => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
while !rp_p.is_empty() {
let mut rp_v = 0u32;
rp_p = match ::rapidproto::wire::read_fixed32(rp_p, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len() - rp_p.len())),
};
match visitor.on_temperatures(f32::from_bits(rp_v))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
}
66u32 if V::WANT_note => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_note(::rapidproto::ProtoStr::new_truncating(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
42u32 if V::WANT_labels => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_ent_body: &'a [u8] = rp_p;
let mut rp_key: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_val: ::rapidproto::ProtoStr<'a> = ::core::default::Default::default();
let mut rp_ent: &'a [u8] = rp_ent_body;
loop {
let rp_b = match rp_ent.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_ent = &rp_ent[1..];
rp_b as u32
} else {
let mut rp_etag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_ent = match ::rapidproto::wire::read_tag(rp_ent, &mut rp_etag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
(rp_etag.field << 3) | rp_etag.wire as u32
};
match rp_tagkey {
10u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_key = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
18u32 => {
let mut rp_p: &[u8] = &[];
rp_ent = match ::rapidproto::wire::read_length_delimited(rp_ent, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
rp_val = ::rapidproto::ProtoStr::new_truncating(rp_p);
}
_ => {
rp_ent = match ::rapidproto::wire::skip_field(rp_ent, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_ent_body.len() - rp_ent.len())),
};
}
}
}
match visitor.on_labels((rp_key, rp_val))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
50u32 if V::WANT_error => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_error(::rapidproto::ProtoStr::new_truncating(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
56u32 if V::WANT_uptime_seconds => {
let mut rp_v = 0u64;
rp_rest = match ::rapidproto::wire::read_varint_inline(rp_rest, &mut rp_v) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_uptime_seconds(rp_v)? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
_ => {
if V::WANT_UNKNOWN && !::core::matches!(rp_tagkey >> 3, 1 | 2 | 3 | 4 | 8 | 6 | 7 | 5) {
let rp_before = rp_rest;
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_u = ::rapidproto::stream::UnknownField::new(rp_tagkey, &rp_before[..rp_before.len() - rp_rest.len()]);
match visitor.on_unknown(rp_u)? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
}
}
::core::result::Result::Ok(::rapidproto::stream::Flow::Continue)
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! __rp_7example_7weather7Station {
($($f:ident => $c:expr),* $(,)?) => { $crate::example::stream::weather::station_stream!(@f [[]] $($f => $c,)*) };
($s:expr; {$($f:ident => $c:expr),* $(,)?}) => { $crate::example::stream::weather::station_stream!(@f [[$s]] $($f => $c,)*) };
(@f [$($a:tt)*] name => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_name on_name: $crate::example::rp_rt::ProtoStr<'rp_a> = $c;] $($r)*) };
(@f [$($a:tt)*] location => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_location on_location: $crate::example::stream::weather::Location<'rp_a> = $c;] $($r)*) };
(@f [$($a:tt)*] unit => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_unit on_unit: $crate::example::common::weather::Unit = $c;] $($r)*) };
(@f [$($a:tt)*] temperatures => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_temperatures on_temperatures: ::core::primitive::f32 = $c;] $($r)*) };
(@f [$($a:tt)*] note => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_note on_note: $crate::example::rp_rt::ProtoStr<'rp_a> = $c;] $($r)*) };
(@f [$($a:tt)*] labels => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_labels on_labels: ($crate::example::rp_rt::ProtoStr<'rp_a>, $crate::example::rp_rt::ProtoStr<'rp_a>) = $c;] $($r)*) };
(@f [$($a:tt)*] error => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_error on_error: $crate::example::rp_rt::ProtoStr<'rp_a> = $c;] $($r)*) };
(@f [$($a:tt)*] uptime_seconds => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_uptime_seconds on_uptime_seconds: ::core::primitive::u64 = $c;] $($r)*) };
(@f [$($a:tt)*] unknown => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::station_stream!(@f [$($a)* WANT_UNKNOWN on_unknown: $crate::example::rp_rt::stream::UnknownField<'rp_a> = $c;] $($r)*) };
(@f $a:tt $bad:ident => $c:expr, $($r:tt)*) => { ::core::compile_error!(::core::concat!("unknown field `", ::core::stringify!($bad), "` for this message; selectable fields: name, location, unit, temperatures, note, labels, error, uptime_seconds, unknown")) };
(@f $a:tt) => { $crate::example::rp_rt::stream_visitor!($crate::example::stream::weather::StationVisitor<'rp_a> $a) };
}
#[doc(inline)]
pub use __rp_7example_7weather7Station as station_stream;
pub trait ReportVisitor<'a> {
const WANT_stations: bool = false;
#[inline(always)]
fn on_stations(&mut self, value: crate::example::stream::weather::Station<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
const WANT_UNKNOWN: bool = false;
#[inline(always)]
fn on_unknown(&mut self, value: ::rapidproto::stream::UnknownField<'a>) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> { ::core::result::Result::Ok(::rapidproto::stream::Flow::Continue) }
}
#[derive(Clone, Copy)]
pub struct Report<'a> {
rp_input: &'a [u8],
}
impl ::core::fmt::Debug for Report<'_> {
fn fmt(&self, rp_f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
rp_f.debug_struct("Report").field("len", &self.rp_input.len()).finish()
}
}
impl<'a> Report<'a> {
#[inline(always)]
pub fn new(input: &'a [u8]) -> ::core::result::Result<Report<'a>, ::rapidproto::DecodeError> {
if input.len() > u32::MAX as usize {
return ::core::result::Result::Err(::rapidproto::DecodeError::new(::rapidproto::ErrorKind::InputTooLarge, 0));
}
::core::result::Result::Ok(Report { rp_input: input })
}
#[inline(always)]
pub(in crate::example::stream) fn rp_new(rp_input: &'a [u8]) -> Report<'a> { Report { rp_input } }
#[inline(always)]
pub fn bytes(&self) -> &'a [u8] { self.rp_input }
pub fn decode<V: ReportVisitor<'a>>(self, mut visitor: V) -> ::core::result::Result<::rapidproto::stream::Flow, ::rapidproto::DecodeError> {
let rp_body: &'a [u8] = self.rp_input;
let mut rp_rest: &'a [u8] = rp_body;
while rp_rest.first() == ::core::option::Option::Some(&10u8) {
rp_rest = &rp_rest[1..];
if V::WANT_stations {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_stations(crate::example::stream::weather::Station::rp_new(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, 10u32) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
loop {
let rp_b = match rp_rest.first() {
::core::option::Option::Some(&rp_b) => rp_b,
::core::option::Option::None => break,
};
let rp_tagkey: u32 = if rp_b < 0x80 {
rp_rest = &rp_rest[1..];
rp_b as u32
} else {
let mut rp_tag = ::rapidproto::wire::Tag { field: 0, wire: ::rapidproto::wire::WireType::Varint };
rp_rest = match ::rapidproto::wire::read_tag(rp_rest, &mut rp_tag) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
(rp_tag.field << 3) | rp_tag.wire as u32
};
match rp_tagkey {
10u32 if V::WANT_stations => {
let mut rp_p: &[u8] = &[];
rp_rest = match ::rapidproto::wire::read_length_delimited(rp_rest, &mut rp_p) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
match visitor.on_stations(crate::example::stream::weather::Station::rp_new(rp_p))? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
}
_ => {
if V::WANT_UNKNOWN && !::core::matches!(rp_tagkey >> 3, 1) {
let rp_before = rp_rest;
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
let rp_u = ::rapidproto::stream::UnknownField::new(rp_tagkey, &rp_before[..rp_before.len() - rp_rest.len()]);
match visitor.on_unknown(rp_u)? {
::rapidproto::stream::Flow::Stop => return ::core::result::Result::Ok(::rapidproto::stream::Flow::Stop),
::rapidproto::stream::Flow::Continue => {}
}
} else {
rp_rest = match ::rapidproto::wire::skip_field(rp_rest, rp_tagkey) {
::core::result::Result::Ok(r) => r,
::core::result::Result::Err(k) => return ::core::result::Result::Err(::rapidproto::DecodeError::new(k, rp_body.len() - rp_rest.len())),
};
}
}
}
}
::core::result::Result::Ok(::rapidproto::stream::Flow::Continue)
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! __rp_7example_7weather6Report {
($($f:ident => $c:expr),* $(,)?) => { $crate::example::stream::weather::report_stream!(@f [[]] $($f => $c,)*) };
($s:expr; {$($f:ident => $c:expr),* $(,)?}) => { $crate::example::stream::weather::report_stream!(@f [[$s]] $($f => $c,)*) };
(@f [$($a:tt)*] stations => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::report_stream!(@f [$($a)* WANT_stations on_stations: $crate::example::stream::weather::Station<'rp_a> = $c;] $($r)*) };
(@f [$($a:tt)*] unknown => $c:expr, $($r:tt)*) => { $crate::example::stream::weather::report_stream!(@f [$($a)* WANT_UNKNOWN on_unknown: $crate::example::rp_rt::stream::UnknownField<'rp_a> = $c;] $($r)*) };
(@f $a:tt $bad:ident => $c:expr, $($r:tt)*) => { ::core::compile_error!(::core::concat!("unknown field `", ::core::stringify!($bad), "` for this message; selectable fields: stations, unknown")) };
(@f $a:tt) => { $crate::example::rp_rt::stream_visitor!($crate::example::stream::weather::ReportVisitor<'rp_a> $a) };
}
#[doc(inline)]
pub use __rp_7example_7weather6Report as report_stream;
}
}