vinyl-core 0.0.2

A convenience layer for the FoundationDB Record Layer
Documentation
// This file is generated by rust-protobuf 2.8.1. Do not edit
// @generated

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

#![cfg_attr(rustfmt, 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(unsafe_code)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `example.proto`

use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;

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

#[derive(PartialEq,Clone,Default)]
pub struct Order {
    // message fields
    pub order_id: i64,
    pub flower: ::protobuf::SingularPtrField<Flower>,
    pub price: i32,
    // special fields
    pub unknown_fields: ::protobuf::UnknownFields,
    pub cached_size: ::protobuf::CachedSize,
}

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

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

    // int64 order_id = 1;


    pub fn get_order_id(&self) -> i64 {
        self.order_id
    }
    pub fn clear_order_id(&mut self) {
        self.order_id = 0;
    }

    // Param is passed by value, moved
    pub fn set_order_id(&mut self, v: i64) {
        self.order_id = v;
    }

    // .Flower flower = 2;


    pub fn get_flower(&self) -> &Flower {
        self.flower.as_ref().unwrap_or_else(|| Flower::default_instance())
    }
    pub fn clear_flower(&mut self) {
        self.flower.clear();
    }

    pub fn has_flower(&self) -> bool {
        self.flower.is_some()
    }

    // Param is passed by value, moved
    pub fn set_flower(&mut self, v: Flower) {
        self.flower = ::protobuf::SingularPtrField::some(v);
    }

    // Mutable pointer to the field.
    // If field is not initialized, it is initialized with default value first.
    pub fn mut_flower(&mut self) -> &mut Flower {
        if self.flower.is_none() {
            self.flower.set_default();
        }
        self.flower.as_mut().unwrap()
    }

    // Take field
    pub fn take_flower(&mut self) -> Flower {
        self.flower.take().unwrap_or_else(|| Flower::new())
    }

    // int32 price = 3;


    pub fn get_price(&self) -> i32 {
        self.price
    }
    pub fn clear_price(&mut self) {
        self.price = 0;
    }

    // Param is passed by value, moved
    pub fn set_price(&mut self, v: i32) {
        self.price = v;
    }
}

impl ::protobuf::Message for Order {
    fn is_initialized(&self) -> bool {
        for v in &self.flower {
            if !v.is_initialized() {
                return false;
            }
        };
        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::WireTypeVarint {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    let tmp = is.read_int64()?;
                    self.order_id = tmp;
                },
                2 => {
                    ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.flower)?;
                },
                3 => {
                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    let tmp = is.read_int32()?;
                    self.price = tmp;
                },
                _ => {
                    ::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 self.order_id != 0 {
            my_size += ::protobuf::rt::value_size(1, self.order_id, ::protobuf::wire_format::WireTypeVarint);
        }
        if let Some(ref v) = self.flower.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
        }
        if self.price != 0 {
            my_size += ::protobuf::rt::value_size(3, self.price, ::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 self.order_id != 0 {
            os.write_int64(1, self.order_id)?;
        }
        if let Some(ref v) = self.flower.as_ref() {
            os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
            os.write_raw_varint32(v.get_cached_size())?;
            v.write_to_with_cached_sizes(os)?;
        }
        if self.price != 0 {
            os.write_int32(3, self.price)?;
        }
        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: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
        self
    }

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

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

    fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
            lock: ::protobuf::lazy::ONCE_INIT,
            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
        };
        unsafe {
            descriptor.get(|| {
                let mut fields = ::std::vec::Vec::new();
                fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
                    "order_id",
                    |m: &Order| { &m.order_id },
                    |m: &mut Order| { &mut m.order_id },
                ));
                fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Flower>>(
                    "flower",
                    |m: &Order| { &m.flower },
                    |m: &mut Order| { &mut m.flower },
                ));
                fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
                    "price",
                    |m: &Order| { &m.price },
                    |m: &mut Order| { &mut m.price },
                ));
                ::protobuf::reflect::MessageDescriptor::new::<Order>(
                    "Order",
                    fields,
                    file_descriptor_proto()
                )
            })
        }
    }

    fn default_instance() -> &'static Order {
        static mut instance: ::protobuf::lazy::Lazy<Order> = ::protobuf::lazy::Lazy {
            lock: ::protobuf::lazy::ONCE_INIT,
            ptr: 0 as *const Order,
        };
        unsafe {
            instance.get(Order::new)
        }
    }
}

impl ::protobuf::Clear for Order {
    fn clear(&mut self) {
        self.order_id = 0;
        self.flower.clear();
        self.price = 0;
        self.unknown_fields.clear();
    }
}

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

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

#[derive(PartialEq,Clone,Default)]
pub struct Flower {
    // message fields
    pub field_type: ::std::string::String,
    pub color: Color,
    // special fields
    pub unknown_fields: ::protobuf::UnknownFields,
    pub cached_size: ::protobuf::CachedSize,
}

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

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

    // string type = 1;


    pub fn get_field_type(&self) -> &str {
        &self.field_type
    }
    pub fn clear_field_type(&mut self) {
        self.field_type.clear();
    }

    // Param is passed by value, moved
    pub fn set_field_type(&mut self, v: ::std::string::String) {
        self.field_type = v;
    }

    // Mutable pointer to the field.
    // If field is not initialized, it is initialized with default value first.
    pub fn mut_field_type(&mut self) -> &mut ::std::string::String {
        &mut self.field_type
    }

    // Take field
    pub fn take_field_type(&mut self) -> ::std::string::String {
        ::std::mem::replace(&mut self.field_type, ::std::string::String::new())
    }

    // .Color color = 2;


    pub fn get_color(&self) -> Color {
        self.color
    }
    pub fn clear_color(&mut self) {
        self.color = Color::RED;
    }

    // Param is passed by value, moved
    pub fn set_color(&mut self, v: Color) {
        self.color = v;
    }
}

impl ::protobuf::Message for Flower {
    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 => {
                    ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?;
                },
                2 => {
                    ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.color, 2, &mut self.unknown_fields)?
                },
                _ => {
                    ::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 !self.field_type.is_empty() {
            my_size += ::protobuf::rt::string_size(1, &self.field_type);
        }
        if self.color != Color::RED {
            my_size += ::protobuf::rt::enum_size(2, self.color);
        }
        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 !self.field_type.is_empty() {
            os.write_string(1, &self.field_type)?;
        }
        if self.color != Color::RED {
            os.write_enum(2, self.color.value())?;
        }
        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: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
        self
    }

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

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

    fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
            lock: ::protobuf::lazy::ONCE_INIT,
            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
        };
        unsafe {
            descriptor.get(|| {
                let mut fields = ::std::vec::Vec::new();
                fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
                    "type",
                    |m: &Flower| { &m.field_type },
                    |m: &mut Flower| { &mut m.field_type },
                ));
                fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<Color>>(
                    "color",
                    |m: &Flower| { &m.color },
                    |m: &mut Flower| { &mut m.color },
                ));
                ::protobuf::reflect::MessageDescriptor::new::<Flower>(
                    "Flower",
                    fields,
                    file_descriptor_proto()
                )
            })
        }
    }

    fn default_instance() -> &'static Flower {
        static mut instance: ::protobuf::lazy::Lazy<Flower> = ::protobuf::lazy::Lazy {
            lock: ::protobuf::lazy::ONCE_INIT,
            ptr: 0 as *const Flower,
        };
        unsafe {
            instance.get(Flower::new)
        }
    }
}

impl ::protobuf::Clear for Flower {
    fn clear(&mut self) {
        self.field_type.clear();
        self.color = Color::RED;
        self.unknown_fields.clear();
    }
}

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

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

#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum Color {
    RED = 0,
    BLUE = 1,
    YELLOW = 2,
    PINK = 3,
}

impl ::protobuf::ProtobufEnum for Color {
    fn value(&self) -> i32 {
        *self as i32
    }

    fn from_i32(value: i32) -> ::std::option::Option<Color> {
        match value {
            0 => ::std::option::Option::Some(Color::RED),
            1 => ::std::option::Option::Some(Color::BLUE),
            2 => ::std::option::Option::Some(Color::YELLOW),
            3 => ::std::option::Option::Some(Color::PINK),
            _ => ::std::option::Option::None
        }
    }

    fn values() -> &'static [Self] {
        static values: &'static [Color] = &[
            Color::RED,
            Color::BLUE,
            Color::YELLOW,
            Color::PINK,
        ];
        values
    }

    fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy {
            lock: ::protobuf::lazy::ONCE_INIT,
            ptr: 0 as *const ::protobuf::reflect::EnumDescriptor,
        };
        unsafe {
            descriptor.get(|| {
                ::protobuf::reflect::EnumDescriptor::new("Color", file_descriptor_proto())
            })
        }
    }
}

impl ::std::marker::Copy for Color {
}

impl ::std::default::Default for Color {
    fn default() -> Self {
        Color::RED
    }
}

impl ::protobuf::reflect::ProtobufValue for Color {
    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
        ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
    }
}

static file_descriptor_proto_data: &'static [u8] = b"\
    \n\rexample.proto\"Y\n\x05Order\x12\x19\n\x08order_id\x18\x01\x20\x01(\
    \x03R\x07orderId\x12\x1f\n\x06flower\x18\x02\x20\x01(\x0b2\x07.FlowerR\
    \x06flower\x12\x14\n\x05price\x18\x03\x20\x01(\x05R\x05price\":\n\x06Flo\
    wer\x12\x12\n\x04type\x18\x01\x20\x01(\tR\x04type\x12\x1c\n\x05color\x18\
    \x02\x20\x01(\x0e2\x06.ColorR\x05color*0\n\x05Color\x12\x07\n\x03RED\x10\
    \0\x12\x08\n\x04BLUE\x10\x01\x12\n\n\x06YELLOW\x10\x02\x12\x08\n\x04PINK\
    \x10\x03b\x06proto3\
";

static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
    lock: ::protobuf::lazy::ONCE_INIT,
    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
};

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 {
    unsafe {
        file_descriptor_proto_lazy.get(|| {
            parse_descriptor_proto()
        })
    }
}