diff --git a/Cargo.lock b/Cargo.lock index ce62001..0fc9d25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,6 +49,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + [[package]] name = "atty" version = "0.2.14" @@ -78,6 +93,8 @@ dependencies = [ "itertools", "mime", "protobuf", + "protobuf-codegen", + "protoc-bin-vendored", "sanitise-file-name", "ureq", "webp", @@ -283,6 +300,15 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + [[package]] name = "flate2" version = "1.0.24" @@ -415,6 +441,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "iota-crypto" version = "0.13.0" @@ -496,6 +531,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + [[package]] name = "mime" version = "0.3.16" @@ -633,6 +674,37 @@ dependencies = [ "thiserror", ] +[[package]] +name = "protobuf-codegen" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b893e5e7d3395545d5244f8c0d33674025bd566b26c03bfda49b82c6dec45e" +dependencies = [ + "anyhow", + "once_cell", + "protobuf", + "protobuf-parse", + "regex", + "tempfile", + "thiserror", +] + +[[package]] +name = "protobuf-parse" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b1447dd751c434cc1b415579837ebd0411ed7d67d465f38010da5d7cd33af4d" +dependencies = [ + "anyhow", + "indexmap", + "log", + "protobuf", + "protobuf-support", + "tempfile", + "thiserror", + "which", +] + [[package]] name = "protobuf-support" version = "3.1.0" @@ -642,6 +714,56 @@ dependencies = [ "thiserror", ] +[[package]] +name = "protoc-bin-vendored" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005ca8623e5633e298ad1f917d8be0a44bcf406bf3cde3b80e63003e49a3f27d" +dependencies = [ + "protoc-bin-vendored-linux-aarch_64", + "protoc-bin-vendored-linux-ppcle_64", + "protoc-bin-vendored-linux-x86_32", + "protoc-bin-vendored-linux-x86_64", + "protoc-bin-vendored-macos-x86_64", + "protoc-bin-vendored-win32", +] + +[[package]] +name = "protoc-bin-vendored-linux-aarch_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb9fc9cce84c8694b6ea01cc6296617b288b703719b725b8c9c65f7c5874435" + +[[package]] +name = "protoc-bin-vendored-linux-ppcle_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d2a07dcf7173a04d49974930ccbfb7fd4d74df30ecfc8762cf2f895a094516" + +[[package]] +name = "protoc-bin-vendored-linux-x86_32" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54fef0b04fcacba64d1d80eed74a20356d96847da8497a59b0a0a436c9165b0" + +[[package]] +name = "protoc-bin-vendored-linux-x86_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8782f2ce7d43a9a5c74ea4936f001e9e8442205c244f7a3d4286bd4c37bc924" + +[[package]] +name = "protoc-bin-vendored-macos-x86_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5de656c7ee83f08e0ae5b81792ccfdc1d04e7876b1d9a38e6876a9e09e02537" + +[[package]] +name = "protoc-bin-vendored-win32" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9653c3ed92974e34c5a6e0a510864dab979760481714c172e0a34e437cb98804" + [[package]] name = "quote" version = "1.0.21" @@ -651,6 +773,41 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + [[package]] name = "ring" version = "0.16.20" @@ -740,6 +897,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -1001,6 +1172,17 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "which" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +dependencies = [ + "either", + "libc", + "once_cell", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 3c2d7d4..e5fcf93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,10 @@ mime = "0.3.16" protobuf = "3.1.0" sanitise-file-name = "1.0.0" +[build-dependencies] +protobuf-codegen = "3.1.0" +protoc-bin-vendored = "3.0.0" + [dependencies.iota-crypto] version = "0.13.0" features = ["aes", "random"] diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..f88e5b5 --- /dev/null +++ b/build.rs @@ -0,0 +1,17 @@ +use protobuf_codegen; + +fn main() { + protobuf_codegen::Codegen::new() + .protoc() + // Use `protoc-bin-vendored` bundled protoc command, optional. + .protoc_path(&protoc_bin_vendored::protoc_bin_path().unwrap()) + // All inputs and imports from the inputs must reside in `includes` directories. + .includes(&["protobuf"]) + // Inputs must reside in some of include paths. + .input("protobuf/index.proto") + .input("protobuf/image.proto") + .protoc_extra_arg("--experimental_allow_proto3_optional") + // Specify output directory relative to Cargo output directory. + .out_dir("src/protobuf/") + .run_from_script(); +} diff --git a/src/protobuf/README.md b/src/protobuf/README.md new file mode 100644 index 0000000..e39a8f5 --- /dev/null +++ b/src/protobuf/README.md @@ -0,0 +1,5 @@ +# Why is this directory empty? + +This directory will be populated by generated protobuf code once the project is +built. If it's empty right now, don't stress! Just run `cargo build` and you +should be good. diff --git a/src/protobuf/image.rs b/src/protobuf/image.rs deleted file mode 100644 index 295202c..0000000 --- a/src/protobuf/image.rs +++ /dev/null @@ -1,353 +0,0 @@ -// This file is generated by rust-protobuf 3.1.0. Do not edit -// .proto file is parsed by protoc --rust-out=... -// @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(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_results)] -#![allow(unused_mut)] - -//! Generated file from `image.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_1_0; - -#[derive(PartialEq,Clone,Default,Debug)] -// @@protoc_insertion_point(message:Image) -pub struct Image { - // message fields - // @@protoc_insertion_point(field:Image.key) - pub key: ::std::vec::Vec, - // @@protoc_insertion_point(field:Image.full_url) - pub full_url: ::std::string::String, - // @@protoc_insertion_point(field:Image.thumb_url) - pub thumb_url: ::std::string::String, - // @@protoc_insertion_point(field:Image.blurhash) - pub blurhash: ::std::string::String, - // @@protoc_insertion_point(field:Image.format) - pub format: ::protobuf::EnumOrUnknown, - // special fields - // @@protoc_insertion_point(special_field:Image.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Image { - fn default() -> &'a Image { - ::default_instance() - } -} - -impl Image { - pub fn new() -> Image { - ::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::<_, _>( - "key", - |m: &Image| { &m.key }, - |m: &mut Image| { &mut m.key }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "full_url", - |m: &Image| { &m.full_url }, - |m: &mut Image| { &mut m.full_url }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "thumb_url", - |m: &Image| { &m.thumb_url }, - |m: &mut Image| { &mut m.thumb_url }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "blurhash", - |m: &Image| { &m.blurhash }, - |m: &mut Image| { &mut m.blurhash }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "format", - |m: &Image| { &m.format }, - |m: &mut Image| { &mut m.format }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Image", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Image { - const NAME: &'static str = "Image"; - - 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.key = is.read_bytes()?; - }, - 18 => { - self.full_url = is.read_string()?; - }, - 26 => { - self.thumb_url = is.read_string()?; - }, - 34 => { - self.blurhash = is.read_string()?; - }, - 40 => { - self.format = is.read_enum_or_unknown()?; - }, - 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.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.key); - } - if !self.full_url.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.full_url); - } - if !self.thumb_url.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.thumb_url); - } - if !self.blurhash.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.blurhash); - } - if self.format != ::protobuf::EnumOrUnknown::new(Format::WEBP) { - my_size += ::protobuf::rt::int32_size(5, self.format.value()); - } - 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.key.is_empty() { - os.write_bytes(1, &self.key)?; - } - if !self.full_url.is_empty() { - os.write_string(2, &self.full_url)?; - } - if !self.thumb_url.is_empty() { - os.write_string(3, &self.thumb_url)?; - } - if !self.blurhash.is_empty() { - os.write_string(4, &self.blurhash)?; - } - if self.format != ::protobuf::EnumOrUnknown::new(Format::WEBP) { - os.write_enum(5, ::protobuf::EnumOrUnknown::value(&self.format))?; - } - 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() -> Image { - Image::new() - } - - fn clear(&mut self) { - self.key.clear(); - self.full_url.clear(); - self.thumb_url.clear(); - self.blurhash.clear(); - self.format = ::protobuf::EnumOrUnknown::new(Format::WEBP); - self.special_fields.clear(); - } - - fn default_instance() -> &'static Image { - static instance: Image = Image { - key: ::std::vec::Vec::new(), - full_url: ::std::string::String::new(), - thumb_url: ::std::string::String::new(), - blurhash: ::std::string::String::new(), - format: ::protobuf::EnumOrUnknown::from_i32(0), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Image { - 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("Image").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Image { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Image { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] -// @@protoc_insertion_point(enum:Format) -pub enum Format { - // @@protoc_insertion_point(enum_value:Format.WEBP) - WEBP = 0, - // @@protoc_insertion_point(enum_value:Format.AVIF) - AVIF = 1, - // @@protoc_insertion_point(enum_value:Format.JPG) - JPG = 2, - // @@protoc_insertion_point(enum_value:Format.PNG) - PNG = 3, - // @@protoc_insertion_point(enum_value:Format.GIF) - GIF = 4, -} - -impl ::protobuf::Enum for Format { - const NAME: &'static str = "Format"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(Format::WEBP), - 1 => ::std::option::Option::Some(Format::AVIF), - 2 => ::std::option::Option::Some(Format::JPG), - 3 => ::std::option::Option::Some(Format::PNG), - 4 => ::std::option::Option::Some(Format::GIF), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [Format] = &[ - Format::WEBP, - Format::AVIF, - Format::JPG, - Format::PNG, - Format::GIF, - ]; -} - -impl ::protobuf::EnumFull for Format { - 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("Format").unwrap()).clone() - } - - fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { - let index = *self as usize; - Self::enum_descriptor().value_by_index(index) - } -} - -impl ::std::default::Default for Format { - fn default() -> Self { - Format::WEBP - } -} - -impl Format { - fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Format") - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0bimage.proto\"\x8e\x01\n\x05Image\x12\x10\n\x03key\x18\x01\x20\x01(\ - \x0cR\x03key\x12\x19\n\x08full_url\x18\x02\x20\x01(\tR\x07fullUrl\x12\ - \x1b\n\tthumb_url\x18\x03\x20\x01(\tR\x08thumbUrl\x12\x1a\n\x08blurhash\ - \x18\x04\x20\x01(\tR\x08blurhash\x12\x1f\n\x06format\x18\x05\x20\x01(\ - \x0e2\x07.FormatR\x06format*7\n\x06Format\x12\x08\n\x04WEBP\x10\0\x12\ - \x08\n\x04AVIF\x10\x01\x12\x07\n\x03JPG\x10\x02\x12\x07\n\x03PNG\x10\x03\ - \x12\x07\n\x03GIF\x10\x04J\xa2\x04\n\x06\x12\x04\0\0\x10\x01\n\x08\n\x01\ - \x0c\x12\x03\0\0\x12\n\n\n\x02\x05\0\x12\x04\x02\0\x08\x01\n\n\n\x03\x05\ - \0\x01\x12\x03\x02\x05\x0b\n\x0b\n\x04\x05\0\x02\0\x12\x03\x03\x08\x11\n\ - \x0c\n\x05\x05\0\x02\0\x01\x12\x03\x03\x08\x0c\n\x0c\n\x05\x05\0\x02\0\ - \x02\x12\x03\x03\x0f\x10\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x04\x08\x11\n\ - \x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x04\x08\x0c\n\x0c\n\x05\x05\0\x02\ - \x01\x02\x12\x03\x04\x0f\x10\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x05\x08\ - \x10\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x05\x08\x0b\n\x0c\n\x05\x05\0\ - \x02\x02\x02\x12\x03\x05\x0e\x0f\n\x0b\n\x04\x05\0\x02\x03\x12\x03\x06\ - \x08\x10\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03\x06\x08\x0b\n\x0c\n\x05\ - \x05\0\x02\x03\x02\x12\x03\x06\x0e\x0f\n\x0b\n\x04\x05\0\x02\x04\x12\x03\ - \x07\x08\x10\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03\x07\x08\x0b\n\x0c\n\ - \x05\x05\0\x02\x04\x02\x12\x03\x07\x0e\x0f\n\n\n\x02\x04\0\x12\x04\n\0\ - \x10\x01\n\n\n\x03\x04\0\x01\x12\x03\n\x08\r\n\x0b\n\x04\x04\0\x02\0\x12\ - \x03\x0b\x08\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0b\x08\r\n\x0c\n\ - \x05\x04\0\x02\0\x01\x12\x03\x0b\x0e\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\ - \x03\x0b\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x0c\x08\x1c\n\x0c\n\ - \x05\x04\0\x02\x01\x05\x12\x03\x0c\x08\x0e\n\x0c\n\x05\x04\0\x02\x01\x01\ - \x12\x03\x0c\x0f\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0c\x1a\x1b\n\ - \x0b\n\x04\x04\0\x02\x02\x12\x03\r\x08\x1d\n\x0c\n\x05\x04\0\x02\x02\x05\ - \x12\x03\r\x08\x0e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\r\x0f\x18\n\x0c\ - \n\x05\x04\0\x02\x02\x03\x12\x03\r\x1b\x1c\n\x0b\n\x04\x04\0\x02\x03\x12\ - \x03\x0e\x08\x1c\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x0e\x08\x0e\n\x0c\ - \n\x05\x04\0\x02\x03\x01\x12\x03\x0e\x0f\x17\n\x0c\n\x05\x04\0\x02\x03\ - \x03\x12\x03\x0e\x1a\x1b\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x0f\x08\x1a\n\ - \x0c\n\x05\x04\0\x02\x04\x06\x12\x03\x0f\x08\x0e\n\x0c\n\x05\x04\0\x02\ - \x04\x01\x12\x03\x0f\x0f\x15\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x0f\ - \x18\x19b\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(0); - let mut messages = ::std::vec::Vec::with_capacity(1); - messages.push(Image::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(1); - enums.push(Format::generated_enum_descriptor_data()); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/src/protobuf/index.rs b/src/protobuf/index.rs deleted file mode 100644 index 3327b3d..0000000 --- a/src/protobuf/index.rs +++ /dev/null @@ -1,235 +0,0 @@ -// This file is generated by rust-protobuf 3.1.0. Do not edit -// .proto file is parsed by protoc --rust-out=... -// @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(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_results)] -#![allow(unused_mut)] - -//! Generated file from `index.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_1_0; - -#[derive(PartialEq,Clone,Default,Debug)] -// @@protoc_insertion_point(message:Index) -pub struct Index { - // message fields - // @@protoc_insertion_point(field:Index.images) - pub images: ::std::vec::Vec, - // @@protoc_insertion_point(field:Index.title) - pub title: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:Index.desc) - pub desc: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:Index.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Index { - fn default() -> &'a Index { - ::default_instance() - } -} - -impl Index { - pub fn new() -> Index { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(3); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "images", - |m: &Index| { &m.images }, - |m: &mut Index| { &mut m.images }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "title", - |m: &Index| { &m.title }, - |m: &mut Index| { &mut m.title }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "desc", - |m: &Index| { &m.desc }, - |m: &mut Index| { &mut m.desc }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "Index", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Index { - const NAME: &'static str = "Index"; - - 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.images.push(is.read_message()?); - }, - 18 => { - self.title = ::std::option::Option::Some(is.read_string()?); - }, - 26 => { - self.desc = ::std::option::Option::Some(is.read_string()?); - }, - 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; - for value in &self.images { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.title.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.desc.as_ref() { - my_size += ::protobuf::rt::string_size(3, &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<()> { - for v in &self.images { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - }; - if let Some(v) = self.title.as_ref() { - os.write_string(2, v)?; - } - if let Some(v) = self.desc.as_ref() { - os.write_string(3, 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() -> Index { - Index::new() - } - - fn clear(&mut self) { - self.images.clear(); - self.title = ::std::option::Option::None; - self.desc = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Index { - static instance: Index = Index { - images: ::std::vec::Vec::new(), - title: ::std::option::Option::None, - desc: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Index { - 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("Index").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Index { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Index { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0bindex.proto\x1a\x0bimage.proto\"n\n\x05Index\x12\x1e\n\x06images\ - \x18\x01\x20\x03(\x0b2\x06.ImageR\x06images\x12\x19\n\x05title\x18\x02\ - \x20\x01(\tH\0R\x05title\x88\x01\x01\x12\x17\n\x04desc\x18\x03\x20\x01(\ - \tH\x01R\x04desc\x88\x01\x01B\x08\n\x06_titleB\x07\n\x05_descJ\x84\x02\n\ - \x06\x12\x04\0\0\x08\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\t\n\x02\x03\0\ - \x12\x03\x02\0\x15\n\n\n\x02\x04\0\x12\x04\x04\0\x08\x01\n\n\n\x03\x04\0\ - \x01\x12\x03\x04\x08\r\n\x0b\n\x04\x04\0\x02\0\x12\x03\x05\x08\"\n\x0c\n\ - \x05\x04\0\x02\0\x04\x12\x03\x05\x08\x10\n\x0c\n\x05\x04\0\x02\0\x06\x12\ - \x03\x05\x11\x16\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x05\x17\x1d\n\x0c\n\ - \x05\x04\0\x02\0\x03\x12\x03\x05\x20!\n\x0b\n\x04\x04\0\x02\x01\x12\x03\ - \x06\x08\"\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x06\x08\x10\n\x0c\n\x05\ - \x04\0\x02\x01\x05\x12\x03\x06\x11\x17\n\x0c\n\x05\x04\0\x02\x01\x01\x12\ - \x03\x06\x18\x1d\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x06\x20!\n\x0b\n\ - \x04\x04\0\x02\x02\x12\x03\x07\x08!\n\x0c\n\x05\x04\0\x02\x02\x04\x12\ - \x03\x07\x08\x10\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x07\x11\x17\n\x0c\ - \n\x05\x04\0\x02\x02\x01\x12\x03\x07\x18\x1c\n\x0c\n\x05\x04\0\x02\x02\ - \x03\x12\x03\x07\x1f\x20b\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(1); - deps.push(super::image::file_descriptor().clone()); - let mut messages = ::std::vec::Vec::with_capacity(1); - messages.push(Index::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) - }) -} diff --git a/src/protobuf/mod.rs b/src/protobuf/mod.rs deleted file mode 100644 index 8b4421b..0000000 --- a/src/protobuf/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -// @generated - -pub mod image; -pub mod index;