// This file is generated by rust-protobuf 3.7.2. Do not edit
// .proto file is parsed by protoc 24.4
// @generated

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

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

#![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_results)]
#![allow(unused_mut)]

//! Generated file from `in_toto_attestation/predicates/link/v0/link.proto`

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

use crate::v1::resource_descriptor;

// @@protoc_insertion_point(message:in_toto_attestation.predicates.link.v0.Link)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct Link {
    // message fields
    // @@protoc_insertion_point(field:in_toto_attestation.predicates.link.v0.Link.name)
    pub name: ::std::string::String,
    // @@protoc_insertion_point(field:in_toto_attestation.predicates.link.v0.Link.command)
    pub command: ::std::vec::Vec<::std::string::String>,
    // @@protoc_insertion_point(field:in_toto_attestation.predicates.link.v0.Link.materials)
    pub materials: ::std::vec::Vec<resource_descriptor::ResourceDescriptor>,
    // @@protoc_insertion_point(field:in_toto_attestation.predicates.link.v0.Link.byproducts)
    pub byproducts: ::protobuf::MessageField<::protobuf::well_known_types::struct_::Struct>,
    // @@protoc_insertion_point(field:in_toto_attestation.predicates.link.v0.Link.environment)
    pub environment: ::protobuf::MessageField<::protobuf::well_known_types::struct_::Struct>,
    // special fields
    // @@protoc_insertion_point(special_field:in_toto_attestation.predicates.link.v0.Link.special_fields)
    pub special_fields: ::protobuf::SpecialFields,
}

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

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

    fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
        let mut fields = ::std::vec::Vec::with_capacity(5);
        let mut oneofs = ::std::vec::Vec::with_capacity(0);
        fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>(
            "name",
            |m: &Link| { &m.name },
            |m: &mut Link| { &mut m.name },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
            "command",
            |m: &Link| { &m.command },
            |m: &mut Link| { &mut m.command },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
            "materials",
            |m: &Link| { &m.materials },
            |m: &mut Link| { &mut m.materials },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ::protobuf::well_known_types::struct_::Struct>(
            "byproducts",
            |m: &Link| { &m.byproducts },
            |m: &mut Link| { &mut m.byproducts },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ::protobuf::well_known_types::struct_::Struct>(
            "environment",
            |m: &Link| { &m.environment },
            |m: &mut Link| { &mut m.environment },
        ));
        ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<Link>(
            "Link",
            fields,
            oneofs,
        )
    }
}

impl ::protobuf::Message for Link {
    const NAME: &'static str = "Link";

    fn is_initialized(&self) -> bool {
        true
    }

    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
        while let Some(tag) = is.read_raw_tag_or_eof()? {
            match tag {
                10 => {
                    self.name = is.read_string()?;
                },
                18 => {
                    self.command.push(is.read_string()?);
                },
                26 => {
                    self.materials.push(is.read_message()?);
                },
                34 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.byproducts)?;
                },
                42 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.environment)?;
                },
                tag => {
                    ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
                },
            };
        }
        ::std::result::Result::Ok(())
    }

    // Compute sizes of nested messages
    #[allow(unused_variables)]
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.name.is_empty() {
            my_size += ::protobuf::rt::string_size(1, &self.name);
        }
        for value in &self.command {
            my_size += ::protobuf::rt::string_size(2, &value);
        };
        for value in &self.materials {
            let len = value.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        };
        if let Some(v) = self.byproducts.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.environment.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
        self.special_fields.cached_size().set(my_size as u32);
        my_size
    }

    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
        if !self.name.is_empty() {
            os.write_string(1, &self.name)?;
        }
        for v in &self.command {
            os.write_string(2, &v)?;
        };
        for v in &self.materials {
            ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?;
        };
        if let Some(v) = self.byproducts.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?;
        }
        if let Some(v) = self.environment.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?;
        }
        os.write_unknown_fields(self.special_fields.unknown_fields())?;
        ::std::result::Result::Ok(())
    }

    fn special_fields(&self) -> &::protobuf::SpecialFields {
        &self.special_fields
    }

    fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
        &mut self.special_fields
    }

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

    fn clear(&mut self) {
        self.name.clear();
        self.command.clear();
        self.materials.clear();
        self.byproducts.clear();
        self.environment.clear();
        self.special_fields.clear();
    }

    fn default_instance() -> &'static Link {
        static instance: Link = Link {
            name: ::std::string::String::new(),
            command: ::std::vec::Vec::new(),
            materials: ::std::vec::Vec::new(),
            byproducts: ::protobuf::MessageField::none(),
            environment: ::protobuf::MessageField::none(),
            special_fields: ::protobuf::SpecialFields::new(),
        };
        &instance
    }
}

impl ::protobuf::MessageFull for Link {
    fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
        static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
        descriptor.get(|| file_descriptor().message_by_package_relative_name("Link").unwrap()).clone()
    }
}

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

impl ::protobuf::reflect::ProtobufValue for Link {
    type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}

static file_descriptor_proto_data: &'static [u8] = b"\
    \n1in_toto_attestation/predicates/link/v0/link.proto\x12&in_toto_attesta\
    tion.predicates.link.v0\x1a0in_toto_attestation/v1/resource_descriptor.p\
    roto\x1a\x1cgoogle/protobuf/struct.proto\"\xf2\x01\n\x04Link\x12\x12\n\
    \x04name\x18\x01\x20\x01(\tR\x04name\x12\x18\n\x07command\x18\x02\x20\
    \x03(\tR\x07command\x12H\n\tmaterials\x18\x03\x20\x03(\x0b2*.in_toto_att\
    estation.v1.ResourceDescriptorR\tmaterials\x127\n\nbyproducts\x18\x04\
    \x20\x01(\x0b2\x17.google.protobuf.StructR\nbyproducts\x129\n\x0benviron\
    ment\x18\x05\x20\x01(\x0b2\x17.google.protobuf.StructR\x0benvironmentBg\
    \n/io.github.intoto.attestation.predicates.link.v0Z4github.com/in-toto/a\
    ttestation/go/predicates/link/v0b\x06proto3\
";

/// `FileDescriptorProto` object which was a source for this generated file
fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
    static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new();
    file_descriptor_proto_lazy.get(|| {
        ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
    })
}

/// `FileDescriptor` object which allows dynamic access to files
pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
    static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new();
    static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
    file_descriptor.get(|| {
        let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
            let mut deps = ::std::vec::Vec::with_capacity(2);
            deps.push(resource_descriptor::file_descriptor().clone());
            deps.push(::protobuf::well_known_types::struct_::file_descriptor().clone());
            let mut messages = ::std::vec::Vec::with_capacity(1);
            messages.push(Link::generated_message_descriptor_data());
            let mut enums = ::std::vec::Vec::with_capacity(0);
            ::protobuf::reflect::GeneratedFileDescriptor::new_generated(
                file_descriptor_proto(),
                deps,
                messages,
                enums,
            )
        });
        ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor)
    })
}
