diff --git a/src/types/common.rs b/src/types/common.rs index 66f439b..5b29384 100644 --- a/src/types/common.rs +++ b/src/types/common.rs @@ -16,7 +16,7 @@ pub(crate) const TYPES_NS_URI: &str = "http://schemas.microsoft.com/exchange/ser /// The folder properties which should be included in the response. /// /// See . -#[derive(Debug, Default, XmlSerialize)] +#[derive(Clone, Debug, Default, XmlSerialize)] pub struct FolderShape { #[xml_struct(ns_prefix = "t")] pub base_shape: BaseShape, @@ -25,7 +25,7 @@ pub struct FolderShape { /// The item properties which should be included in the response. /// /// See . -#[derive(Debug, Default, XmlSerialize)] +#[derive(Clone, Debug, Default, XmlSerialize)] pub struct ItemShape { /// The base set of properties to include, which may be extended by other /// fields. @@ -49,7 +49,7 @@ pub struct ItemShape { } /// An identifier for a property on an Exchange entity. -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(variant_ns_prefix = "t")] pub enum PathToElement { /// An identifier for an extended MAPI property. @@ -131,7 +131,7 @@ pub enum PathToElement { // which follows the same structure. However, xml-struct doesn't currently // support using a nested structure to define an element's attributes, see // https://github.com/thunderbird/xml-struct-rs/issues/9 -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] pub struct ExtendedFieldURI { /// A well-known identifier for a property set. #[xml_struct(attribute)] @@ -241,7 +241,7 @@ pub enum ResponseClass { /// any. /// /// See -#[derive(Debug, Deserialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, PartialEq)] pub struct ResponseCode(pub String); impl From for ResponseCode @@ -254,7 +254,7 @@ where } /// An identifier for an Exchange folder. -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(variant_ns_prefix = "t")] pub enum BaseFolderId { /// An identifier for an arbitrary folder. @@ -284,7 +284,7 @@ pub enum BaseFolderId { /// The unique identifier of a folder. /// /// See -#[derive(Debug, Deserialize, PartialEq, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, PartialEq, XmlSerialize)] pub struct FolderId { #[serde(rename = "@Id")] pub id: String, @@ -297,7 +297,7 @@ pub struct FolderId { /// /// See // N.B.: Commented-out variants are not yet implemented. -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(variant_ns_prefix = "t")] pub enum BaseItemId { /// An identifier for a standard Exchange item. @@ -327,7 +327,7 @@ pub struct ItemId { } /// The representation of a folder in an EWS operation. -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub enum Folder { /// A calendar folder in a mailbox. /// @@ -397,7 +397,7 @@ pub enum Folder { } /// An array of items. -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub struct Items { #[serde(rename = "$value", default)] pub inner: Vec, @@ -407,7 +407,7 @@ pub struct Items { /// Exchange item. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub enum RealItem { Message(Message), } @@ -417,7 +417,7 @@ pub enum RealItem { /// See [`Attachment::ItemAttachment`] for details. // N.B.: Commented-out variants are not yet implemented. #[non_exhaustive] -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub enum AttachmentItem { // Item(Item), Message(Message), @@ -433,7 +433,7 @@ pub enum AttachmentItem { /// A date and time with second precision. // `time` provides an `Option` deserializer, but it does not // work with map fields which may be omitted, as in our case. -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub struct DateTime(#[serde(with = "time::serde::iso8601")] pub time::OffsetDateTime); impl XmlSerialize for DateTime { @@ -458,7 +458,7 @@ impl XmlSerialize for DateTime { /// An email message. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Message { /// The MIME content of the item. @@ -531,7 +531,7 @@ pub struct Message { /// A list of attachments. /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] pub struct Attachments { #[serde(rename = "$value")] #[xml_struct(flatten)] @@ -540,7 +540,7 @@ pub struct Attachments { /// A newtype around a vector of `Recipient`s, that is deserialized using /// `deserialize_recipients`. -#[derive(Debug, Default, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Default, Deserialize, XmlSerialize)] pub struct ArrayOfRecipients( #[serde(deserialize_with = "deserialize_recipients")] pub Vec, ); @@ -560,7 +560,7 @@ impl DerefMut for ArrayOfRecipients { } /// A single mailbox. -#[derive(Debug, Deserialize, XmlSerialize, PartialEq)] +#[derive(Clone, Debug, Deserialize, XmlSerialize, PartialEq)] #[serde(rename_all = "PascalCase")] pub struct Recipient { #[xml_struct(ns_prefix = "t")] @@ -580,7 +580,7 @@ fn deserialize_recipients<'de, D>(deserializer: D) -> Result, D:: where D: Deserializer<'de>, { - #[derive(Debug, Deserialize)] + #[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] struct MailboxSequence { mailbox: Vec, @@ -596,7 +596,7 @@ where } /// A list of Internet Message Format headers. -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] #[serde(rename_all = "PascalCase")] pub struct InternetMessageHeaders { pub internet_message_header: Vec, @@ -672,7 +672,7 @@ pub enum Importance { /// A string value. /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] #[serde(rename_all = "PascalCase")] pub struct StringElement { /// The string content. @@ -694,7 +694,7 @@ pub enum Sensitivity { /// The body of an item. /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] pub struct Body { /// The content type of the body. #[serde(rename = "@BodyType")] @@ -727,7 +727,7 @@ pub enum BodyType { /// An attachment to an Exchange item. /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] pub enum Attachment { /// An attachment containing an Exchange item. /// @@ -843,7 +843,7 @@ pub enum Attachment { /// An identifier for an attachment. /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] pub struct AttachmentId { /// A unique identifier for the attachment. #[serde(rename = "@Id")] @@ -865,7 +865,7 @@ pub struct AttachmentId { /// Mail Extensions). /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] pub struct MimeContent { /// The character set of the MIME content if it contains [RFC 2045]-encoded /// text. @@ -884,7 +884,7 @@ pub struct MimeContent { /// The headers of an Exchange item's MIME content. /// /// See -#[derive(Debug, Deserialize, XmlSerialize)] +#[derive(Clone, Debug, Deserialize, XmlSerialize)] #[serde(rename_all = "PascalCase")] pub struct InternetMessageHeader { /// The name of the header. @@ -906,7 +906,7 @@ pub struct InternetMessageHeader { /// provided as additional fields of this structure. /// /// See -#[derive(Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] #[non_exhaustive] pub struct MessageXml { /// A text representation of the contents of the field. diff --git a/src/types/create_item.rs b/src/types/create_item.rs index 3f27df7..28e0cad 100644 --- a/src/types/create_item.rs +++ b/src/types/create_item.rs @@ -13,7 +13,7 @@ use crate::{ /// The action an Exchange server will take upon creating a `Message` item. /// /// See -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(text)] pub enum MessageDisposition { SaveOnly, @@ -24,7 +24,7 @@ pub enum MessageDisposition { /// A request to create (and optionally send) one or more Exchange item(s). /// /// See -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(default_ns = MESSAGES_NS_URI)] pub struct CreateItem { /// The action the Exchange server will take upon creating this item. @@ -55,7 +55,7 @@ pub struct CreateItem { /// See // N.B.: Commented-out variants are not yet implemented. #[non_exhaustive] -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(variant_ns_prefix = "t")] pub enum Item { // Item(Item), @@ -79,7 +79,7 @@ pub enum Item { /// See /// /// [`common::message`]: crate::Message -#[derive(Debug, Default, XmlSerialize)] +#[derive(Clone, Debug, Default, XmlSerialize)] pub struct Message { /// The MIME content of the item. #[xml_struct(ns_prefix = "t")] @@ -107,7 +107,7 @@ pub struct Message { /// /// See #[allow(non_snake_case)] -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] pub struct ExtendedProperty { #[xml_struct(ns_prefix = "t")] pub extended_field_URI: ExtendedFieldURI, @@ -129,7 +129,7 @@ impl EnvelopeBodyContents for CreateItem { /// A response to a [`CreateItem`] request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct CreateItemResponse { pub response_messages: ResponseMessages, @@ -143,13 +143,13 @@ impl EnvelopeBodyContents for CreateItemResponse { } } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ResponseMessages { pub create_item_response_message: Vec, } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct CreateItemResponseMessage { /// The status of the corresponding request, i.e. whether it succeeded or diff --git a/src/types/get_folder.rs b/src/types/get_folder.rs index 574b1e0..d8772bb 100644 --- a/src/types/get_folder.rs +++ b/src/types/get_folder.rs @@ -13,7 +13,7 @@ use crate::{ /// A request to get information on one or more folders. /// /// See -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(default_ns = MESSAGES_NS_URI)] pub struct GetFolder { /// A description of the information to be included in the response for each @@ -37,7 +37,7 @@ impl EnvelopeBodyContents for GetFolder { /// A response to a [`GetFolder`] request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct GetFolderResponse { pub response_messages: ResponseMessages, @@ -54,7 +54,7 @@ impl EnvelopeBodyContents for GetFolderResponse { /// A collection of responses for individual entities within a request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ResponseMessages { pub get_folder_response_message: Vec, @@ -63,7 +63,7 @@ pub struct ResponseMessages { /// A response to a request for an individual folder within a [`GetFolder`] operation. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct GetFolderResponseMessage { /// The status of the corresponding request, i.e. whether it succeeded or @@ -78,7 +78,7 @@ pub struct GetFolderResponseMessage { /// A collection of information on Exchange folders. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub struct Folders { #[serde(rename = "$value")] pub inner: Vec, diff --git a/src/types/get_item.rs b/src/types/get_item.rs index ce05972..b0eded5 100644 --- a/src/types/get_item.rs +++ b/src/types/get_item.rs @@ -14,7 +14,7 @@ use crate::{ /// calendar events, or contacts. /// /// See -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(default_ns = MESSAGES_NS_URI)] pub struct GetItem { /// A description of the information to be included in the response for each @@ -42,7 +42,7 @@ impl EnvelopeBodyContents for GetItem { /// A response to a [`GetItem`] request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct GetItemResponse { pub response_messages: ResponseMessages, @@ -56,13 +56,13 @@ impl EnvelopeBodyContents for GetItemResponse { } } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ResponseMessages { pub get_item_response_message: Vec, } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct GetItemResponseMessage { /// The status of the corresponding request, i.e. whether it succeeded or diff --git a/src/types/operations.rs b/src/types/operations.rs index 857a647..eabc81c 100644 --- a/src/types/operations.rs +++ b/src/types/operations.rs @@ -15,7 +15,7 @@ use xml_struct::XmlSerialize; /// See [`Envelope`] for details. /// /// [`Envelope`]: crate::soap::Envelope -pub trait Operation: XmlSerialize + sealed::EnvelopeBodyContents { +pub trait Operation: XmlSerialize + sealed::EnvelopeBodyContents + std::fmt::Debug { /// The structure returned by EWS in response to requests containing this /// operation. type Response: OperationResponse; @@ -31,7 +31,10 @@ pub trait Operation: XmlSerialize + sealed::EnvelopeBodyContents { /// See [`Envelope`] for details. /// /// [`Envelope`]: crate::soap::Envelope -pub trait OperationResponse: for<'de> Deserialize<'de> + sealed::EnvelopeBodyContents {} +pub trait OperationResponse: + for<'de> Deserialize<'de> + sealed::EnvelopeBodyContents + std::fmt::Debug +{ +} pub(super) mod sealed { /// A trait for structures which may appear in the body of a SOAP envelope. diff --git a/src/types/soap.rs b/src/types/soap.rs index 2006f41..ec8ccf8 100644 --- a/src/types/soap.rs +++ b/src/types/soap.rs @@ -17,7 +17,7 @@ use self::de::DeserializeEnvelope; /// A SOAP envelope containing the body of an EWS operation or response. /// /// See -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Envelope { pub body: B, } @@ -338,7 +338,7 @@ impl<'content> ScopedReader<'content> { /// request. /// /// See -#[derive(Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] pub struct Fault { /// An error code indicating the fault in the original request. // While `faultcode` is defined in the SOAP spec as a `QName`, we avoid @@ -362,7 +362,7 @@ pub struct Fault { /// EWS-specific details regarding a SOAP fault. /// /// This element is not documented in the EWS reference. -#[derive(Debug, Default, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq)] #[non_exhaustive] pub struct FaultDetail { /// An error code indicating the nature of the issue. @@ -400,7 +400,7 @@ mod tests { #[test] fn deserialize_envelope_with_content() { - #[derive(Deserialize)] + #[derive(Clone, Debug, Deserialize)] struct SomeStruct { text: String, @@ -432,7 +432,7 @@ mod tests { #[test] fn deserialize_envelope_with_schema_fault() { - #[derive(Debug, Deserialize)] + #[derive(Clone, Debug, Deserialize)] struct Foo; impl OperationResponse for Foo {} @@ -485,7 +485,7 @@ mod tests { #[test] fn deserialize_envelope_with_server_busy_fault() { - #[derive(Debug, Deserialize)] + #[derive(Clone, Debug, Deserialize)] struct Foo; impl OperationResponse for Foo {} diff --git a/src/types/sync_folder_hierarchy.rs b/src/types/sync_folder_hierarchy.rs index 8f9cef0..a9de94e 100644 --- a/src/types/sync_folder_hierarchy.rs +++ b/src/types/sync_folder_hierarchy.rs @@ -14,7 +14,7 @@ use crate::{ /// server-side. /// /// See -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(default_ns = MESSAGES_NS_URI)] pub struct SyncFolderHierarchy { /// A description of the information to be included in the response for each @@ -46,7 +46,7 @@ impl EnvelopeBodyContents for SyncFolderHierarchy { /// A response to a [`SyncFolderHierarchy`] request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct SyncFolderHierarchyResponse { pub response_messages: ResponseMessages, @@ -63,7 +63,7 @@ impl EnvelopeBodyContents for SyncFolderHierarchyResponse { /// A collection of responses for individual entities within a request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ResponseMessages { pub sync_folder_hierarchy_response_message: Vec, @@ -72,7 +72,7 @@ pub struct ResponseMessages { /// A response to a request for an individual folder within a [`SyncFolderHierarchy`] operation. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct SyncFolderHierarchyResponseMessage { /// The status of the corresponding request, i.e. whether it succeeded or @@ -97,7 +97,7 @@ pub struct SyncFolderHierarchyResponseMessage { /// deletions. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub struct Changes { #[serde(default, rename = "$value")] pub inner: Vec, @@ -106,7 +106,7 @@ pub struct Changes { /// A server-side change to a folder. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub enum Change { /// A creation of a folder. /// diff --git a/src/types/sync_folder_items.rs b/src/types/sync_folder_items.rs index ad0789d..f958187 100644 --- a/src/types/sync_folder_items.rs +++ b/src/types/sync_folder_items.rs @@ -14,7 +14,7 @@ use crate::{ /// server-side. /// /// See -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] #[xml_struct(default_ns = MESSAGES_NS_URI)] pub struct SyncFolderItems { /// A description of the information to be included in the response for each @@ -60,7 +60,7 @@ impl EnvelopeBodyContents for SyncFolderItems { /// A response to a [`SyncFolderItems`] request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct SyncFolderItemsResponse { pub response_messages: ResponseMessages, @@ -77,13 +77,13 @@ impl EnvelopeBodyContents for SyncFolderItemsResponse { /// A collection of responses for individual entities within a request. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ResponseMessages { pub sync_folder_items_response_message: Vec, } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct SyncFolderItemsResponseMessage { /// The status of the corresponding request, i.e. whether it succeeded or @@ -105,7 +105,7 @@ pub struct SyncFolderItemsResponseMessage { } /// An ordered collection of identifiers for Exchange items. -#[derive(Debug, XmlSerialize)] +#[derive(Clone, Debug, XmlSerialize)] pub struct ArrayOfBaseItemIds { item_id: Vec, } @@ -116,7 +116,7 @@ pub enum SyncScope { NormalAndAssociatedItems, } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub struct Changes { #[serde(default, rename = "$value")] pub inner: Vec, @@ -125,7 +125,7 @@ pub struct Changes { /// A server-side change to an item. /// /// See -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub enum Change { /// A creation of an item. ///