melib: fix doctest compilation errors

pull/253/head
Manos Pitsidianakis 2023-07-05 16:33:13 +03:00
parent 3803d788ab
commit b5657201db
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
7 changed files with 217 additions and 215 deletions

View File

@ -29,45 +29,45 @@ use super::*;
///
/// It takes the following arguments:
///
/// - `account_id`: "Id"
/// - `account_id`: `Id`
///
/// The id of the account to use.
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ImportCall {
///accountId: "Id"
///The id of the account to use.
/// accountId: `Id`
/// The id of the account to use.
pub account_id: Id<Account>,
///ifInState: "String|null"
///This is a state string as returned by the "Email/get" method. If
///supplied, the string must match the current state of the account
///referenced by the accountId; otherwise, the method will be aborted
///and a "stateMismatch" error returned. If null, any changes will
///be applied to the current state.
/// ifInState: `String|null`
/// This is a state string as returned by the `Email/get` method. If
/// supplied, the string must match the current state of the account
/// referenced by the accountId; otherwise, the method will be aborted
/// and a `stateMismatch` error returned. If null, any changes will
/// be applied to the current state.
#[serde(skip_serializing_if = "Option::is_none")]
pub if_in_state: Option<State<EmailObject>>,
///o emails: "Id[EmailImport]"
///A map of creation id (client specified) to EmailImport objects.
/// o emails: `Id[EmailImport]`
/// A map of creation id (client specified) to EmailImport objects.
pub emails: HashMap<Id<EmailObject>, EmailImport>,
}
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct EmailImport {
///o blobId: "Id"
///The id of the blob containing the raw message [RFC5322].
/// o blobId: `Id`
/// The id of the blob containing the raw message `RFC5322`.
pub blob_id: Id<BlobObject>,
///o mailboxIds: "Id[Boolean]"
///The ids of the Mailboxes to assign this Email to. At least one
///Mailbox MUST be given.
/// o mailboxIds: `Id[Boolean]`
/// The ids of the Mailboxes to assign this Email to. At least one
/// Mailbox MUST be given.
pub mailbox_ids: HashMap<Id<MailboxObject>, bool>,
///o keywords: "String[Boolean]" (default: {})
///The keywords to apply to the Email.
/// o keywords: `String[Boolean]` (default: {})
/// The keywords to apply to the Email.
pub keywords: HashMap<String, bool>,
///o receivedAt: "UTCDate" (default: time of most recent Received
///header, or time of import on server if none)
///The "receivedAt" date to set on the Email.
/// o receivedAt: `UTCDate` (default: time of most recent Received
/// header, or time of import on server if none)
/// The `receivedAt` date to set on the Email.
pub received_at: Option<String>,
}
@ -81,7 +81,7 @@ impl ImportCall {
}
_impl!(
/// - accountId: "Id"
/// - accountId: `Id`
///
/// The id of the account to use.
account_id: Id<Account>
@ -126,39 +126,39 @@ impl Default for EmailImport {
#[serde(rename_all = "camelCase")]
#[serde(tag = "type")]
pub enum ImportError {
///The server MAY forbid two Email objects with the same exact content
/// [RFC5322], or even just with the same Message-ID [RFC5322], to
/// coexist within an account. In this case, it MUST reject attempts to
/// import an Email considered to be a duplicate with an "alreadyExists"
/// SetError.
/// The server MAY forbid two Email objects with the same exact content
/// `RFC5322`, or even just with the same Message-ID `RFC5322`, to
/// coexist within an account. In this case, it MUST reject attempts to
/// import an Email considered to be a duplicate with an `alreadyExists`
/// SetError.
AlreadyExists {
description: Option<String>,
/// An "existingId" property of type "Id" MUST be included on
///the SetError object with the id of the existing Email. If
/// An `existingId` property of type `Id` MUST be included on
/// the SetError object with the id of the existing Email. If
/// duplicates are allowed, the newly created Email object MUST
/// have a separate id and independent mutable properties to the
/// existing object.
existing_id: Id<EmailObject>,
},
///If the "blobId", "mailboxIds", or "keywords" properties are invalid
///(e.g., missing, wrong type, id not found), the server MUST reject the
///import with an "invalidProperties" SetError.
/// If the `blobId`, `mailboxIds`, or `keywords` properties are invalid
/// (e.g., missing, wrong type, id not found), the server MUST reject the
/// import with an `invalidProperties` SetError.
InvalidProperties {
description: Option<String>,
properties: Vec<String>,
},
///If the Email cannot be imported because it would take the account
///over quota, the import should be rejected with an "overQuota"
///SetError.
/// If the Email cannot be imported because it would take the account
/// over quota, the import should be rejected with an `overQuota`
/// SetError.
OverQuota { description: Option<String> },
///If the blob referenced is not a valid message [RFC5322], the server
///MAY modify the message to fix errors (such as removing NUL octets or
///fixing invalid headers). If it does this, the "blobId" on the
///response MUST represent the new representation and therefore be
///different to the "blobId" on the EmailImport object. Alternatively,
///the server MAY reject the import with an "invalidEmail" SetError.
/// If the blob referenced is not a valid message `RFC5322`, the server
/// MAY modify the message to fix errors (such as removing NUL octets or
/// fixing invalid headers). If it does this, the `blobId` on the
/// response MUST represent the new representation and therefore be
/// different to the `blobId` on the EmailImport object. Alternatively,
/// the server MAY reject the import with an `invalidEmail` SetError.
InvalidEmail { description: Option<String> },
///An "ifInState" argument was supplied, and it does not match the current
/// An `ifInState` argument was supplied, and it does not match the current
/// state.
StateMismatch,
}
@ -166,31 +166,31 @@ pub enum ImportError {
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ImportResponse {
///o accountId: "Id"
///The id of the account used for this call.
/// o accountId: `Id`
/// The id of the account used for this call.
pub account_id: Id<Account>,
///o oldState: "String|null"
///The state string that would have been returned by "Email/get" on
///this account before making the requested changes, or null if the
///server doesn't know what the previous state string was.
/// o oldState: `String|null`
/// The state string that would have been returned by `Email/get` on
/// this account before making the requested changes, or null if the
/// server doesn't know what the previous state string was.
pub old_state: Option<State<EmailObject>>,
///o newState: "String"
///The state string that will now be returned by "Email/get" on this
///account.
/// o newState: `String`
/// The state string that will now be returned by `Email/get` on this
/// account.
pub new_state: Option<State<EmailObject>>,
///o created: "Id[Email]|null"
///A map of the creation id to an object containing the "id",
///"blobId", "threadId", and "size" properties for each successfully
///imported Email, or null if none.
/// o created: `Id[Email]|null`
/// A map of the creation id to an object containing the `id`,
/// `blobId`, `threadId`, and `size` properties for each successfully
/// imported Email, or null if none.
pub created: HashMap<Id<EmailObject>, ImportEmailResult>,
///o notCreated: "Id[SetError]|null"
///A map of the creation id to a SetError object for each Email that
///failed to be created, or null if all successful. The possible
///errors are defined above.
/// o notCreated: `Id[SetError]|null`
/// A map of the creation id to a SetError object for each Email that
/// failed to be created, or null if all successful. The possible
/// errors are defined above.
pub not_created: HashMap<Id<EmailObject>, ImportError>,
}

View File

@ -279,7 +279,7 @@ impl Object for BlobObject {
///
/// It takes the following arguments:
///
/// - `account_id`: "Id"
/// - `account_id`: `Id`
///
/// The id of the account to use.
#[derive(Deserialize, Debug)]
@ -311,7 +311,7 @@ where
}
}
_impl!(
/// - accountId: "Id"
/// - accountId: `Id`
///
/// The id of the account to use.
account_id: Id<Account>
@ -322,11 +322,11 @@ where
/// The ids of the Foo objects to return. If `None`, then *all*
/// records of the data type are returned, if this is
/// supported for that data type and the number of records
/// does not exceed the "max_objects_in_get" limit.
/// does not exceed the `max_objects_in_get` limit.
ids: Option<JmapArgument<Vec<Id<OBJ>>>>
);
_impl!(
/// - properties: Option<Vec<String>>
/// - properties: `Option<Vec<String>>`
///
/// If supplied, only the properties listed in the array are
/// returned for each `Foo` object. If `None`, all
@ -334,7 +334,7 @@ where
/// property of the object is *always* returned, even if
/// not explicitly requested. If an invalid property is
/// requested, the call WILL be rejected with an
/// "invalid_arguments" error.
/// `invalid_arguments` error.
properties: Option<Vec<String>>
);
}
@ -599,18 +599,18 @@ impl<M: Method<OBJ>, OBJ: Object> ResultField<M, OBJ> {
/// #`changes`
///
/// The "Foo/changes" method allows a client to efficiently update the state
/// The `Foo/changes` method allows a client to efficiently update the state
/// of its Foo cache to match the new state on the server. It takes the
/// following arguments:
///
/// - accountId: "Id" The id of the account to use.
/// - sinceState: "String"
/// - accountId: `Id` The id of the account to use.
/// - sinceState: `String`
/// The current state of the client. This is the string that was
/// returned as the "state" argument in the "Foo/get" response. The
/// returned as the `state` argument in the `Foo/get` response. The
/// server will return the changes that have occurred since this
/// state.
///
/// - maxChanges: "UnsignedInt|null"
/// - maxChanges: `UnsignedInt|null`
/// The maximum number of ids to return in the response. The server
/// MAY choose to return fewer than this value but MUST NOT return
/// more. If not given by the client, the server may choose how many
@ -645,21 +645,21 @@ where
}
}
_impl!(
/// - accountId: "Id"
/// - accountId: `Id`
///
/// The id of the account to use.
account_id: Id<Account>
);
_impl!(
/// - since_state: "String"
/// - since_state: `String`
/// The current state of the client. This is the string that was
/// returned as the "state" argument in the "Foo/get" response. The
/// returned as the `state` argument in the `Foo/get` response. The
/// server will return the changes that have occurred since this
/// state.
since_state: State<OBJ>
);
_impl!(
/// - max_changes: "UnsignedInt|null"
/// - max_changes: `UnsignedInt|null`
/// The maximum number of ids to return in the response. The server
/// MAY choose to return fewer than this value but MUST NOT return
/// more. If not given by the client, the server may choose how many
@ -720,34 +720,34 @@ impl<OBJ: Object> ChangesResponse<OBJ> {
_impl!(get_mut destroyed_mut, destroyed: Vec<Id<OBJ>>);
}
///#`set`
/// #`set`
///
///Modifying the state of Foo objects on the server is done via the
///"Foo/set" method. This encompasses creating, updating, and
///destroying Foo records. This allows the server to sort out ordering
///and dependencies that may exist if doing multiple operations at once
///(for example, to ensure there is always a minimum number of a certain
///record type).
/// Modifying the state of Foo objects on the server is done via the
/// `Foo/set` method. This encompasses creating, updating, and
/// destroying Foo records. This allows the server to sort out ordering
/// and dependencies that may exist if doing multiple operations at once
/// (for example, to ensure there is always a minimum number of a certain
/// record type).
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Set<OBJ>
where
OBJ: Object + std::fmt::Debug + Serialize,
{
///o accountId: "Id"
/// o accountId: `Id`
///
/// The id of the account to use.
pub account_id: Id<Account>,
///o ifInState: "String|null"
/// o ifInState: `String|null`
///
/// This is a state string as returned by the "Foo/get" method
/// This is a state string as returned by the `Foo/get` method
/// (representing the state of all objects of this type in the
/// account). If supplied, the string must match the current state;
/// otherwise, the method will be aborted and a "stateMismatch" error
/// otherwise, the method will be aborted and a `stateMismatch` error
/// returned. If null, any changes will be applied to the current
/// state.
pub if_in_state: Option<State<OBJ>>,
///o create: "Id[Foo]|null"
/// o create: `Id[Foo]|null`
///
/// A map of a *creation id* (a temporary id set by the client) to Foo
/// objects, or null if no objects are to be created.
@ -756,21 +756,21 @@ where
/// properties. Any such property may be omitted by the client.
///
/// The client MUST omit any properties that may only be set by the
/// server (for example, the "id" property on most object types).
/// server (for example, the `id` property on most object types).
pub create: Option<HashMap<Id<OBJ>, OBJ>>,
///o update: "Id[PatchObject]|null"
/// o update: `Id[PatchObject]|null`
///
/// A map of an id to a Patch object to apply to the current Foo
/// object with that id, or null if no objects are to be updated.
///
/// A *PatchObject* is of type "String[*]" and represents an unordered
/// A *PatchObject* is of type `String[*]` and represents an unordered
/// set of patches. The keys are a path in JSON Pointer format
/// [RFC6901], with an implicit leading "/" (i.e., prefix each key
/// with "/" before applying the JSON Pointer evaluation algorithm).
/// `RFC6901`, with an implicit leading `/` (i.e., prefix each key
/// with `/` before applying the JSON Pointer evaluation algorithm).
///
/// All paths MUST also conform to the following restrictions; if
/// there is any violation, the update MUST be rejected with an
/// "invalidPatch" error:
/// `invalidPatch` error:
/// * The pointer MUST NOT reference inside an array (i.e., you MUST NOT
/// insert/delete from an array; the array MUST be replaced in its
/// entirety instead).
@ -780,7 +780,7 @@ where
///
/// * There MUST NOT be two patches in the PatchObject where the pointer
/// of one is the prefix of the pointer of the other, e.g.,
/// "alerts/1/offset" and "alerts".
/// `alerts/1/offset` and `alerts`.
///
/// The value associated with each pointer determines how to apply
/// that patch:
@ -795,14 +795,14 @@ where
/// Any server-set properties MAY be included in the patch if their
/// value is identical to the current server value (before applying
/// the patches to the object). Otherwise, the update MUST be
/// rejected with an "invalidProperties" SetError.
/// rejected with an `invalidProperties` SetError.
///
/// This patch definition is designed such that an entire Foo object
/// is also a valid PatchObject. The client may choose to optimise
/// network usage by just sending the diff or may send the whole
/// object; the server processes it the same either way.
pub update: Option<HashMap<Id<OBJ>, Value>>,
///o destroy: "Id[]|null"
/// o destroy: `Id[]|null`
///
/// A list of ids for Foo objects to permanently delete, or null if no
/// objects are to be destroyed.
@ -824,12 +824,12 @@ where
}
_impl!(account_id: Id<Account>);
_impl!(
///o ifInState: "String|null"
/// o ifInState: `String|null`
///
/// This is a state string as returned by the "Foo/get" method
/// This is a state string as returned by the `Foo/get` method
/// (representing the state of all objects of this type in the
/// account). If supplied, the string must match the current state;
/// otherwise, the method will be aborted and a "stateMismatch" error
/// otherwise, the method will be aborted and a `stateMismatch` error
/// returned. If null, any changes will be applied to the current
/// state.
if_in_state: Option<State<OBJ>>
@ -849,31 +849,31 @@ where
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct SetResponse<OBJ: Object> {
///o accountId: "Id"
/// o accountId: `Id`
///
/// The id of the account used for the call.
pub account_id: Id<Account>,
///o oldState: "String|null"
/// o oldState: `String|null`
///
/// The state string that would have been returned by "Foo/get" before
/// The state string that would have been returned by `Foo/get` before
/// making the requested changes, or null if the server doesn't know
/// what the previous state string was.
pub old_state: State<OBJ>,
///o newState: "String"
/// o newState: `String`
///
/// The state string that will now be returned by "Foo/get".
/// The state string that will now be returned by `Foo/get`.
pub new_state: State<OBJ>,
///o created: "Id[Foo]|null"
/// o created: `Id[Foo]|null`
///
/// A map of the creation id to an object containing any properties of
/// the created Foo object that were not sent by the client. This
/// includes all server-set properties (such as the "id" in most
/// includes all server-set properties (such as the `id` in most
/// object types) and any properties that were omitted by the client
/// and thus set to a default by the server.
///
/// This argument is null if no Foo objects were successfully created.
pub created: Option<HashMap<Id<OBJ>, OBJ>>,
///o updated: "Id[Foo|null]|null"
/// o updated: `Id[Foo|null]|null`
///
/// The keys in this map are the ids of all Foos that were
/// successfully updated.
@ -885,22 +885,22 @@ pub struct SetResponse<OBJ: Object> {
///
/// This argument is null if no Foo objects were successfully updated.
pub updated: Option<HashMap<Id<OBJ>, Option<OBJ>>>,
///o destroyed: "Id[]|null"
/// o destroyed: `Id[]|null`
///
/// A list of Foo ids for records that were successfully destroyed, or
/// null if none.
pub destroyed: Option<Vec<Id<OBJ>>>,
///o notCreated: "Id[SetError]|null"
/// o notCreated: `Id[SetError]|null`
///
/// A map of the creation id to a SetError object for each record that
/// failed to be created, or null if all successful.
pub not_created: Option<Vec<SetError>>,
///o notUpdated: "Id[SetError]|null"
/// o notUpdated: `Id[SetError]|null`
///
/// A map of the Foo id to a SetError object for each record that
/// failed to be updated, or null if all successful.
pub not_updated: Option<Vec<SetError>>,
///o notDestroyed: "Id[SetError]|null"
/// o notDestroyed: `Id[SetError]|null`
///
/// A map of the Foo id to a SetError object for each record that
/// failed to be destroyed, or null if all successful.//
@ -928,40 +928,40 @@ impl<OBJ: Object + DeserializeOwned> std::convert::TryFrom<&RawValue> for SetRes
#[serde(rename_all = "camelCase")]
#[serde(tag = "type", content = "description")]
pub enum SetError {
///(create; update; destroy). The create/update/destroy would violate an
/// (create; update; destroy). The create/update/destroy would violate an
/// ACL or other permissions policy.
Forbidden(Option<String>),
///(create; update). The create would exceed a server- defined limit on
/// (create; update). The create would exceed a server- defined limit on
/// the number or total size of objects of this type.
OverQuota(Option<String>),
///(create; update). The create/update would result in an object that
/// (create; update). The create/update would result in an object that
/// exceeds a server-defined limit for the maximum size of a single object
/// of this type.
TooLarge(Option<String>),
///(create). Too many objects of this type have been created recently, and
/// (create). Too many objects of this type have been created recently, and
/// a server-defined rate limit has been reached. It may work if tried
/// again later.
RateLimit(Option<String>),
///(update; destroy). The id given to update/destroy cannot be found.
/// (update; destroy). The id given to update/destroy cannot be found.
NotFound(Option<String>),
///(update). The PatchObject given to update the record was not a valid
/// (update). The PatchObject given to update the record was not a valid
/// patch (see the patch description).
InvalidPatch(Option<String>),
///(update). The client requested that an object be both updated and
/// (update). The client requested that an object be both updated and
/// destroyed in the same /set request, and the server has decided to
/// therefore ignore the update.
WillDestroy(Option<String>),
///(create; update). The record given is invalid in some way.
/// (create; update). The record given is invalid in some way.
InvalidProperties {
description: Option<String>,
properties: Vec<String>,
},
///(create; destroy). This is a singleton type, so you cannot create
/// (create; destroy). This is a singleton type, so you cannot create
/// another one or destroy the existing one.
Singleton(Option<String>),
RequestTooLarge(Option<String>),
@ -1070,26 +1070,26 @@ pub fn upload_request_format(upload_url: &str, account_id: &Id<Account>) -> Stri
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct UploadResponse {
///o accountId: "Id"
/// o accountId: `Id`
///
/// The id of the account used for the call.
pub account_id: Id<Account>,
///o blobId: "Id"
/// o blobId: `Id`
///
///The id representing the binary data uploaded. The data for this id is
/// The id representing the binary data uploaded. The data for this id is
/// immutable. The id *only* refers to the binary data, not any
/// metadata.
pub blob_id: Id<BlobObject>,
///o type: "String"
/// o type: `String`
///
///The media type of the file (as specified in [RFC6838],
///Section 4.2) as set in the Content-Type header of the upload HTTP
///request.
/// The media type of the file (as specified in `RFC6838`,
/// Section 4.2) as set in the Content-Type header of the upload HTTP
/// request.
#[serde(rename = "type")]
pub _type: String,
///o size: "UnsignedInt"
/// o size: `UnsignedInt`
///
/// The size of the file in octets.
pub size: usize,
@ -1097,7 +1097,7 @@ pub struct UploadResponse {
/// #`queryChanges`
///
/// The "Foo/queryChanges" method allows a client to efficiently update
/// The `Foo/queryChanges` method allows a client to efficiently update
/// the state of a cached query to match the new state on the server. It
/// takes the following arguments:
#[derive(Serialize, Debug)]
@ -1109,36 +1109,36 @@ where
pub account_id: Id<Account>,
pub filter: Option<F>,
pub sort: Option<Comparator<OBJ>>,
///sinceQueryState: "String"
/// sinceQueryState: `String`
///
///The current state of the query in the client. This is the string
///that was returned as the "queryState" argument in the "Foo/query"
///response with the same sort/filter. The server will return the
///changes made to the query since this state.
/// The current state of the query in the client. This is the string
/// that was returned as the `queryState` argument in the `Foo/query`
/// response with the same sort/filter. The server will return the
/// changes made to the query since this state.
pub since_query_state: String,
///o maxChanges: "UnsignedInt|null"
/// o maxChanges: `UnsignedInt|null`
///
///The maximum number of changes to return in the response. See
///error descriptions below for more details.
/// The maximum number of changes to return in the response. See
/// error descriptions below for more details.
pub max_changes: Option<usize>,
///o upToId: "Id|null"
/// o upToId: `Id|null`
///
///The last (highest-index) id the client currently has cached from
///the query results. When there are a large number of results, in a
///common case, the client may have only downloaded and cached a
///small subset from the beginning of the results. If the sort and
///filter are both only on immutable properties, this allows the
///server to omit changes after this point in the results, which can
///significantly increase efficiency. If they are not immutable,
///this argument is ignored.
/// The last (highest-index) id the client currently has cached from
/// the query results. When there are a large number of results, in a
/// common case, the client may have only downloaded and cached a
/// small subset from the beginning of the results. If the sort and
/// filter are both only on immutable properties, this allows the
/// server to omit changes after this point in the results, which can
/// significantly increase efficiency. If they are not immutable,
/// this argument is ignored.
pub up_to_id: Option<Id<OBJ>>,
///o calculateTotal: "Boolean" (default: false)
/// o calculateTotal: `Boolean` (default: false)
///
///Does the client wish to know the total number of results now in
///the query? This may be slow and expensive for servers to
///calculate, particularly with complex filters, so clients should
///take care to only request the total when needed.
/// Does the client wish to know the total number of results now in
/// the query? This may be slow and expensive for servers to
/// calculate, particularly with complex filters, so clients should
/// take care to only request the total when needed.
#[serde(default = "bool_false")]
pub calculate_total: bool,
@ -1174,79 +1174,79 @@ where
pub struct QueryChangesResponse<OBJ: Object> {
/// The id of the account used for the call.
pub account_id: Id<Account>,
/// This is the "sinceQueryState" argument echoed back; that is, the state
/// This is the `sinceQueryState` argument echoed back; that is, the state
/// from which the server is returning changes.
pub old_query_state: String,
///This is the state the query will be in after applying the set of changes
/// This is the state the query will be in after applying the set of changes
/// to the old state.
pub new_query_state: String,
/// The total number of Foos in the results (given the "filter"). This
/// argument MUST be omitted if the "calculateTotal" request argument is not
/// The total number of Foos in the results (given the `filter`). This
/// argument MUST be omitted if the `calculateTotal` request argument is not
/// true.
#[serde(default)]
pub total: Option<usize>,
///The "id" for every Foo that was in the query results in the old
///state and that is not in the results in the new state.
/// The `id` for every Foo that was in the query results in the old
/// state and that is not in the results in the new state.
///If the server cannot calculate this exactly, the server MAY return
///the ids of extra Foos in addition that may have been in the old
///results but are not in the new results.
/// If the server cannot calculate this exactly, the server MAY return
/// the ids of extra Foos in addition that may have been in the old
/// results but are not in the new results.
///If the sort and filter are both only on immutable properties and
///an "upToId" is supplied and exists in the results, any ids that
///were removed but have a higher index than "upToId" SHOULD be
///omitted.
/// If the sort and filter are both only on immutable properties and
/// an `upToId` is supplied and exists in the results, any ids that
/// were removed but have a higher index than `upToId` SHOULD be
/// omitted.
///If the "filter" or "sort" includes a mutable property, the server
///MUST include all Foos in the current results for which this
///property may have changed. The position of these may have moved
///in the results, so they must be reinserted by the client to ensure
///its query cache is correct.
/// If the `filter` or `sort` includes a mutable property, the server
/// MUST include all Foos in the current results for which this
/// property may have changed. The position of these may have moved
/// in the results, so they must be reinserted by the client to ensure
/// its query cache is correct.
pub removed: Vec<Id<OBJ>>,
///The id and index in the query results (in the new state) for every
///Foo that has been added to the results since the old state AND
///every Foo in the current results that was included in the
///"removed" array (due to a filter or sort based upon a mutable
///property).
/// The id and index in the query results (in the new state) for every
/// Foo that has been added to the results since the old state AND
/// every Foo in the current results that was included in the
/// `removed` array (due to a filter or sort based upon a mutable
/// property).
///If the sort and filter are both only on immutable properties and
///an "upToId" is supplied and exists in the results, any ids that
///were added but have a higher index than "upToId" SHOULD be
///omitted.
/// If the sort and filter are both only on immutable properties and
/// an `upToId` is supplied and exists in the results, any ids that
/// were added but have a higher index than `upToId` SHOULD be
/// omitted.
///The array MUST be sorted in order of index, with the lowest index
///first.
/// The array MUST be sorted in order of index, with the lowest index
/// first.
///An *AddedItem* object has the following properties:
/// An *AddedItem* object has the following properties:
/// * id: "Id"
/// * id: `Id`
/// * index: "UnsignedInt"
/// * index: `UnsignedInt`
///The result of this is that if the client has a cached sparse array of
///Foo ids corresponding to the results in the old state, then:
/// The result of this is that if the client has a cached sparse array of
/// Foo ids corresponding to the results in the old state, then:
///fooIds = [ "id1", "id2", null, null, "id3", "id4", null, null, null ]
/// fooIds = [ `id1`, `id2`, null, null, `id3`, `id4`, null, null, null ]
///If it *splices out* all ids in the removed array that it has in its
///cached results, then:
/// If it *splices out* all ids in the removed array that it has in its
/// cached results, then:
/// removed = [ "id2", "id31", ... ];
/// fooIds => [ "id1", null, null, "id3", "id4", null, null, null ]
/// removed = [ `id2`, `id31`, ... ];
/// fooIds => [ `id1`, null, null, `id3`, `id4`, null, null, null ]
///and *splices in* (one by one in order, starting with the lowest
///index) all of the ids in the added array:
/// and *splices in* (one by one in order, starting with the lowest
/// index) all of the ids in the added array:
///added = [{ id: "id5", index: 0, ... }];
///fooIds => [ "id5", "id1", null, null, "id3", "id4", null, null, null ]
/// added = [{ id: `id5`, index: 0, ... }];
/// fooIds => [ `id5`, `id1`, null, null, `id3`, `id4`, null, null, null ]
///and *truncates* or *extends* to the new total length, then the
///results will now be in the new state.
/// and *truncates* or *extends* to the new total length, then the
/// results will now be in the new state.
///Note: splicing in adds the item at the given index, incrementing the
///index of all items previously at that or a higher index. Splicing
///out is the inverse, removing the item and decrementing the index of
///every item after it in the array.
/// Note: splicing in adds the item at the given index, incrementing the
/// index of all items previously at that or a higher index. Splicing
/// out is the inverse, removing the item and decrementing the index of
/// every item after it in the array.
pub added: Vec<AddedItem<OBJ>>,
}

View File

@ -109,9 +109,9 @@
//! format.append(
//! &mut file,
//! mbox_1,
//! None, // Envelope From
//! Some(melib::datetime::now()), // Delivered date
//! Default::default(), // Flags and tags
//! None, // Envelope From
//! Some(melib::utils::datetime::now()), // Delivered date
//! Default::default(), // Flags and tags
//! MboxMetadata::None,
//! true,
//! false,
@ -120,7 +120,7 @@
//! &mut file,
//! mbox_2,
//! None,
//! Some(melib::datetime::now()),
//! Some(melib::utils::datetime::now()),
//! Default::default(), // Flags and tags
//! MboxMetadata::None,
//! false,

View File

@ -1266,7 +1266,7 @@ mod test {
});
let smtp_server_conf = get_smtp_conf();
let input_str = include_str!("../test_sample_longmessage.eml");
let input_str = include_str!("../tests/test_sample_longmessage.eml");
match crate::Envelope::from_bytes(input_str.as_bytes(), None) {
Ok(_envelope) => {}
Err(err) => {

View File

@ -24,7 +24,7 @@
//! # Examples
//!
//! ```rust
//! # use melib::datetime::*;
//! # use melib::utils::datetime::*;
//! // Get current UNIX Epoch timestamp.
//! let now: UnixTimestamp = now();
//!

View File

@ -30,7 +30,9 @@
//! # Examples
//!
//! ```rust
//! use melib::percent_encoding::{percent_decode_str, utf8_percent_encode, AsciiSet, CONTROLS};
//! use melib::utils::percent_encoding::{
//! percent_decode_str, utf8_percent_encode, AsciiSet, CONTROLS,
//! };
//!
//! /// https://url.spec.whatwg.org/#fragment-percent-encode-set
//! const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
@ -55,8 +57,8 @@ use std::{borrow::Cow, fmt, mem, slice, str};
///
/// Use the `add` method of an existing set to define a new set. For example:
///
/// ```
/// use melib::percent_encoding::{AsciiSet, CONTROLS};
/// ```rust
/// use melib::utils::percent_encoding::{AsciiSet, CONTROLS};
///
/// /// https://url.spec.whatwg.org/#fragment-percent-encode-set
/// const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
@ -175,8 +177,8 @@ pub const NON_ALPHANUMERIC: &AsciiSet = &CONTROLS
///
/// # Examples
///
/// ```
/// use melib::percent_encoding::percent_encode_byte;
/// ```rust
/// use melib::utils::percent_encoding::percent_encode_byte;
///
/// assert_eq!(
/// "foo bar"
@ -227,8 +229,8 @@ pub fn percent_encode_byte(byte: u8) -> &'static str {
///
/// # Examples
///
/// ```
/// use melib::percent_encoding::{percent_encode, NON_ALPHANUMERIC};
/// ```rust
/// use melib::utils::percent_encoding::{percent_encode, NON_ALPHANUMERIC};
///
/// assert_eq!(
/// percent_encode(b"foo bar?", NON_ALPHANUMERIC).to_string(),
@ -252,8 +254,8 @@ pub const fn percent_encode<'a>(
///
/// # Examples
///
/// ```
/// use melib::percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
/// ```rust
/// use melib::utils::percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
///
/// assert_eq!(
/// utf8_percent_encode("foo bar?", NON_ALPHANUMERIC).to_string(),
@ -362,8 +364,8 @@ pub fn percent_decode_str(input: &str) -> PercentDecode<'_> {
///
/// # Examples
///
/// ```
/// use melib::percent_encoding::percent_decode;
/// ```rust
/// use melib::utils::percent_encoding::percent_decode;
///
/// assert_eq!(
/// percent_decode(b"foo%20bar%3f").decode_utf8().unwrap(),