diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd.rs | 6 | ||||
-rw-r--r-- | src/cmd/folders.rs | 24 | ||||
-rw-r--r-- | src/cmd/list.rs | 8 | ||||
-rw-r--r-- | src/cmd/raw.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/pb3/jwebmail.rs | 3966 | ||||
-rw-r--r-- | src/rfc822.rs | 28 |
7 files changed, 31 insertions, 4007 deletions
@@ -4,22 +4,22 @@ use maildir::Maildir; mod count; mod folders; +mod list; mod move_mail; mod raw; mod read; -mod list; mod remove; pub use count::count; pub use folders::folders; +pub use list::list; pub use move_mail::move_mail; pub use raw::raw; pub use read::read; -pub use list::list; pub use remove::remove; pub fn open_submaildir(mut path: PathBuf, sub: &str) -> Maildir { - if sub != "" { + if !sub.is_empty() { path.push(String::from(".") + sub); } Maildir::from(path) diff --git a/src/cmd/folders.rs b/src/cmd/folders.rs index b6f7209..b50daa9 100644 --- a/src/cmd/folders.rs +++ b/src/cmd/folders.rs @@ -1,26 +1,24 @@ use std::collections::BTreeSet; use std::ffi::{OsStr, OsString}; use std::path::{Path, PathBuf}; -use std::sync::OnceLock; +use std::sync::LazyLock; use protobuf::Message as _; use crate::error::Result; use crate::pb3::jwebmail::{FoldersReq, FoldersResp}; -static REQUIRED_MAILDIR_DIRS: OnceLock<BTreeSet<OsString>> = OnceLock::new(); +static REQUIRED_MAILDIR_DIRS: LazyLock<BTreeSet<OsString>> = LazyLock::new(|| { + [ + OsString::from("cur"), + "new".into(), + "tmp".into(), + "maildirfolder".into(), + ] + .into() +}); fn is_mailsubdir(p: &Path) -> bool { - let rmd = REQUIRED_MAILDIR_DIRS.get_or_init(|| { - [ - OsString::from("cur"), - "new".into(), - "tmp".into(), - "maildirfolder".into(), - ] - .into() - }); - p.is_dir() && p.file_name() .map_or(false, |fname| fname.to_string_lossy().starts_with('.')) @@ -32,7 +30,7 @@ fn is_mailsubdir(p: &Path) -> bool { .and_then(|dir_entry| dir_entry.path().file_name().map(OsStr::to_owned)) }) .collect::<BTreeSet<_>>() - .is_superset(rmd) + .is_superset(&*REQUIRED_MAILDIR_DIRS) }) .unwrap_or_default() } diff --git a/src/cmd/list.rs b/src/cmd/list.rs index 65f128f..f34c333 100644 --- a/src/cmd/list.rs +++ b/src/cmd/list.rs @@ -9,8 +9,8 @@ use crate::error::Result; use crate::pb3::jwebmail::{ListMailHeader, ListReq, ListResp, MailHeader}; use crate::rfc822::me_to_lmh; -fn from_or_sender<'a>(mh: &'a MailHeader) -> &'a str { - if mh.written_from.len() == 0 { +fn from_or_sender(mh: &MailHeader) -> &str { + if mh.written_from.is_empty() { warn!("mail without from"); panic!() } @@ -80,7 +80,7 @@ fn sort_by_and_take( .drain(..) .filter_map(|me| me_to_lmh(me).map_err(|e| warn!("{}", e)).ok()) .collect(); - if sortby.bytes().nth(0) == Some(b'!') { + if sortby.as_bytes().first().copied() == Some(b'!') { x.sort_by(|a, b| a.header.subject.cmp(&b.header.subject)) } else { x.sort_by(|b, a| a.header.subject.cmp(&b.header.subject)) @@ -92,7 +92,7 @@ fn sort_by_and_take( .drain(..) .filter_map(|me| me_to_lmh(me).map_err(|e| warn!("{}", e)).ok()) .collect(); - if sortby.bytes().nth(0) != Some(b'!') { + if sortby.as_bytes().first().copied() != Some(b'!') { x.sort_by(|a, b| from_or_sender(&a.header).cmp(from_or_sender(&b.header))) } else { x.sort_by(|b, a| from_or_sender(&a.header).cmp(from_or_sender(&b.header))) diff --git a/src/cmd/raw.rs b/src/cmd/raw.rs index 76c875f..9fe7620 100644 --- a/src/cmd/raw.rs +++ b/src/cmd/raw.rs @@ -19,8 +19,8 @@ pub fn raw(md_path: PathBuf, req: &[u8]) -> Result<Vec<u8>> { std::io::Error::new(IOErrKind::NotFound, format!("mail {} not found", &r.mid)) })?; - match r.path { - None => { + match r.path.as_deref() { + Some("") | None => { let mut mh = MIMEHeader::new(); mh.maintype = "message".to_owned(); diff --git a/src/main.rs b/src/main.rs index 942961b..f9ba899 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,7 +55,7 @@ fn main() -> Result<()> { let path = args.maildir_path.join(args.mail_user); - stdout().write(b"OPEN\n")?; + stdout().write_all(b"OPEN\n")?; stdout().flush()?; let mut req = Vec::with_capacity(2048); stdin().read_to_end(&mut req)?; diff --git a/src/pb3/jwebmail.rs b/src/pb3/jwebmail.rs deleted file mode 100644 index c94a0e1..0000000 --- a/src/pb3/jwebmail.rs +++ /dev/null @@ -1,3966 +0,0 @@ -// This file is generated by rust-protobuf 3.4.0. Do not edit -// .proto file is parsed by protoc 25.3 -// @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 `jwebmail.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_4_0; - -// @@protoc_insertion_point(message:jwebmail.MIMEHeader) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MIMEHeader { - // message fields - // @@protoc_insertion_point(field:jwebmail.MIMEHeader.maintype) - pub maintype: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.MIMEHeader.subtype) - pub subtype: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.MIMEHeader.contentdispo) - pub contentdispo: ::protobuf::EnumOrUnknown<mimeheader::ContentDisposition>, - // @@protoc_insertion_point(field:jwebmail.MIMEHeader.file_name) - pub file_name: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MIMEHeader.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MIMEHeader { - fn default() -> &'a MIMEHeader { - <MIMEHeader as ::protobuf::Message>::default_instance() - } -} - -impl MIMEHeader { - pub fn new() -> MIMEHeader { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "maintype", - |m: &MIMEHeader| { &m.maintype }, - |m: &mut MIMEHeader| { &mut m.maintype }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "subtype", - |m: &MIMEHeader| { &m.subtype }, - |m: &mut MIMEHeader| { &mut m.subtype }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "contentdispo", - |m: &MIMEHeader| { &m.contentdispo }, - |m: &mut MIMEHeader| { &mut m.contentdispo }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "file_name", - |m: &MIMEHeader| { &m.file_name }, - |m: &mut MIMEHeader| { &mut m.file_name }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MIMEHeader>( - "MIMEHeader", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MIMEHeader { - const NAME: &'static str = "MIMEHeader"; - - 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.maintype = is.read_string()?; - }, - 18 => { - self.subtype = is.read_string()?; - }, - 24 => { - self.contentdispo = is.read_enum_or_unknown()?; - }, - 34 => { - self.file_name = ::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; - if !self.maintype.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.maintype); - } - if !self.subtype.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.subtype); - } - if self.contentdispo != ::protobuf::EnumOrUnknown::new(mimeheader::ContentDisposition::CONTENT_DISPOSITION_NONE) { - my_size += ::protobuf::rt::int32_size(3, self.contentdispo.value()); - } - if let Some(v) = self.file_name.as_ref() { - my_size += ::protobuf::rt::string_size(4, &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 !self.maintype.is_empty() { - os.write_string(1, &self.maintype)?; - } - if !self.subtype.is_empty() { - os.write_string(2, &self.subtype)?; - } - if self.contentdispo != ::protobuf::EnumOrUnknown::new(mimeheader::ContentDisposition::CONTENT_DISPOSITION_NONE) { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&self.contentdispo))?; - } - if let Some(v) = self.file_name.as_ref() { - os.write_string(4, 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() -> MIMEHeader { - MIMEHeader::new() - } - - fn clear(&mut self) { - self.maintype.clear(); - self.subtype.clear(); - self.contentdispo = ::protobuf::EnumOrUnknown::new(mimeheader::ContentDisposition::CONTENT_DISPOSITION_NONE); - self.file_name = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MIMEHeader { - static instance: MIMEHeader = MIMEHeader { - maintype: ::std::string::String::new(), - subtype: ::std::string::String::new(), - contentdispo: ::protobuf::EnumOrUnknown::from_i32(0), - file_name: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MIMEHeader { - 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("MIMEHeader").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MIMEHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MIMEHeader { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -/// Nested message and enums of message `MIMEHeader` -pub mod mimeheader { - #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] - // @@protoc_insertion_point(enum:jwebmail.MIMEHeader.ContentDisposition) - pub enum ContentDisposition { - // @@protoc_insertion_point(enum_value:jwebmail.MIMEHeader.ContentDisposition.CONTENT_DISPOSITION_NONE) - CONTENT_DISPOSITION_NONE = 0, - // @@protoc_insertion_point(enum_value:jwebmail.MIMEHeader.ContentDisposition.CONTENT_DISPOSITION_INLINE) - CONTENT_DISPOSITION_INLINE = 1, - // @@protoc_insertion_point(enum_value:jwebmail.MIMEHeader.ContentDisposition.CONTENT_DISPOSITION_ATTACHMENT) - CONTENT_DISPOSITION_ATTACHMENT = 2, - } - - impl ::protobuf::Enum for ContentDisposition { - const NAME: &'static str = "ContentDisposition"; - - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option<ContentDisposition> { - match value { - 0 => ::std::option::Option::Some(ContentDisposition::CONTENT_DISPOSITION_NONE), - 1 => ::std::option::Option::Some(ContentDisposition::CONTENT_DISPOSITION_INLINE), - 2 => ::std::option::Option::Some(ContentDisposition::CONTENT_DISPOSITION_ATTACHMENT), - _ => ::std::option::Option::None - } - } - - fn from_str(str: &str) -> ::std::option::Option<ContentDisposition> { - match str { - "CONTENT_DISPOSITION_NONE" => ::std::option::Option::Some(ContentDisposition::CONTENT_DISPOSITION_NONE), - "CONTENT_DISPOSITION_INLINE" => ::std::option::Option::Some(ContentDisposition::CONTENT_DISPOSITION_INLINE), - "CONTENT_DISPOSITION_ATTACHMENT" => ::std::option::Option::Some(ContentDisposition::CONTENT_DISPOSITION_ATTACHMENT), - _ => ::std::option::Option::None - } - } - - const VALUES: &'static [ContentDisposition] = &[ - ContentDisposition::CONTENT_DISPOSITION_NONE, - ContentDisposition::CONTENT_DISPOSITION_INLINE, - ContentDisposition::CONTENT_DISPOSITION_ATTACHMENT, - ]; - } - - impl ::protobuf::EnumFull for ContentDisposition { - fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("MIMEHeader.ContentDisposition").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 ContentDisposition { - fn default() -> Self { - ContentDisposition::CONTENT_DISPOSITION_NONE - } - } - - impl ContentDisposition { - pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { - ::protobuf::reflect::GeneratedEnumDescriptorData::new::<ContentDisposition>("MIMEHeader.ContentDisposition") - } - } -} - -// @@protoc_insertion_point(message:jwebmail.MailHeader) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MailHeader { - // message fields - // @@protoc_insertion_point(field:jwebmail.MailHeader.send_date) - pub send_date: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.MailHeader.written_from) - pub written_from: ::std::vec::Vec<mail_header::MailAddr>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.sender) - pub sender: ::protobuf::MessageField<mail_header::MailAddr>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.reply_to) - pub reply_to: ::std::vec::Vec<mail_header::MailAddr>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.send_to) - pub send_to: ::std::vec::Vec<mail_header::MailAddr>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.cc) - pub cc: ::std::vec::Vec<mail_header::MailAddr>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.bcc) - pub bcc: ::std::vec::Vec<mail_header::MailAddr>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.subject) - pub subject: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.MailHeader.comments) - pub comments: ::std::vec::Vec<::std::string::String>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.keywords) - pub keywords: ::std::vec::Vec<::std::string::String>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.mime) - pub mime: ::protobuf::MessageField<MIMEHeader>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MailHeader.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MailHeader { - fn default() -> &'a MailHeader { - <MailHeader as ::protobuf::Message>::default_instance() - } -} - -impl MailHeader { - pub fn new() -> MailHeader { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(11); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "send_date", - |m: &MailHeader| { &m.send_date }, - |m: &mut MailHeader| { &mut m.send_date }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "written_from", - |m: &MailHeader| { &m.written_from }, - |m: &mut MailHeader| { &mut m.written_from }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, mail_header::MailAddr>( - "sender", - |m: &MailHeader| { &m.sender }, - |m: &mut MailHeader| { &mut m.sender }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "reply_to", - |m: &MailHeader| { &m.reply_to }, - |m: &mut MailHeader| { &mut m.reply_to }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "send_to", - |m: &MailHeader| { &m.send_to }, - |m: &mut MailHeader| { &mut m.send_to }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "cc", - |m: &MailHeader| { &m.cc }, - |m: &mut MailHeader| { &mut m.cc }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "bcc", - |m: &MailHeader| { &m.bcc }, - |m: &mut MailHeader| { &mut m.bcc }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "subject", - |m: &MailHeader| { &m.subject }, - |m: &mut MailHeader| { &mut m.subject }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "comments", - |m: &MailHeader| { &m.comments }, - |m: &mut MailHeader| { &mut m.comments }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "keywords", - |m: &MailHeader| { &m.keywords }, - |m: &mut MailHeader| { &mut m.keywords }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MIMEHeader>( - "mime", - |m: &MailHeader| { &m.mime }, - |m: &mut MailHeader| { &mut m.mime }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MailHeader>( - "MailHeader", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MailHeader { - const NAME: &'static str = "MailHeader"; - - 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.send_date = is.read_string()?; - }, - 18 => { - self.written_from.push(is.read_message()?); - }, - 26 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.sender)?; - }, - 34 => { - self.reply_to.push(is.read_message()?); - }, - 42 => { - self.send_to.push(is.read_message()?); - }, - 50 => { - self.cc.push(is.read_message()?); - }, - 58 => { - self.bcc.push(is.read_message()?); - }, - 66 => { - self.subject = is.read_string()?; - }, - 74 => { - self.comments.push(is.read_string()?); - }, - 82 => { - self.keywords.push(is.read_string()?); - }, - 90 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.mime)?; - }, - 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.send_date.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.send_date); - } - for value in &self.written_from { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.sender.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - for value in &self.reply_to { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.send_to { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.cc { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - for value in &self.bcc { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if !self.subject.is_empty() { - my_size += ::protobuf::rt::string_size(8, &self.subject); - } - for value in &self.comments { - my_size += ::protobuf::rt::string_size(9, &value); - }; - for value in &self.keywords { - my_size += ::protobuf::rt::string_size(10, &value); - }; - if let Some(v) = self.mime.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.send_date.is_empty() { - os.write_string(1, &self.send_date)?; - } - for v in &self.written_from { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - if let Some(v) = self.sender.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; - } - for v in &self.reply_to { - ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; - }; - for v in &self.send_to { - ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; - }; - for v in &self.cc { - ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; - }; - for v in &self.bcc { - ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; - }; - if !self.subject.is_empty() { - os.write_string(8, &self.subject)?; - } - for v in &self.comments { - os.write_string(9, &v)?; - }; - for v in &self.keywords { - os.write_string(10, &v)?; - }; - if let Some(v) = self.mime.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(11, 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() -> MailHeader { - MailHeader::new() - } - - fn clear(&mut self) { - self.send_date.clear(); - self.written_from.clear(); - self.sender.clear(); - self.reply_to.clear(); - self.send_to.clear(); - self.cc.clear(); - self.bcc.clear(); - self.subject.clear(); - self.comments.clear(); - self.keywords.clear(); - self.mime.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MailHeader { - static instance: MailHeader = MailHeader { - send_date: ::std::string::String::new(), - written_from: ::std::vec::Vec::new(), - sender: ::protobuf::MessageField::none(), - reply_to: ::std::vec::Vec::new(), - send_to: ::std::vec::Vec::new(), - cc: ::std::vec::Vec::new(), - bcc: ::std::vec::Vec::new(), - subject: ::std::string::String::new(), - comments: ::std::vec::Vec::new(), - keywords: ::std::vec::Vec::new(), - mime: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MailHeader { - 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("MailHeader").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MailHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MailHeader { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -/// Nested message and enums of message `MailHeader` -pub mod mail_header { - // @@protoc_insertion_point(message:jwebmail.MailHeader.MailAddr) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct MailAddr { - // message fields - // @@protoc_insertion_point(field:jwebmail.MailHeader.MailAddr.name) - pub name: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:jwebmail.MailHeader.MailAddr.address) - pub address: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MailHeader.MailAddr.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a MailAddr { - fn default() -> &'a MailAddr { - <MailAddr as ::protobuf::Message>::default_instance() - } - } - - impl MailAddr { - pub fn new() -> MailAddr { - ::std::default::Default::default() - } - - pub(in super) 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::<_, _>( - "name", - |m: &MailAddr| { &m.name }, - |m: &mut MailAddr| { &mut m.name }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "address", - |m: &MailAddr| { &m.address }, - |m: &mut MailAddr| { &mut m.address }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MailAddr>( - "MailHeader.MailAddr", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for MailAddr { - const NAME: &'static str = "MailAddr"; - - 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 = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.address = 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; - if let Some(v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if !self.address.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.address); - } - 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.name.as_ref() { - os.write_string(1, v)?; - } - if !self.address.is_empty() { - os.write_string(2, &self.address)?; - } - 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() -> MailAddr { - MailAddr::new() - } - - fn clear(&mut self) { - self.name = ::std::option::Option::None; - self.address.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MailAddr { - static instance: MailAddr = MailAddr { - name: ::std::option::Option::None, - address: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for MailAddr { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MailHeader.MailAddr").unwrap()).clone() - } - } - - impl ::std::fmt::Display for MailAddr { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for MailAddr { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; - } -} - -// @@protoc_insertion_point(message:jwebmail.ListMailHeader) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ListMailHeader { - // message fields - // @@protoc_insertion_point(field:jwebmail.ListMailHeader.byte_size) - pub byte_size: u64, - // @@protoc_insertion_point(field:jwebmail.ListMailHeader.unread) - pub unread: bool, - // @@protoc_insertion_point(field:jwebmail.ListMailHeader.rec_date) - pub rec_date: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.ListMailHeader.mid) - pub mid: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.ListMailHeader.header) - pub header: ::protobuf::MessageField<MailHeader>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.ListMailHeader.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ListMailHeader { - fn default() -> &'a ListMailHeader { - <ListMailHeader as ::protobuf::Message>::default_instance() - } -} - -impl ListMailHeader { - pub fn new() -> ListMailHeader { - ::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::<_, _>( - "byte_size", - |m: &ListMailHeader| { &m.byte_size }, - |m: &mut ListMailHeader| { &mut m.byte_size }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "unread", - |m: &ListMailHeader| { &m.unread }, - |m: &mut ListMailHeader| { &mut m.unread }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "rec_date", - |m: &ListMailHeader| { &m.rec_date }, - |m: &mut ListMailHeader| { &mut m.rec_date }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "mid", - |m: &ListMailHeader| { &m.mid }, - |m: &mut ListMailHeader| { &mut m.mid }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MailHeader>( - "header", - |m: &ListMailHeader| { &m.header }, - |m: &mut ListMailHeader| { &mut m.header }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ListMailHeader>( - "ListMailHeader", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ListMailHeader { - const NAME: &'static str = "ListMailHeader"; - - 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.byte_size = is.read_uint64()?; - }, - 16 => { - self.unread = is.read_bool()?; - }, - 26 => { - self.rec_date = is.read_string()?; - }, - 34 => { - self.mid = is.read_string()?; - }, - 42 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.header)?; - }, - 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.byte_size != 0 { - my_size += ::protobuf::rt::uint64_size(1, self.byte_size); - } - if self.unread != false { - my_size += 1 + 1; - } - if !self.rec_date.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.rec_date); - } - if !self.mid.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.mid); - } - if let Some(v) = self.header.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.byte_size != 0 { - os.write_uint64(1, self.byte_size)?; - } - if self.unread != false { - os.write_bool(2, self.unread)?; - } - if !self.rec_date.is_empty() { - os.write_string(3, &self.rec_date)?; - } - if !self.mid.is_empty() { - os.write_string(4, &self.mid)?; - } - if let Some(v) = self.header.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() -> ListMailHeader { - ListMailHeader::new() - } - - fn clear(&mut self) { - self.byte_size = 0; - self.unread = false; - self.rec_date.clear(); - self.mid.clear(); - self.header.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static ListMailHeader { - static instance: ListMailHeader = ListMailHeader { - byte_size: 0, - unread: false, - rec_date: ::std::string::String::new(), - mid: ::std::string::String::new(), - header: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ListMailHeader { - 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("ListMailHeader").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ListMailHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ListMailHeader { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.MailBody) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MailBody { - // message oneof groups - pub Body: ::std::option::Option<mail_body::Body>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MailBody.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MailBody { - fn default() -> &'a MailBody { - <MailBody as ::protobuf::Message>::default_instance() - } -} - -impl MailBody { - pub fn new() -> MailBody { - ::std::default::Default::default() - } - - // string discrete = 1; - - pub fn discrete(&self) -> &str { - match self.Body { - ::std::option::Option::Some(mail_body::Body::Discrete(ref v)) => v, - _ => "", - } - } - - pub fn clear_discrete(&mut self) { - self.Body = ::std::option::Option::None; - } - - pub fn has_discrete(&self) -> bool { - match self.Body { - ::std::option::Option::Some(mail_body::Body::Discrete(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_discrete(&mut self, v: ::std::string::String) { - self.Body = ::std::option::Option::Some(mail_body::Body::Discrete(v)) - } - - // Mutable pointer to the field. - pub fn mut_discrete(&mut self) -> &mut ::std::string::String { - if let ::std::option::Option::Some(mail_body::Body::Discrete(_)) = self.Body { - } else { - self.Body = ::std::option::Option::Some(mail_body::Body::Discrete(::std::string::String::new())); - } - match self.Body { - ::std::option::Option::Some(mail_body::Body::Discrete(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_discrete(&mut self) -> ::std::string::String { - if self.has_discrete() { - match self.Body.take() { - ::std::option::Option::Some(mail_body::Body::Discrete(v)) => v, - _ => panic!(), - } - } else { - ::std::string::String::new() - } - } - - // .jwebmail.MailBody.Multipart multipart = 2; - - pub fn multipart(&self) -> &mail_body::Multipart { - match self.Body { - ::std::option::Option::Some(mail_body::Body::Multipart(ref v)) => v, - _ => <mail_body::Multipart as ::protobuf::Message>::default_instance(), - } - } - - pub fn clear_multipart(&mut self) { - self.Body = ::std::option::Option::None; - } - - pub fn has_multipart(&self) -> bool { - match self.Body { - ::std::option::Option::Some(mail_body::Body::Multipart(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_multipart(&mut self, v: mail_body::Multipart) { - self.Body = ::std::option::Option::Some(mail_body::Body::Multipart(v)) - } - - // Mutable pointer to the field. - pub fn mut_multipart(&mut self) -> &mut mail_body::Multipart { - if let ::std::option::Option::Some(mail_body::Body::Multipart(_)) = self.Body { - } else { - self.Body = ::std::option::Option::Some(mail_body::Body::Multipart(mail_body::Multipart::new())); - } - match self.Body { - ::std::option::Option::Some(mail_body::Body::Multipart(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_multipart(&mut self) -> mail_body::Multipart { - if self.has_multipart() { - match self.Body.take() { - ::std::option::Option::Some(mail_body::Body::Multipart(v)) => v, - _ => panic!(), - } - } else { - mail_body::Multipart::new() - } - } - - // .jwebmail.Mail mail = 3; - - pub fn mail(&self) -> &Mail { - match self.Body { - ::std::option::Option::Some(mail_body::Body::Mail(ref v)) => v, - _ => <Mail as ::protobuf::Message>::default_instance(), - } - } - - pub fn clear_mail(&mut self) { - self.Body = ::std::option::Option::None; - } - - pub fn has_mail(&self) -> bool { - match self.Body { - ::std::option::Option::Some(mail_body::Body::Mail(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_mail(&mut self, v: Mail) { - self.Body = ::std::option::Option::Some(mail_body::Body::Mail(v)) - } - - // Mutable pointer to the field. - pub fn mut_mail(&mut self) -> &mut Mail { - if let ::std::option::Option::Some(mail_body::Body::Mail(_)) = self.Body { - } else { - self.Body = ::std::option::Option::Some(mail_body::Body::Mail(Mail::new())); - } - match self.Body { - ::std::option::Option::Some(mail_body::Body::Mail(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_mail(&mut self) -> Mail { - if self.has_mail() { - match self.Body.take() { - ::std::option::Option::Some(mail_body::Body::Mail(v)) => v, - _ => panic!(), - } - } else { - Mail::new() - } - } - - 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(1); - fields.push(::protobuf::reflect::rt::v2::make_oneof_deref_has_get_set_simpler_accessor::<_, _>( - "discrete", - MailBody::has_discrete, - MailBody::discrete, - MailBody::set_discrete, - )); - fields.push(::protobuf::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, mail_body::Multipart>( - "multipart", - MailBody::has_multipart, - MailBody::multipart, - MailBody::mut_multipart, - MailBody::set_multipart, - )); - fields.push(::protobuf::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, Mail>( - "mail", - MailBody::has_mail, - MailBody::mail, - MailBody::mut_mail, - MailBody::set_mail, - )); - oneofs.push(mail_body::Body::generated_oneof_descriptor_data()); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MailBody>( - "MailBody", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MailBody { - const NAME: &'static str = "MailBody"; - - 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.Body = ::std::option::Option::Some(mail_body::Body::Discrete(is.read_string()?)); - }, - 18 => { - self.Body = ::std::option::Option::Some(mail_body::Body::Multipart(is.read_message()?)); - }, - 26 => { - self.Body = ::std::option::Option::Some(mail_body::Body::Mail(is.read_message()?)); - }, - 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 ::std::option::Option::Some(ref v) = self.Body { - match v { - &mail_body::Body::Discrete(ref v) => { - my_size += ::protobuf::rt::string_size(1, &v); - }, - &mail_body::Body::Multipart(ref v) => { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }, - &mail_body::Body::Mail(ref v) => { - 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 ::std::option::Option::Some(ref v) = self.Body { - match v { - &mail_body::Body::Discrete(ref v) => { - os.write_string(1, v)?; - }, - &mail_body::Body::Multipart(ref v) => { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }, - &mail_body::Body::Mail(ref v) => { - ::protobuf::rt::write_message_field_with_cached_size(3, 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() -> MailBody { - MailBody::new() - } - - fn clear(&mut self) { - self.Body = ::std::option::Option::None; - self.Body = ::std::option::Option::None; - self.Body = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static MailBody { - static instance: MailBody = MailBody { - Body: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MailBody { - 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("MailBody").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MailBody { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MailBody { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -/// Nested message and enums of message `MailBody` -pub mod mail_body { - - #[derive(Clone,PartialEq,Debug)] - #[non_exhaustive] - // @@protoc_insertion_point(oneof:jwebmail.MailBody.Body) - pub enum Body { - // @@protoc_insertion_point(oneof_field:jwebmail.MailBody.discrete) - Discrete(::std::string::String), - // @@protoc_insertion_point(oneof_field:jwebmail.MailBody.multipart) - Multipart(Multipart), - // @@protoc_insertion_point(oneof_field:jwebmail.MailBody.mail) - Mail(super::Mail), - } - - impl ::protobuf::Oneof for Body { - } - - impl ::protobuf::OneofFull for Body { - fn descriptor() -> ::protobuf::reflect::OneofDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::OneofDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| <super::MailBody as ::protobuf::MessageFull>::descriptor().oneof_by_name("Body").unwrap()).clone() - } - } - - impl Body { - pub(in super) fn generated_oneof_descriptor_data() -> ::protobuf::reflect::GeneratedOneofDescriptorData { - ::protobuf::reflect::GeneratedOneofDescriptorData::new::<Body>("Body") - } - } - // @@protoc_insertion_point(message:jwebmail.MailBody.Multipart) - #[derive(PartialEq,Clone,Default,Debug)] - pub struct Multipart { - // message fields - // @@protoc_insertion_point(field:jwebmail.MailBody.Multipart.preamble) - pub preamble: ::std::option::Option<::std::string::String>, - // @@protoc_insertion_point(field:jwebmail.MailBody.Multipart.parts) - pub parts: ::std::vec::Vec<super::MIMEPart>, - // @@protoc_insertion_point(field:jwebmail.MailBody.Multipart.epilogue) - pub epilogue: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MailBody.Multipart.special_fields) - pub special_fields: ::protobuf::SpecialFields, - } - - impl<'a> ::std::default::Default for &'a Multipart { - fn default() -> &'a Multipart { - <Multipart as ::protobuf::Message>::default_instance() - } - } - - impl Multipart { - pub fn new() -> Multipart { - ::std::default::Default::default() - } - - pub(in super) 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_option_accessor::<_, _>( - "preamble", - |m: &Multipart| { &m.preamble }, - |m: &mut Multipart| { &mut m.preamble }, - )); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "parts", - |m: &Multipart| { &m.parts }, - |m: &mut Multipart| { &mut m.parts }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "epilogue", - |m: &Multipart| { &m.epilogue }, - |m: &mut Multipart| { &mut m.epilogue }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<Multipart>( - "MailBody.Multipart", - fields, - oneofs, - ) - } - } - - impl ::protobuf::Message for Multipart { - const NAME: &'static str = "Multipart"; - - 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.preamble = ::std::option::Option::Some(is.read_string()?); - }, - 18 => { - self.parts.push(is.read_message()?); - }, - 26 => { - self.epilogue = ::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; - if let Some(v) = self.preamble.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - for value in &self.parts { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - }; - if let Some(v) = self.epilogue.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<()> { - if let Some(v) = self.preamble.as_ref() { - os.write_string(1, v)?; - } - for v in &self.parts { - ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; - }; - if let Some(v) = self.epilogue.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() -> Multipart { - Multipart::new() - } - - fn clear(&mut self) { - self.preamble = ::std::option::Option::None; - self.parts.clear(); - self.epilogue = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static Multipart { - static instance: Multipart = Multipart { - preamble: ::std::option::Option::None, - parts: ::std::vec::Vec::new(), - epilogue: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } - } - - impl ::protobuf::MessageFull for Multipart { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MailBody.Multipart").unwrap()).clone() - } - } - - impl ::std::fmt::Display for Multipart { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } - } - - impl ::protobuf::reflect::ProtobufValue for Multipart { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; - } -} - -// @@protoc_insertion_point(message:jwebmail.Mail) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct Mail { - // message fields - // @@protoc_insertion_point(field:jwebmail.Mail.head) - pub head: ::protobuf::MessageField<MailHeader>, - // @@protoc_insertion_point(field:jwebmail.Mail.body) - pub body: ::protobuf::MessageField<MailBody>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.Mail.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a Mail { - fn default() -> &'a Mail { - <Mail as ::protobuf::Message>::default_instance() - } -} - -impl Mail { - pub fn new() -> Mail { - ::std::default::Default::default() - } - - 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_message_field_accessor::<_, MailHeader>( - "head", - |m: &Mail| { &m.head }, - |m: &mut Mail| { &mut m.head }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MailBody>( - "body", - |m: &Mail| { &m.body }, - |m: &mut Mail| { &mut m.body }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<Mail>( - "Mail", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for Mail { - const NAME: &'static str = "Mail"; - - 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 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.head)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.body)?; - }, - 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.head.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.body.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.head.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.body.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, 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() -> Mail { - Mail::new() - } - - fn clear(&mut self) { - self.head.clear(); - self.body.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static Mail { - static instance: Mail = Mail { - head: ::protobuf::MessageField::none(), - body: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for Mail { - 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("Mail").unwrap()).clone() - } -} - -impl ::std::fmt::Display for Mail { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Mail { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.MIMEPart) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MIMEPart { - // message fields - // @@protoc_insertion_point(field:jwebmail.MIMEPart.mime_header) - pub mime_header: ::protobuf::MessageField<MIMEHeader>, - // @@protoc_insertion_point(field:jwebmail.MIMEPart.body) - pub body: ::protobuf::MessageField<MailBody>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MIMEPart.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MIMEPart { - fn default() -> &'a MIMEPart { - <MIMEPart as ::protobuf::Message>::default_instance() - } -} - -impl MIMEPart { - pub fn new() -> MIMEPart { - ::std::default::Default::default() - } - - 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_message_field_accessor::<_, MIMEHeader>( - "mime_header", - |m: &MIMEPart| { &m.mime_header }, - |m: &mut MIMEPart| { &mut m.mime_header }, - )); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, MailBody>( - "body", - |m: &MIMEPart| { &m.body }, - |m: &mut MIMEPart| { &mut m.body }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MIMEPart>( - "MIMEPart", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MIMEPart { - const NAME: &'static str = "MIMEPart"; - - 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 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.mime_header)?; - }, - 18 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.body)?; - }, - 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.mime_header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if let Some(v) = self.body.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.mime_header.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if let Some(v) = self.body.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(2, 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() -> MIMEPart { - MIMEPart::new() - } - - fn clear(&mut self) { - self.mime_header.clear(); - self.body.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MIMEPart { - static instance: MIMEPart = MIMEPart { - mime_header: ::protobuf::MessageField::none(), - body: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MIMEPart { - 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("MIMEPart").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MIMEPart { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MIMEPart { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.ListReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ListReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.ListReq.folder) - pub folder: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.ListReq.start) - pub start: i32, - // @@protoc_insertion_point(field:jwebmail.ListReq.end) - pub end: i32, - // @@protoc_insertion_point(field:jwebmail.ListReq.sort) - pub sort: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.ListReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ListReq { - fn default() -> &'a ListReq { - <ListReq as ::protobuf::Message>::default_instance() - } -} - -impl ListReq { - pub fn new() -> ListReq { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "folder", - |m: &ListReq| { &m.folder }, - |m: &mut ListReq| { &mut m.folder }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "start", - |m: &ListReq| { &m.start }, - |m: &mut ListReq| { &mut m.start }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "end", - |m: &ListReq| { &m.end }, - |m: &mut ListReq| { &mut m.end }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "sort", - |m: &ListReq| { &m.sort }, - |m: &mut ListReq| { &mut m.sort }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ListReq>( - "ListReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ListReq { - const NAME: &'static str = "ListReq"; - - 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.folder = is.read_string()?; - }, - 16 => { - self.start = is.read_int32()?; - }, - 24 => { - self.end = is.read_int32()?; - }, - 34 => { - self.sort = 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; - if !self.folder.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.folder); - } - if self.start != 0 { - my_size += ::protobuf::rt::int32_size(2, self.start); - } - if self.end != 0 { - my_size += ::protobuf::rt::int32_size(3, self.end); - } - if !self.sort.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.sort); - } - 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.folder.is_empty() { - os.write_string(1, &self.folder)?; - } - if self.start != 0 { - os.write_int32(2, self.start)?; - } - if self.end != 0 { - os.write_int32(3, self.end)?; - } - if !self.sort.is_empty() { - os.write_string(4, &self.sort)?; - } - 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() -> ListReq { - ListReq::new() - } - - fn clear(&mut self) { - self.folder.clear(); - self.start = 0; - self.end = 0; - self.sort.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static ListReq { - static instance: ListReq = ListReq { - folder: ::std::string::String::new(), - start: 0, - end: 0, - sort: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ListReq { - 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("ListReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ListReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ListReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.ListResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ListResp { - // message fields - // @@protoc_insertion_point(field:jwebmail.ListResp.mail_heads) - pub mail_heads: ::std::vec::Vec<ListMailHeader>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.ListResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ListResp { - fn default() -> &'a ListResp { - <ListResp as ::protobuf::Message>::default_instance() - } -} - -impl ListResp { - pub fn new() -> ListResp { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "mail_heads", - |m: &ListResp| { &m.mail_heads }, - |m: &mut ListResp| { &mut m.mail_heads }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ListResp>( - "ListResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ListResp { - const NAME: &'static str = "ListResp"; - - 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.mail_heads.push(is.read_message()?); - }, - 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.mail_heads { - let len = value.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<()> { - for v in &self.mail_heads { - ::protobuf::rt::write_message_field_with_cached_size(1, 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() -> ListResp { - ListResp::new() - } - - fn clear(&mut self) { - self.mail_heads.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static ListResp { - static instance: ListResp = ListResp { - mail_heads: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ListResp { - 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("ListResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ListResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ListResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.StatsReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StatsReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.StatsReq.folder) - pub folder: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.StatsReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StatsReq { - fn default() -> &'a StatsReq { - <StatsReq as ::protobuf::Message>::default_instance() - } -} - -impl StatsReq { - pub fn new() -> StatsReq { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "folder", - |m: &StatsReq| { &m.folder }, - |m: &mut StatsReq| { &mut m.folder }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<StatsReq>( - "StatsReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StatsReq { - const NAME: &'static str = "StatsReq"; - - 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.folder = 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; - if !self.folder.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.folder); - } - 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.folder.is_empty() { - os.write_string(1, &self.folder)?; - } - 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() -> StatsReq { - StatsReq::new() - } - - fn clear(&mut self) { - self.folder.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static StatsReq { - static instance: StatsReq = StatsReq { - folder: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StatsReq { - 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("StatsReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StatsReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StatsReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.StatsResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct StatsResp { - // message fields - // @@protoc_insertion_point(field:jwebmail.StatsResp.mail_count) - pub mail_count: u32, - // @@protoc_insertion_point(field:jwebmail.StatsResp.unread_count) - pub unread_count: u32, - // @@protoc_insertion_point(field:jwebmail.StatsResp.byte_size) - pub byte_size: u64, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.StatsResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a StatsResp { - fn default() -> &'a StatsResp { - <StatsResp as ::protobuf::Message>::default_instance() - } -} - -impl StatsResp { - pub fn new() -> StatsResp { - ::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_simpler_field_accessor::<_, _>( - "mail_count", - |m: &StatsResp| { &m.mail_count }, - |m: &mut StatsResp| { &mut m.mail_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "unread_count", - |m: &StatsResp| { &m.unread_count }, - |m: &mut StatsResp| { &mut m.unread_count }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "byte_size", - |m: &StatsResp| { &m.byte_size }, - |m: &mut StatsResp| { &mut m.byte_size }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<StatsResp>( - "StatsResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for StatsResp { - const NAME: &'static str = "StatsResp"; - - 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.mail_count = is.read_uint32()?; - }, - 16 => { - self.unread_count = is.read_uint32()?; - }, - 24 => { - self.byte_size = is.read_uint64()?; - }, - 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.mail_count != 0 { - my_size += ::protobuf::rt::uint32_size(1, self.mail_count); - } - if self.unread_count != 0 { - my_size += ::protobuf::rt::uint32_size(2, self.unread_count); - } - if self.byte_size != 0 { - my_size += ::protobuf::rt::uint64_size(3, self.byte_size); - } - 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.mail_count != 0 { - os.write_uint32(1, self.mail_count)?; - } - if self.unread_count != 0 { - os.write_uint32(2, self.unread_count)?; - } - if self.byte_size != 0 { - os.write_uint64(3, self.byte_size)?; - } - 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() -> StatsResp { - StatsResp::new() - } - - fn clear(&mut self) { - self.mail_count = 0; - self.unread_count = 0; - self.byte_size = 0; - self.special_fields.clear(); - } - - fn default_instance() -> &'static StatsResp { - static instance: StatsResp = StatsResp { - mail_count: 0, - unread_count: 0, - byte_size: 0, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for StatsResp { - 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("StatsResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for StatsResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StatsResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.ShowReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ShowReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.ShowReq.folder) - pub folder: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.ShowReq.mid) - pub mid: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.ShowReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ShowReq { - fn default() -> &'a ShowReq { - <ShowReq as ::protobuf::Message>::default_instance() - } -} - -impl ShowReq { - pub fn new() -> ShowReq { - ::std::default::Default::default() - } - - 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_simpler_field_accessor::<_, _>( - "folder", - |m: &ShowReq| { &m.folder }, - |m: &mut ShowReq| { &mut m.folder }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "mid", - |m: &ShowReq| { &m.mid }, - |m: &mut ShowReq| { &mut m.mid }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ShowReq>( - "ShowReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ShowReq { - const NAME: &'static str = "ShowReq"; - - 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.folder = is.read_string()?; - }, - 18 => { - self.mid = 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; - if !self.folder.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.folder); - } - if !self.mid.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.mid); - } - 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.folder.is_empty() { - os.write_string(1, &self.folder)?; - } - if !self.mid.is_empty() { - os.write_string(2, &self.mid)?; - } - 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() -> ShowReq { - ShowReq::new() - } - - fn clear(&mut self) { - self.folder.clear(); - self.mid.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static ShowReq { - static instance: ShowReq = ShowReq { - folder: ::std::string::String::new(), - mid: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ShowReq { - 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("ShowReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ShowReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ShowReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.ShowResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct ShowResp { - // message fields - // @@protoc_insertion_point(field:jwebmail.ShowResp.mail) - pub mail: ::protobuf::MessageField<Mail>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.ShowResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a ShowResp { - fn default() -> &'a ShowResp { - <ShowResp as ::protobuf::Message>::default_instance() - } -} - -impl ShowResp { - pub fn new() -> ShowResp { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Mail>( - "mail", - |m: &ShowResp| { &m.mail }, - |m: &mut ShowResp| { &mut m.mail }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ShowResp>( - "ShowResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for ShowResp { - const NAME: &'static str = "ShowResp"; - - 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 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.mail)?; - }, - 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.mail.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.mail.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, 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() -> ShowResp { - ShowResp::new() - } - - fn clear(&mut self) { - self.mail.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static ShowResp { - static instance: ShowResp = ShowResp { - mail: ::protobuf::MessageField::none(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for ShowResp { - 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("ShowResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for ShowResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ShowResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.RawReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RawReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.RawReq.folder) - pub folder: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.RawReq.mid) - pub mid: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.RawReq.path) - pub path: ::std::option::Option<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.RawReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RawReq { - fn default() -> &'a RawReq { - <RawReq as ::protobuf::Message>::default_instance() - } -} - -impl RawReq { - pub fn new() -> RawReq { - ::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_simpler_field_accessor::<_, _>( - "folder", - |m: &RawReq| { &m.folder }, - |m: &mut RawReq| { &mut m.folder }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "mid", - |m: &RawReq| { &m.mid }, - |m: &mut RawReq| { &mut m.mid }, - )); - fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( - "path", - |m: &RawReq| { &m.path }, - |m: &mut RawReq| { &mut m.path }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<RawReq>( - "RawReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RawReq { - const NAME: &'static str = "RawReq"; - - 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.folder = is.read_string()?; - }, - 18 => { - self.mid = is.read_string()?; - }, - 26 => { - self.path = ::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; - if !self.folder.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.folder); - } - if !self.mid.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.mid); - } - if let Some(v) = self.path.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<()> { - if !self.folder.is_empty() { - os.write_string(1, &self.folder)?; - } - if !self.mid.is_empty() { - os.write_string(2, &self.mid)?; - } - if let Some(v) = self.path.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() -> RawReq { - RawReq::new() - } - - fn clear(&mut self) { - self.folder.clear(); - self.mid.clear(); - self.path = ::std::option::Option::None; - self.special_fields.clear(); - } - - fn default_instance() -> &'static RawReq { - static instance: RawReq = RawReq { - folder: ::std::string::String::new(), - mid: ::std::string::String::new(), - path: ::std::option::Option::None, - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RawReq { - 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("RawReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RawReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.RawResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RawResp { - // message fields - // @@protoc_insertion_point(field:jwebmail.RawResp.header) - pub header: ::protobuf::MessageField<MIMEHeader>, - // @@protoc_insertion_point(field:jwebmail.RawResp.body) - pub body: ::std::vec::Vec<u8>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.RawResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RawResp { - fn default() -> &'a RawResp { - <RawResp as ::protobuf::Message>::default_instance() - } -} - -impl RawResp { - pub fn new() -> RawResp { - ::std::default::Default::default() - } - - 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_message_field_accessor::<_, MIMEHeader>( - "header", - |m: &RawResp| { &m.header }, - |m: &mut RawResp| { &mut m.header }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "body", - |m: &RawResp| { &m.body }, - |m: &mut RawResp| { &mut m.body }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<RawResp>( - "RawResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RawResp { - const NAME: &'static str = "RawResp"; - - 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 => { - ::protobuf::rt::read_singular_message_into_field(is, &mut self.header)?; - }, - 18 => { - self.body = is.read_bytes()?; - }, - 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.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; - } - if !self.body.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.body); - } - 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.header.as_ref() { - ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; - } - if !self.body.is_empty() { - os.write_bytes(2, &self.body)?; - } - 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() -> RawResp { - RawResp::new() - } - - fn clear(&mut self) { - self.header.clear(); - self.body.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static RawResp { - static instance: RawResp = RawResp { - header: ::protobuf::MessageField::none(), - body: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RawResp { - 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("RawResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RawResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.SearchReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SearchReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.SearchReq.folder) - pub folder: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.SearchReq.pattern) - pub pattern: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.SearchReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SearchReq { - fn default() -> &'a SearchReq { - <SearchReq as ::protobuf::Message>::default_instance() - } -} - -impl SearchReq { - pub fn new() -> SearchReq { - ::std::default::Default::default() - } - - 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_simpler_field_accessor::<_, _>( - "folder", - |m: &SearchReq| { &m.folder }, - |m: &mut SearchReq| { &mut m.folder }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "pattern", - |m: &SearchReq| { &m.pattern }, - |m: &mut SearchReq| { &mut m.pattern }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SearchReq>( - "SearchReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SearchReq { - const NAME: &'static str = "SearchReq"; - - 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.folder = is.read_string()?; - }, - 18 => { - self.pattern = 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; - if !self.folder.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.folder); - } - if !self.pattern.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.pattern); - } - 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.folder.is_empty() { - os.write_string(1, &self.folder)?; - } - if !self.pattern.is_empty() { - os.write_string(2, &self.pattern)?; - } - 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() -> SearchReq { - SearchReq::new() - } - - fn clear(&mut self) { - self.folder.clear(); - self.pattern.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static SearchReq { - static instance: SearchReq = SearchReq { - folder: ::std::string::String::new(), - pattern: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SearchReq { - 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("SearchReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SearchReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SearchReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.SearchResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct SearchResp { - // message fields - // @@protoc_insertion_point(field:jwebmail.SearchResp.found) - pub found: ::std::vec::Vec<ListMailHeader>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.SearchResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a SearchResp { - fn default() -> &'a SearchResp { - <SearchResp as ::protobuf::Message>::default_instance() - } -} - -impl SearchResp { - pub fn new() -> SearchResp { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "found", - |m: &SearchResp| { &m.found }, - |m: &mut SearchResp| { &mut m.found }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SearchResp>( - "SearchResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for SearchResp { - const NAME: &'static str = "SearchResp"; - - 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.found.push(is.read_message()?); - }, - 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.found { - let len = value.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<()> { - for v in &self.found { - ::protobuf::rt::write_message_field_with_cached_size(1, 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() -> SearchResp { - SearchResp::new() - } - - fn clear(&mut self) { - self.found.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static SearchResp { - static instance: SearchResp = SearchResp { - found: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for SearchResp { - 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("SearchResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for SearchResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SearchResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.FoldersReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct FoldersReq { - // special fields - // @@protoc_insertion_point(special_field:jwebmail.FoldersReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a FoldersReq { - fn default() -> &'a FoldersReq { - <FoldersReq as ::protobuf::Message>::default_instance() - } -} - -impl FoldersReq { - pub fn new() -> FoldersReq { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<FoldersReq>( - "FoldersReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for FoldersReq { - const NAME: &'static str = "FoldersReq"; - - 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 { - 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; - 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<()> { - 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() -> FoldersReq { - FoldersReq::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static FoldersReq { - static instance: FoldersReq = FoldersReq { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for FoldersReq { - 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("FoldersReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for FoldersReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FoldersReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.FoldersResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct FoldersResp { - // message fields - // @@protoc_insertion_point(field:jwebmail.FoldersResp.folders) - pub folders: ::std::vec::Vec<::std::string::String>, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.FoldersResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a FoldersResp { - fn default() -> &'a FoldersResp { - <FoldersResp as ::protobuf::Message>::default_instance() - } -} - -impl FoldersResp { - pub fn new() -> FoldersResp { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( - "folders", - |m: &FoldersResp| { &m.folders }, - |m: &mut FoldersResp| { &mut m.folders }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<FoldersResp>( - "FoldersResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for FoldersResp { - const NAME: &'static str = "FoldersResp"; - - 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.folders.push(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.folders { - my_size += ::protobuf::rt::string_size(1, &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<()> { - for v in &self.folders { - os.write_string(1, &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() -> FoldersResp { - FoldersResp::new() - } - - fn clear(&mut self) { - self.folders.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static FoldersResp { - static instance: FoldersResp = FoldersResp { - folders: ::std::vec::Vec::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for FoldersResp { - 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("FoldersResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for FoldersResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for FoldersResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.MoveReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoveReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.MoveReq.mid) - pub mid: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.MoveReq.from_f) - pub from_f: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.MoveReq.to_f) - pub to_f: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MoveReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoveReq { - fn default() -> &'a MoveReq { - <MoveReq as ::protobuf::Message>::default_instance() - } -} - -impl MoveReq { - pub fn new() -> MoveReq { - ::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_simpler_field_accessor::<_, _>( - "mid", - |m: &MoveReq| { &m.mid }, - |m: &mut MoveReq| { &mut m.mid }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "from_f", - |m: &MoveReq| { &m.from_f }, - |m: &mut MoveReq| { &mut m.from_f }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "to_f", - |m: &MoveReq| { &m.to_f }, - |m: &mut MoveReq| { &mut m.to_f }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MoveReq>( - "MoveReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoveReq { - const NAME: &'static str = "MoveReq"; - - 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.mid = is.read_string()?; - }, - 18 => { - self.from_f = is.read_string()?; - }, - 26 => { - self.to_f = 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; - if !self.mid.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.mid); - } - if !self.from_f.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.from_f); - } - if !self.to_f.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.to_f); - } - 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.mid.is_empty() { - os.write_string(1, &self.mid)?; - } - if !self.from_f.is_empty() { - os.write_string(2, &self.from_f)?; - } - if !self.to_f.is_empty() { - os.write_string(3, &self.to_f)?; - } - 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() -> MoveReq { - MoveReq::new() - } - - fn clear(&mut self) { - self.mid.clear(); - self.from_f.clear(); - self.to_f.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoveReq { - static instance: MoveReq = MoveReq { - mid: ::std::string::String::new(), - from_f: ::std::string::String::new(), - to_f: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoveReq { - 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("MoveReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoveReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoveReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.MoveResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MoveResp { - // special fields - // @@protoc_insertion_point(special_field:jwebmail.MoveResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MoveResp { - fn default() -> &'a MoveResp { - <MoveResp as ::protobuf::Message>::default_instance() - } -} - -impl MoveResp { - pub fn new() -> MoveResp { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<MoveResp>( - "MoveResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MoveResp { - const NAME: &'static str = "MoveResp"; - - 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 { - 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; - 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<()> { - 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() -> MoveResp { - MoveResp::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static MoveResp { - static instance: MoveResp = MoveResp { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MoveResp { - 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("MoveResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MoveResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MoveResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.RemoveReq) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RemoveReq { - // message fields - // @@protoc_insertion_point(field:jwebmail.RemoveReq.folder) - pub folder: ::std::string::String, - // @@protoc_insertion_point(field:jwebmail.RemoveReq.mid) - pub mid: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:jwebmail.RemoveReq.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RemoveReq { - fn default() -> &'a RemoveReq { - <RemoveReq as ::protobuf::Message>::default_instance() - } -} - -impl RemoveReq { - pub fn new() -> RemoveReq { - ::std::default::Default::default() - } - - 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_simpler_field_accessor::<_, _>( - "folder", - |m: &RemoveReq| { &m.folder }, - |m: &mut RemoveReq| { &mut m.folder }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "mid", - |m: &RemoveReq| { &m.mid }, - |m: &mut RemoveReq| { &mut m.mid }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<RemoveReq>( - "RemoveReq", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RemoveReq { - const NAME: &'static str = "RemoveReq"; - - 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.folder = is.read_string()?; - }, - 18 => { - self.mid = 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; - if !self.folder.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.folder); - } - if !self.mid.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.mid); - } - 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.folder.is_empty() { - os.write_string(1, &self.folder)?; - } - if !self.mid.is_empty() { - os.write_string(2, &self.mid)?; - } - 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() -> RemoveReq { - RemoveReq::new() - } - - fn clear(&mut self) { - self.folder.clear(); - self.mid.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static RemoveReq { - static instance: RemoveReq = RemoveReq { - folder: ::std::string::String::new(), - mid: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RemoveReq { - 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("RemoveReq").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RemoveReq { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RemoveReq { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -// @@protoc_insertion_point(message:jwebmail.RemoveResp) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct RemoveResp { - // special fields - // @@protoc_insertion_point(special_field:jwebmail.RemoveResp.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a RemoveResp { - fn default() -> &'a RemoveResp { - <RemoveResp as ::protobuf::Message>::default_instance() - } -} - -impl RemoveResp { - pub fn new() -> RemoveResp { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(0); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<RemoveResp>( - "RemoveResp", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for RemoveResp { - const NAME: &'static str = "RemoveResp"; - - 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 { - 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; - 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<()> { - 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() -> RemoveResp { - RemoveResp::new() - } - - fn clear(&mut self) { - self.special_fields.clear(); - } - - fn default_instance() -> &'static RemoveResp { - static instance: RemoveResp = RemoveResp { - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for RemoveResp { - 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("RemoveResp").unwrap()).clone() - } -} - -impl ::std::fmt::Display for RemoveResp { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RemoveResp { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0ejwebmail.proto\x12\x08jwebmail\"\xb7\x02\n\nMIMEHeader\x12\x1a\n\ - \x08maintype\x18\x01\x20\x01(\tR\x08maintype\x12\x18\n\x07subtype\x18\ - \x02\x20\x01(\tR\x07subtype\x12K\n\x0ccontentdispo\x18\x03\x20\x01(\x0e2\ - '.jwebmail.MIMEHeader.ContentDispositionR\x0ccontentdispo\x12\x20\n\tfil\ - e_name\x18\x04\x20\x01(\tH\0R\x08fileName\x88\x01\x01\"v\n\x12ContentDis\ - position\x12\x1c\n\x18CONTENT_DISPOSITION_NONE\x10\0\x12\x1e\n\x1aCONTEN\ - T_DISPOSITION_INLINE\x10\x01\x12\"\n\x1eCONTENT_DISPOSITION_ATTACHMENT\ - \x10\x02B\x0c\n\n_file_name\"\xc8\x04\n\nMailHeader\x12\x1b\n\tsend_date\ - \x18\x01\x20\x01(\tR\x08sendDate\x12@\n\x0cwritten_from\x18\x02\x20\x03(\ - \x0b2\x1d.jwebmail.MailHeader.MailAddrR\x0bwrittenFrom\x12:\n\x06sender\ - \x18\x03\x20\x01(\x0b2\x1d.jwebmail.MailHeader.MailAddrH\0R\x06sender\ - \x88\x01\x01\x128\n\x08reply_to\x18\x04\x20\x03(\x0b2\x1d.jwebmail.MailH\ - eader.MailAddrR\x07replyTo\x126\n\x07send_to\x18\x05\x20\x03(\x0b2\x1d.j\ - webmail.MailHeader.MailAddrR\x06sendTo\x12-\n\x02cc\x18\x06\x20\x03(\x0b\ - 2\x1d.jwebmail.MailHeader.MailAddrR\x02cc\x12/\n\x03bcc\x18\x07\x20\x03(\ - \x0b2\x1d.jwebmail.MailHeader.MailAddrR\x03bcc\x12\x18\n\x07subject\x18\ - \x08\x20\x01(\tR\x07subject\x12\x1a\n\x08comments\x18\t\x20\x03(\tR\x08c\ - omments\x12\x1a\n\x08keywords\x18\n\x20\x03(\tR\x08keywords\x12(\n\x04mi\ - me\x18\x0b\x20\x01(\x0b2\x14.jwebmail.MIMEHeaderR\x04mime\x1aF\n\x08Mail\ - Addr\x12\x17\n\x04name\x18\x01\x20\x01(\tH\0R\x04name\x88\x01\x01\x12\ - \x18\n\x07address\x18\x02\x20\x01(\tR\x07addressB\x07\n\x05_nameB\t\n\ - \x07_sender\"\xa0\x01\n\x0eListMailHeader\x12\x1b\n\tbyte_size\x18\x01\ - \x20\x01(\x04R\x08byteSize\x12\x16\n\x06unread\x18\x02\x20\x01(\x08R\x06\ - unread\x12\x19\n\x08rec_date\x18\x03\x20\x01(\tR\x07recDate\x12\x10\n\ - \x03mid\x18\x04\x20\x01(\tR\x03mid\x12,\n\x06header\x18\x05\x20\x01(\x0b\ - 2\x14.jwebmail.MailHeaderR\x06header\"\xa8\x02\n\x08MailBody\x12\x1c\n\ - \x08discrete\x18\x01\x20\x01(\tH\0R\x08discrete\x12<\n\tmultipart\x18\ - \x02\x20\x01(\x0b2\x1c.jwebmail.MailBody.MultipartH\0R\tmultipart\x12$\n\ - \x04mail\x18\x03\x20\x01(\x0b2\x0e.jwebmail.MailH\0R\x04mail\x1a\x91\x01\ - \n\tMultipart\x12\x1f\n\x08preamble\x18\x01\x20\x01(\tH\0R\x08preamble\ - \x88\x01\x01\x12(\n\x05parts\x18\x02\x20\x03(\x0b2\x12.jwebmail.MIMEPart\ - R\x05parts\x12\x1f\n\x08epilogue\x18\x03\x20\x01(\tH\x01R\x08epilogue\ - \x88\x01\x01B\x0b\n\t_preambleB\x0b\n\t_epilogueB\x06\n\x04Body\"X\n\x04\ - Mail\x12(\n\x04head\x18\x01\x20\x01(\x0b2\x14.jwebmail.MailHeaderR\x04he\ - ad\x12&\n\x04body\x18\x02\x20\x01(\x0b2\x12.jwebmail.MailBodyR\x04body\"\ - i\n\x08MIMEPart\x125\n\x0bmime_header\x18\x01\x20\x01(\x0b2\x14.jwebmail\ - .MIMEHeaderR\nmimeHeader\x12&\n\x04body\x18\x02\x20\x01(\x0b2\x12.jwebma\ - il.MailBodyR\x04body\"]\n\x07ListReq\x12\x16\n\x06folder\x18\x01\x20\x01\ - (\tR\x06folder\x12\x14\n\x05start\x18\x02\x20\x01(\x05R\x05start\x12\x10\ - \n\x03end\x18\x03\x20\x01(\x05R\x03end\x12\x12\n\x04sort\x18\x04\x20\x01\ - (\tR\x04sort\"C\n\x08ListResp\x127\n\nmail_heads\x18\x01\x20\x03(\x0b2\ - \x18.jwebmail.ListMailHeaderR\tmailHeads\"\"\n\x08StatsReq\x12\x16\n\x06\ - folder\x18\x01\x20\x01(\tR\x06folder\"j\n\tStatsResp\x12\x1d\n\nmail_cou\ - nt\x18\x01\x20\x01(\rR\tmailCount\x12!\n\x0cunread_count\x18\x02\x20\x01\ - (\rR\x0bunreadCount\x12\x1b\n\tbyte_size\x18\x03\x20\x01(\x04R\x08byteSi\ - ze\"3\n\x07ShowReq\x12\x16\n\x06folder\x18\x01\x20\x01(\tR\x06folder\x12\ - \x10\n\x03mid\x18\x02\x20\x01(\tR\x03mid\".\n\x08ShowResp\x12\"\n\x04mai\ - l\x18\x01\x20\x01(\x0b2\x0e.jwebmail.MailR\x04mail\"T\n\x06RawReq\x12\ - \x16\n\x06folder\x18\x01\x20\x01(\tR\x06folder\x12\x10\n\x03mid\x18\x02\ - \x20\x01(\tR\x03mid\x12\x17\n\x04path\x18\x03\x20\x01(\tH\0R\x04path\x88\ - \x01\x01B\x07\n\x05_path\"K\n\x07RawResp\x12,\n\x06header\x18\x01\x20\ - \x01(\x0b2\x14.jwebmail.MIMEHeaderR\x06header\x12\x12\n\x04body\x18\x02\ - \x20\x01(\x0cR\x04body\"=\n\tSearchReq\x12\x16\n\x06folder\x18\x01\x20\ - \x01(\tR\x06folder\x12\x18\n\x07pattern\x18\x02\x20\x01(\tR\x07pattern\"\ - <\n\nSearchResp\x12.\n\x05found\x18\x01\x20\x03(\x0b2\x18.jwebmail.ListM\ - ailHeaderR\x05found\"\x0c\n\nFoldersReq\"'\n\x0bFoldersResp\x12\x18\n\ - \x07folders\x18\x01\x20\x03(\tR\x07folders\"E\n\x07MoveReq\x12\x10\n\x03\ - mid\x18\x01\x20\x01(\tR\x03mid\x12\x15\n\x06from_f\x18\x02\x20\x01(\tR\ - \x05fromF\x12\x11\n\x04to_f\x18\x03\x20\x01(\tR\x03toF\"\n\n\x08MoveResp\ - \"5\n\tRemoveReq\x12\x16\n\x06folder\x18\x01\x20\x01(\tR\x06folder\x12\ - \x10\n\x03mid\x18\x02\x20\x01(\tR\x03mid\"\x0c\n\nRemoveResp2\x9a\x03\n\ - \x0bMailService\x12-\n\x04List\x12\x11.jwebmail.ListReq\x1a\x12.jwebmail\ - .ListResp\x120\n\x05Stats\x12\x12.jwebmail.StatsReq\x1a\x13.jwebmail.Sta\ - tsResp\x12-\n\x04Show\x12\x11.jwebmail.ShowReq\x1a\x12.jwebmail.ShowResp\ - \x12*\n\x03Raw\x12\x10.jwebmail.RawReq\x1a\x11.jwebmail.RawResp\x123\n\ - \x06Search\x12\x13.jwebmail.SearchReq\x1a\x14.jwebmail.SearchResp\x126\n\ - \x07Folders\x12\x14.jwebmail.FoldersReq\x1a\x15.jwebmail.FoldersResp\x12\ - -\n\x04Move\x12\x11.jwebmail.MoveReq\x1a\x12.jwebmail.MoveResp\x123\n\ - \x06Remove\x12\x13.jwebmail.RemoveReq\x1a\x14.jwebmail.RemoveRespb\x06pr\ - oto3\ -"; - -/// `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(24); - messages.push(MIMEHeader::generated_message_descriptor_data()); - messages.push(MailHeader::generated_message_descriptor_data()); - messages.push(ListMailHeader::generated_message_descriptor_data()); - messages.push(MailBody::generated_message_descriptor_data()); - messages.push(Mail::generated_message_descriptor_data()); - messages.push(MIMEPart::generated_message_descriptor_data()); - messages.push(ListReq::generated_message_descriptor_data()); - messages.push(ListResp::generated_message_descriptor_data()); - messages.push(StatsReq::generated_message_descriptor_data()); - messages.push(StatsResp::generated_message_descriptor_data()); - messages.push(ShowReq::generated_message_descriptor_data()); - messages.push(ShowResp::generated_message_descriptor_data()); - messages.push(RawReq::generated_message_descriptor_data()); - messages.push(RawResp::generated_message_descriptor_data()); - messages.push(SearchReq::generated_message_descriptor_data()); - messages.push(SearchResp::generated_message_descriptor_data()); - messages.push(FoldersReq::generated_message_descriptor_data()); - messages.push(FoldersResp::generated_message_descriptor_data()); - messages.push(MoveReq::generated_message_descriptor_data()); - messages.push(MoveResp::generated_message_descriptor_data()); - messages.push(RemoveReq::generated_message_descriptor_data()); - messages.push(RemoveResp::generated_message_descriptor_data()); - messages.push(mail_header::MailAddr::generated_message_descriptor_data()); - messages.push(mail_body::Multipart::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(1); - enums.push(mimeheader::ContentDisposition::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/rfc822.rs b/src/rfc822.rs index aafedde..658b167 100644 --- a/src/rfc822.rs +++ b/src/rfc822.rs @@ -1,4 +1,4 @@ -use chrono::NaiveDateTime; +use chrono::DateTime; use mailparse::{addrparse_header, body::Body, dateparse, DispositionType, ParsedMail}; use crate::error::{Error, Result}; @@ -48,9 +48,8 @@ pub fn me_to_lmh(mut me: maildir::MailEntry) -> Result<ListMailHeader> { let mut lmh = ListMailHeader::new(); lmh.byte_size = me.path().metadata()?.len(); lmh.unread = !me.is_seen(); - lmh.rec_date = NaiveDateTime::from_timestamp_opt(get_received(&mut me), 0) + lmh.rec_date = DateTime::from_timestamp(get_received(&mut me), 0) .unwrap() - .and_utc() .to_rfc3339(); lmh.mid = me.id().to_owned(); lmh.header = Some(parse_mail_header(&me.parsed()?)?).into(); @@ -77,7 +76,7 @@ pub fn parse_mail_content(v: &ParsedMail) -> Result<MIMEHeader> { DispositionType::Attachment => { c.contentdispo = CONTENT_DISPOSITION_ATTACHMENT.into(); if let Some(fname) = v.get_content_disposition().params.remove("filename") { - c.file_name = Some(fname).into(); + c.file_name = Some(fname); } } _ => {} @@ -89,11 +88,8 @@ pub fn parse_mail_content(v: &ParsedMail) -> Result<MIMEHeader> { key.make_ascii_lowercase(); - match key.as_ref() { - "filename" => { - c.file_name = Some(val).into(); - } - _ => {} + if key == "filename" { + c.file_name = Some(val); } } @@ -127,9 +123,8 @@ fn parse_mail_header(pm: &ParsedMail) -> Result<MailHeader> { match key.as_str() { "date" => { - mh.send_date = NaiveDateTime::from_timestamp_opt(dateparse(&val)?, 0) + mh.send_date = DateTime::from_timestamp(dateparse(&val)?, 0) .unwrap() - .and_utc() .to_rfc3339() } "from" => { @@ -314,13 +309,10 @@ fn find_pair(offset: usize, s: &str) -> Option<std::ops::Range<usize>> { fn strip_comments(s: &mut String) { let mut off = 0; - loop { - if let Some(r) = find_pair(off, &s[off..]) { - s.drain(r.clone()); - off = r.start; - } else { - break; - } + + while let Some(r) = find_pair(off, &s[off..]) { + s.drain(r.clone()); + off = r.start; } } |