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 `text.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:text.Text)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct Text {
    // message fields
    // @@protoc_insertion_point(field:text.Text.num_lines)
    pub num_lines: ::std::option::Option<i64>,
    // @@protoc_insertion_point(field:text.Text.num_words)
    pub num_words: ::std::option::Option<i64>,
    // special fields
    // @@protoc_insertion_point(special_field:text.Text.special_fields)
    pub special_fields: ::protobuf::SpecialFields,
}

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

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

    // optional int64 num_lines = 1;

    pub fn num_lines(&self) -> i64 {
        self.num_lines.unwrap_or(0)
    }

    pub fn clear_num_lines(&mut self) {
        self.num_lines = ::std::option::Option::None;
    }

    pub fn has_num_lines(&self) -> bool {
        self.num_lines.is_some()
    }

    // Param is passed by value, moved
    pub fn set_num_lines(&mut self, v: i64) {
        self.num_lines = ::std::option::Option::Some(v);
    }

    // optional int64 num_words = 2;

    pub fn num_words(&self) -> i64 {
        self.num_words.unwrap_or(0)
    }

    pub fn clear_num_words(&mut self) {
        self.num_words = ::std::option::Option::None;
    }

    pub fn has_num_words(&self) -> bool {
        self.num_words.is_some()
    }

    // Param is passed by value, moved
    pub fn set_num_words(&mut self, v: i64) {
        self.num_words = ::std::option::Option::Some(v);
    }

    fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
        let mut fields = ::std::vec::Vec::with_capacity(2);
        let mut oneofs = ::std::vec::Vec::with_capacity(0);
        fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
            "num_lines",
            |m: &Text| { &m.num_lines },
            |m: &mut Text| { &mut m.num_lines },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
            "num_words",
            |m: &Text| { &m.num_words },
            |m: &mut Text| { &mut m.num_words },
        ));
        ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<Text>(
            "Text",
            fields,
            oneofs,
        )
    }
}

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

    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 {
                8 => {
                    self.num_lines = ::std::option::Option::Some(is.read_int64()?);
                },
                16 => {
                    self.num_words = ::std::option::Option::Some(is.read_int64()?);
                },
                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.num_lines {
            my_size += ::protobuf::rt::int64_size(1, v);
        }
        if let Some(v) = self.num_words {
            my_size += ::protobuf::rt::int64_size(2, v);
        }
        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.num_lines {
            os.write_int64(1, v)?;
        }
        if let Some(v) = self.num_words {
            os.write_int64(2, v)?;
        }
        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() -> Text {
        Text::new()
    }

    fn clear(&mut self) {
        self.num_lines = ::std::option::Option::None;
        self.num_words = ::std::option::Option::None;
        self.special_fields.clear();
    }

    fn default_instance() -> &'static Text {
        static instance: Text = Text {
            num_lines: ::std::option::Option::None,
            num_words: ::std::option::Option::None,
            special_fields: ::protobuf::SpecialFields::new(),
        };
        &instance
    }
}

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

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

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

#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:text.Language)
pub enum Language {
    // @@protoc_insertion_point(enum_value:text.Language.English)
    English = 1,
    // @@protoc_insertion_point(enum_value:text.Language.Spanish)
    Spanish = 2,
    // @@protoc_insertion_point(enum_value:text.Language.French)
    French = 3,
    // @@protoc_insertion_point(enum_value:text.Language.German)
    German = 4,
}

impl ::protobuf::Enum for Language {
    const NAME: &'static str = "Language";

    fn value(&self) -> i32 {
        *self as i32
    }

    fn from_i32(value: i32) -> ::std::option::Option<Language> {
        match value {
            1 => ::std::option::Option::Some(Language::English),
            2 => ::std::option::Option::Some(Language::Spanish),
            3 => ::std::option::Option::Some(Language::French),
            4 => ::std::option::Option::Some(Language::German),
            _ => ::std::option::Option::None
        }
    }

    fn from_str(str: &str) -> ::std::option::Option<Language> {
        match str {
            "English" => ::std::option::Option::Some(Language::English),
            "Spanish" => ::std::option::Option::Some(Language::Spanish),
            "French" => ::std::option::Option::Some(Language::French),
            "German" => ::std::option::Option::Some(Language::German),
            _ => ::std::option::Option::None
        }
    }

    const VALUES: &'static [Language] = &[
        Language::English,
        Language::Spanish,
        Language::French,
        Language::German,
    ];
}

impl ::protobuf::EnumFull for Language {
    fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
        static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
        descriptor.get(|| file_descriptor().enum_by_package_relative_name("Language").unwrap()).clone()
    }

    fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
        let index = match self {
            Language::English => 0,
            Language::Spanish => 1,
            Language::French => 2,
            Language::German => 3,
        };
        Self::enum_descriptor().value_by_index(index)
    }
}

// Note, `Default` is implemented although default value is not 0
impl ::std::default::Default for Language {
    fn default() -> Self {
        Language::English
    }
}

impl Language {
    fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
        ::protobuf::reflect::GeneratedEnumDescriptorData::new::<Language>("Language")
    }
}

static file_descriptor_proto_data: &'static [u8] = b"\
    \n\ntext.proto\x12\x04text\x1a\nyara.proto\"@\n\x04Text\x12\x1b\n\tnum_l\
    ines\x18\x01\x20\x01(\x03R\x08numLines\x12\x1b\n\tnum_words\x18\x02\x20\
    \x01(\x03R\x08numWords*<\n\x08Language\x12\x0b\n\x07English\x10\x01\x12\
    \x0b\n\x07Spanish\x10\x02\x12\n\n\x06French\x10\x03\x12\n\n\x06German\
    \x10\x04B(\xfa\x92\x19$\n\x04text\x12\ttext.Text\x1a\x04text\"\x0btext-m\
    oduleb\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(1);
            deps.push(super::yara::file_descriptor().clone());
            let mut messages = ::std::vec::Vec::with_capacity(1);
            messages.push(Text::generated_message_descriptor_data());
            let mut enums = ::std::vec::Vec::with_capacity(1);
            enums.push(Language::generated_enum_descriptor_data());
            ::protobuf::reflect::GeneratedFileDescriptor::new_generated(
                file_descriptor_proto(),
                deps,
                messages,
                enums,
            )
        });
        ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor)
    })
}