async-rust 0.1.1

async rust examples
// This file is generated by rust-protobuf 2.18.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]

#![allow(unused_attributes)]
#![rustfmt::skip]

#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `message.proto`

/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_18_0;

#[derive(PartialEq,Clone,Default)]
pub struct Frame {
    // message oneof groups
    pub Event: ::std::option::Option<Frame_oneof_Event>,
    // special fields
    pub unknown_fields: ::protobuf::UnknownFields,
    pub cached_size: ::protobuf::CachedSize,
}

impl<'a> ::std::default::Default for &'a Frame {
    fn default() -> &'a Frame {
        <Frame as ::protobuf::Message>::default_instance()
    }
}

#[derive(Clone,PartialEq,Debug)]
pub enum Frame_oneof_Event {
    o(::std::vec::Vec<u8>),
    i(::std::vec::Vec<u8>),
    r(u32),
}

impl Frame {
    pub fn new() -> Frame {
        ::std::default::Default::default()
    }

    // bytes o = 1;


    pub fn get_o(&self) -> &[u8] {
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::o(ref v)) => v,
            _ => &[],
        }
    }
    pub fn clear_o(&mut self) {
        self.Event = ::std::option::Option::None;
    }

    pub fn has_o(&self) -> bool {
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::o(..)) => true,
            _ => false,
        }
    }

    // Param is passed by value, moved
    pub fn set_o(&mut self, v: ::std::vec::Vec<u8>) {
        self.Event = ::std::option::Option::Some(Frame_oneof_Event::o(v))
    }

    // Mutable pointer to the field.
    pub fn mut_o(&mut self) -> &mut ::std::vec::Vec<u8> {
        if let ::std::option::Option::Some(Frame_oneof_Event::o(_)) = self.Event {
        } else {
            self.Event = ::std::option::Option::Some(Frame_oneof_Event::o(::std::vec::Vec::new()));
        }
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::o(ref mut v)) => v,
            _ => panic!(),
        }
    }

    // Take field
    pub fn take_o(&mut self) -> ::std::vec::Vec<u8> {
        if self.has_o() {
            match self.Event.take() {
                ::std::option::Option::Some(Frame_oneof_Event::o(v)) => v,
                _ => panic!(),
            }
        } else {
            ::std::vec::Vec::new()
        }
    }

    // bytes i = 2;


    pub fn get_i(&self) -> &[u8] {
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::i(ref v)) => v,
            _ => &[],
        }
    }
    pub fn clear_i(&mut self) {
        self.Event = ::std::option::Option::None;
    }

    pub fn has_i(&self) -> bool {
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::i(..)) => true,
            _ => false,
        }
    }

    // Param is passed by value, moved
    pub fn set_i(&mut self, v: ::std::vec::Vec<u8>) {
        self.Event = ::std::option::Option::Some(Frame_oneof_Event::i(v))
    }

    // Mutable pointer to the field.
    pub fn mut_i(&mut self) -> &mut ::std::vec::Vec<u8> {
        if let ::std::option::Option::Some(Frame_oneof_Event::i(_)) = self.Event {
        } else {
            self.Event = ::std::option::Option::Some(Frame_oneof_Event::i(::std::vec::Vec::new()));
        }
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::i(ref mut v)) => v,
            _ => panic!(),
        }
    }

    // Take field
    pub fn take_i(&mut self) -> ::std::vec::Vec<u8> {
        if self.has_i() {
            match self.Event.take() {
                ::std::option::Option::Some(Frame_oneof_Event::i(v)) => v,
                _ => panic!(),
            }
        } else {
            ::std::vec::Vec::new()
        }
    }

    // uint32 r = 3;


    pub fn get_r(&self) -> u32 {
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::r(v)) => v,
            _ => 0,
        }
    }
    pub fn clear_r(&mut self) {
        self.Event = ::std::option::Option::None;
    }

    pub fn has_r(&self) -> bool {
        match self.Event {
            ::std::option::Option::Some(Frame_oneof_Event::r(..)) => true,
            _ => false,
        }
    }

    // Param is passed by value, moved
    pub fn set_r(&mut self, v: u32) {
        self.Event = ::std::option::Option::Some(Frame_oneof_Event::r(v))
    }
}

impl ::protobuf::Message for Frame {
    fn is_initialized(&self) -> bool {
        true
    }

    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
        while !is.eof()? {
            let (field_number, wire_type) = is.read_tag_unpack()?;
            match field_number {
                1 => {
                    if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    self.Event = ::std::option::Option::Some(Frame_oneof_Event::o(is.read_bytes()?));
                },
                2 => {
                    if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    self.Event = ::std::option::Option::Some(Frame_oneof_Event::i(is.read_bytes()?));
                },
                3 => {
                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    self.Event = ::std::option::Option::Some(Frame_oneof_Event::r(is.read_uint32()?));
                },
                _ => {
                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
                },
            };
        }
        ::std::result::Result::Ok(())
    }

    // Compute sizes of nested messages
    #[allow(unused_variables)]
    fn compute_size(&self) -> u32 {
        let mut my_size = 0;
        if let ::std::option::Option::Some(ref v) = self.Event {
            match v {
                &Frame_oneof_Event::o(ref v) => {
                    my_size += ::protobuf::rt::bytes_size(1, &v);
                },
                &Frame_oneof_Event::i(ref v) => {
                    my_size += ::protobuf::rt::bytes_size(2, &v);
                },
                &Frame_oneof_Event::r(v) => {
                    my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
                },
            };
        }
        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
        self.cached_size.set(my_size);
        my_size
    }

    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
        if let ::std::option::Option::Some(ref v) = self.Event {
            match v {
                &Frame_oneof_Event::o(ref v) => {
                    os.write_bytes(1, v)?;
                },
                &Frame_oneof_Event::i(ref v) => {
                    os.write_bytes(2, v)?;
                },
                &Frame_oneof_Event::r(v) => {
                    os.write_uint32(3, v)?;
                },
            };
        }
        os.write_unknown_fields(self.get_unknown_fields())?;
        ::std::result::Result::Ok(())
    }

    fn get_cached_size(&self) -> u32 {
        self.cached_size.get()
    }

    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
        &self.unknown_fields
    }

    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
        &mut self.unknown_fields
    }

    fn as_any(&self) -> &dyn (::std::any::Any) {
        self as &dyn (::std::any::Any)
    }
    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
        self as &mut dyn (::std::any::Any)
    }
    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
        self
    }

    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
        Self::descriptor_static()
    }

    fn new() -> Frame {
        Frame::new()
    }

    fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
        static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
        descriptor.get(|| {
            let mut fields = ::std::vec::Vec::new();
            fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>(
                "o",
                Frame::has_o,
                Frame::get_o,
            ));
            fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>(
                "i",
                Frame::has_i,
                Frame::get_i,
            ));
            fields.push(::protobuf::reflect::accessor::make_singular_u32_accessor::<_>(
                "r",
                Frame::has_r,
                Frame::get_r,
            ));
            ::protobuf::reflect::MessageDescriptor::new_pb_name::<Frame>(
                "Frame",
                fields,
                file_descriptor_proto()
            )
        })
    }

    fn default_instance() -> &'static Frame {
        static instance: ::protobuf::rt::LazyV2<Frame> = ::protobuf::rt::LazyV2::INIT;
        instance.get(Frame::new)
    }
}

impl ::protobuf::Clear for Frame {
    fn clear(&mut self) {
        self.Event = ::std::option::Option::None;
        self.Event = ::std::option::Option::None;
        self.Event = ::std::option::Option::None;
        self.unknown_fields.clear();
    }
}

impl ::std::fmt::Debug for Frame {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        ::protobuf::text_format::fmt(self, f)
    }
}

impl ::protobuf::reflect::ProtobufValue for Frame {
    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
        ::protobuf::reflect::ReflectValueRef::Message(self)
    }
}

static file_descriptor_proto_data: &'static [u8] = b"\
    \n\rmessage.proto\x12\x04main\"@\n\x05Frame\x12\x0e\n\x01o\x18\x01\x20\
    \x01(\x0cH\0R\x01o\x12\x0e\n\x01i\x18\x02\x20\x01(\x0cH\0R\x01i\x12\x0e\
    \n\x01r\x18\x03\x20\x01(\rH\0R\x01rB\x07\n\x05EventB\x08Z\x06.;mainb\x06\
    proto3\
";

static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
}

pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
    file_descriptor_proto_lazy.get(|| {
        parse_descriptor_proto()
    })
}