yara-x 1.15.0

A pure Rust implementation of YARA.
Documentation
// This file is generated by rust-protobuf 3.7.2. Do not edit
// .proto file is parsed by pure
// @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 `mods.proto`

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

// @@protoc_insertion_point(message:mods.Modules)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct Modules {
    // message fields
    // @@protoc_insertion_point(field:mods.Modules.pe)
    pub pe: ::protobuf::MessageField<super::pe::PE>,
    // @@protoc_insertion_point(field:mods.Modules.elf)
    pub elf: ::protobuf::MessageField<super::elf::ELF>,
    // @@protoc_insertion_point(field:mods.Modules.dotnet)
    pub dotnet: ::protobuf::MessageField<super::dotnet::Dotnet>,
    // @@protoc_insertion_point(field:mods.Modules.macho)
    pub macho: ::protobuf::MessageField<super::macho::Macho>,
    // @@protoc_insertion_point(field:mods.Modules.lnk)
    pub lnk: ::protobuf::MessageField<super::lnk::Lnk>,
    // @@protoc_insertion_point(field:mods.Modules.crx)
    pub crx: ::protobuf::MessageField<super::crx::Crx>,
    // @@protoc_insertion_point(field:mods.Modules.dex)
    pub dex: ::protobuf::MessageField<super::dex::Dex>,
    // special fields
    // @@protoc_insertion_point(special_field:mods.Modules.special_fields)
    pub special_fields: ::protobuf::SpecialFields,
}

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

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

    fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
        let mut fields = ::std::vec::Vec::with_capacity(7);
        let mut oneofs = ::std::vec::Vec::with_capacity(0);
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::pe::PE>(
            "pe",
            |m: &Modules| { &m.pe },
            |m: &mut Modules| { &mut m.pe },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::elf::ELF>(
            "elf",
            |m: &Modules| { &m.elf },
            |m: &mut Modules| { &mut m.elf },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::dotnet::Dotnet>(
            "dotnet",
            |m: &Modules| { &m.dotnet },
            |m: &mut Modules| { &mut m.dotnet },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::macho::Macho>(
            "macho",
            |m: &Modules| { &m.macho },
            |m: &mut Modules| { &mut m.macho },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::lnk::Lnk>(
            "lnk",
            |m: &Modules| { &m.lnk },
            |m: &mut Modules| { &mut m.lnk },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::crx::Crx>(
            "crx",
            |m: &Modules| { &m.crx },
            |m: &mut Modules| { &mut m.crx },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::dex::Dex>(
            "dex",
            |m: &Modules| { &m.dex },
            |m: &mut Modules| { &mut m.dex },
        ));
        ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<Modules>(
            "Modules",
            fields,
            oneofs,
        )
    }
}

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

    fn is_initialized(&self) -> bool {
        for v in &self.pe {
            if !v.is_initialized() {
                return false;
            }
        };
        for v in &self.elf {
            if !v.is_initialized() {
                return false;
            }
        };
        for v in &self.dotnet {
            if !v.is_initialized() {
                return false;
            }
        };
        for v in &self.macho {
            if !v.is_initialized() {
                return false;
            }
        };
        for v in &self.lnk {
            if !v.is_initialized() {
                return false;
            }
        };
        for v in &self.crx {
            if !v.is_initialized() {
                return false;
            }
        };
        for v in &self.dex {
            if !v.is_initialized() {
                return false;
            }
        };
        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 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.pe)?;
                },
                18 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.elf)?;
                },
                26 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.dotnet)?;
                },
                34 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.macho)?;
                },
                42 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.lnk)?;
                },
                50 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.crx)?;
                },
                58 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.dex)?;
                },
                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 let Some(v) = self.pe.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.elf.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.dotnet.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.macho.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.lnk.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.crx.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        if let Some(v) = self.dex.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 let Some(v) = self.pe.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?;
        }
        if let Some(v) = self.elf.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?;
        }
        if let Some(v) = self.dotnet.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?;
        }
        if let Some(v) = self.macho.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?;
        }
        if let Some(v) = self.lnk.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?;
        }
        if let Some(v) = self.crx.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?;
        }
        if let Some(v) = self.dex.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(7, 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() -> Modules {
        Modules::new()
    }

    fn clear(&mut self) {
        self.pe.clear();
        self.elf.clear();
        self.dotnet.clear();
        self.macho.clear();
        self.lnk.clear();
        self.crx.clear();
        self.dex.clear();
        self.special_fields.clear();
    }

    fn default_instance() -> &'static Modules {
        static instance: Modules = Modules {
            pe: ::protobuf::MessageField::none(),
            elf: ::protobuf::MessageField::none(),
            dotnet: ::protobuf::MessageField::none(),
            macho: ::protobuf::MessageField::none(),
            lnk: ::protobuf::MessageField::none(),
            crx: ::protobuf::MessageField::none(),
            dex: ::protobuf::MessageField::none(),
            special_fields: ::protobuf::SpecialFields::new(),
        };
        &instance
    }
}

impl ::protobuf::MessageFull for Modules {
    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("Modules").unwrap()).clone()
    }
}

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

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

static file_descriptor_proto_data: &'static [u8] = b"\
    \n\nmods.proto\x12\x04mods\x1a\nyara.proto\x1a\tcrx.proto\x1a\tdex.proto\
    \x1a\x0cdotnet.proto\x1a\telf.proto\x1a\x08pe.proto\x1a\tlnk.proto\x1a\
    \x0bmacho.proto\"\xdd\x01\n\x07Modules\x12\x16\n\x02pe\x18\x01\x20\x01(\
    \x0b2\x06.pe.PER\x02pe\x12\x1a\n\x03elf\x18\x02\x20\x01(\x0b2\x08.elf.EL\
    FR\x03elf\x12&\n\x06dotnet\x18\x03\x20\x01(\x0b2\x0e.dotnet.DotnetR\x06d\
    otnet\x12\"\n\x05macho\x18\x04\x20\x01(\x0b2\x0c.macho.MachoR\x05macho\
    \x12\x1a\n\x03lnk\x18\x05\x20\x01(\x0b2\x08.lnk.LnkR\x03lnk\x12\x1a\n\
    \x03crx\x18\x06\x20\x01(\x0b2\x08.crx.CrxR\x03crx\x12\x1a\n\x03dex\x18\
    \x07\x20\x01(\x0b2\x08.dex.DexR\x03dexb\x06proto2\
";

/// `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(8);
            deps.push(super::yara::file_descriptor().clone());
            deps.push(super::crx::file_descriptor().clone());
            deps.push(super::dex::file_descriptor().clone());
            deps.push(super::dotnet::file_descriptor().clone());
            deps.push(super::elf::file_descriptor().clone());
            deps.push(super::pe::file_descriptor().clone());
            deps.push(super::lnk::file_descriptor().clone());
            deps.push(super::macho::file_descriptor().clone());
            let mut messages = ::std::vec::Vec::with_capacity(1);
            messages.push(Modules::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)
    })
}