tensorflow-protos-rs 0.2.0

Protobuf codegen crate for tensorflow
Documentation
// This file is generated by rust-protobuf 2.17.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 `tensorflow/core/framework/tensor_slice.proto`

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

#[derive(PartialEq,Clone,Default)]
pub struct TensorSliceProto {
    // message fields
    pub extent: ::protobuf::RepeatedField<TensorSliceProto_Extent>,
    // special fields
    pub unknown_fields: ::protobuf::UnknownFields,
    pub cached_size: ::protobuf::CachedSize,
}

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

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

    // repeated .tensorflow.TensorSliceProto.Extent extent = 1;


    pub fn get_extent(&self) -> &[TensorSliceProto_Extent] {
        &self.extent
    }
    pub fn clear_extent(&mut self) {
        self.extent.clear();
    }

    // Param is passed by value, moved
    pub fn set_extent(&mut self, v: ::protobuf::RepeatedField<TensorSliceProto_Extent>) {
        self.extent = v;
    }

    // Mutable pointer to the field.
    pub fn mut_extent(&mut self) -> &mut ::protobuf::RepeatedField<TensorSliceProto_Extent> {
        &mut self.extent
    }

    // Take field
    pub fn take_extent(&mut self) -> ::protobuf::RepeatedField<TensorSliceProto_Extent> {
        ::std::mem::replace(&mut self.extent, ::protobuf::RepeatedField::new())
    }
}

impl ::protobuf::Message for TensorSliceProto {
    fn is_initialized(&self) -> bool {
        for v in &self.extent {
            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 => {
                    ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.extent)?;
                },
                _ => {
                    ::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;
        for value in &self.extent {
            let len = value.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
        };
        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<()> {
        for v in &self.extent {
            os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
            os.write_raw_varint32(v.get_cached_size())?;
            v.write_to_with_cached_sizes(os)?;
        };
        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() -> TensorSliceProto {
        TensorSliceProto::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_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<TensorSliceProto_Extent>>(
                "extent",
                |m: &TensorSliceProto| { &m.extent },
                |m: &mut TensorSliceProto| { &mut m.extent },
            ));
            ::protobuf::reflect::MessageDescriptor::new_pb_name::<TensorSliceProto>(
                "TensorSliceProto",
                fields,
                file_descriptor_proto()
            )
        })
    }

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

impl ::protobuf::Clear for TensorSliceProto {
    fn clear(&mut self) {
        self.extent.clear();
        self.unknown_fields.clear();
    }
}

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

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

#[derive(PartialEq,Clone,Default)]
pub struct TensorSliceProto_Extent {
    // message fields
    pub start: i64,
    // message oneof groups
    pub has_length: ::std::option::Option<TensorSliceProto_Extent_oneof_has_length>,
    // special fields
    pub unknown_fields: ::protobuf::UnknownFields,
    pub cached_size: ::protobuf::CachedSize,
}

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

#[derive(Clone,PartialEq,Debug)]
pub enum TensorSliceProto_Extent_oneof_has_length {
    length(i64),
}

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

    // int64 start = 1;


    pub fn get_start(&self) -> i64 {
        self.start
    }
    pub fn clear_start(&mut self) {
        self.start = 0;
    }

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

    // int64 length = 2;


    pub fn get_length(&self) -> i64 {
        match self.has_length {
            ::std::option::Option::Some(TensorSliceProto_Extent_oneof_has_length::length(v)) => v,
            _ => 0,
        }
    }
    pub fn clear_length(&mut self) {
        self.has_length = ::std::option::Option::None;
    }

    pub fn has_length(&self) -> bool {
        match self.has_length {
            ::std::option::Option::Some(TensorSliceProto_Extent_oneof_has_length::length(..)) => true,
            _ => false,
        }
    }

    // Param is passed by value, moved
    pub fn set_length(&mut self, v: i64) {
        self.has_length = ::std::option::Option::Some(TensorSliceProto_Extent_oneof_has_length::length(v))
    }
}

impl ::protobuf::Message for TensorSliceProto_Extent {
    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::WireTypeVarint {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    let tmp = is.read_int64()?;
                    self.start = tmp;
                },
                2 => {
                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                    }
                    self.has_length = ::std::option::Option::Some(TensorSliceProto_Extent_oneof_has_length::length(is.read_int64()?));
                },
                _ => {
                    ::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.start != 0 {
            my_size += ::protobuf::rt::value_size(1, self.start, ::protobuf::wire_format::WireTypeVarint);
        }
        if let ::std::option::Option::Some(ref v) = self.has_length {
            match v {
                &TensorSliceProto_Extent_oneof_has_length::length(v) => {
                    my_size += ::protobuf::rt::value_size(2, 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 self.start != 0 {
            os.write_int64(1, self.start)?;
        }
        if let ::std::option::Option::Some(ref v) = self.has_length {
            match v {
                &TensorSliceProto_Extent_oneof_has_length::length(v) => {
                    os.write_int64(2, 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() -> TensorSliceProto_Extent {
        TensorSliceProto_Extent::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_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
                "start",
                |m: &TensorSliceProto_Extent| { &m.start },
                |m: &mut TensorSliceProto_Extent| { &mut m.start },
            ));
            fields.push(::protobuf::reflect::accessor::make_singular_i64_accessor::<_>(
                "length",
                TensorSliceProto_Extent::has_length,
                TensorSliceProto_Extent::get_length,
            ));
            ::protobuf::reflect::MessageDescriptor::new_pb_name::<TensorSliceProto_Extent>(
                "TensorSliceProto.Extent",
                fields,
                file_descriptor_proto()
            )
        })
    }

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

impl ::protobuf::Clear for TensorSliceProto_Extent {
    fn clear(&mut self) {
        self.start = 0;
        self.has_length = ::std::option::Option::None;
        self.unknown_fields.clear();
    }
}

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

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

static file_descriptor_proto_data: &'static [u8] = b"\
    \n,tensorflow/core/framework/tensor_slice.proto\x12\ntensorflow\"\x97\
    \x01\n\x10TensorSliceProto\x12;\n\x06extent\x18\x01\x20\x03(\x0b2#.tenso\
    rflow.TensorSliceProto.ExtentR\x06extent\x1aF\n\x06Extent\x12\x14\n\x05s\
    tart\x18\x01\x20\x01(\x03R\x05start\x12\x18\n\x06length\x18\x02\x20\x01(\
    \x03H\0R\x06lengthB\x0c\n\nhas_lengthBq\n\x18org.tensorflow.frameworkB\
    \x11TensorSliceProtosP\x01Z=github.com/tensorflow/tensorflow/tensorflow/\
    go/core/framework\xf8\x01\x01b\x06proto3\
";

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()
    })
}