diff --git a/README.md b/README.md index de4e2ad..cf6b42c 100644 --- a/README.md +++ b/README.md @@ -18,79 +18,33 @@ From their docs: This is a Rust implementation of the same concept. -## Migration from `py-organize` - -- copy your `config.yaml` and rename it to `organize.yaml` -- rework `anchors` in your new `organize.yaml` config file - from: - - ```yaml - desktop_folder: &desktop - - '~/Desktop/' - applications: &apps - - exe - - msi - - apk - ``` - - to - - ```yaml - aliases: - - name: desktop - kind: folder - items: - - '~/Desktop/' - - name: apps - kind: ext - items: - - exe - - msi - - apk - ``` - -- then rework the `aliases` correspondingly from: - - ```yaml - # Rule for desktop/downloads to move applications into @Apps - - folders: - - *downloads - - *desktop - - *inbox - subfolders: false - filters: - - extension: - - *apps - actions: - - move: '~/backup/INBOX/@Apps/' - ``` - - ```yaml - # Rule for desktop/downloads to move applications into @Apps - - locations: - - ref|downloads - - ref|desktop - - ref|inbox - subfolders: false - filters: - - extension: - - ref|apps - actions: - - move: '~/backup/INBOX/@Apps/' - ``` - ## Goals -For now the first goal for this Rust version of `organize` is to have feature parity (commands) with its Python equivalent. -Though, breaking changes may occur going forward, for the beginning it should work as a drop-in replacement. +For now the first goal for this Rust version of `organize` is to have feature parity with its Python equivalent. -A big factor for the Rust port for me is that I like Rust. I want to reimplement `organize` in language that has better error handling, and makes it easier to maintain software. It's fast and at the same time makes development less error prone. +**BUT**: I want to take another approach on tackling the problem. It is also relatively complicated to map all the stuff +within a `config` file, because we are bound to the syntax of `yaml`/`json`/`toml`/`ron`. -I'm the first user of the Rust implementation, and will be going to use it with my private files. Thus an important goal for me is stability. +*Maybe this is exactly the problem to solve!* + +Basically you want to have a configuration file, which replaces a mini scripting language. +With predefined `filters` and `actions` that are applied to the items that the filter spits out. + +Basically almost everything in the configuration files are parameters for functions/methods. + +This makes everything more complicated. -## Non goals +1. What if we implement rusty `organize` in a way, that we can call `organize filter extension --ext "exe, msi, apk" --path {}` +and it spits out all the paths that match this `precoded` filter? +This way we can already utilize it easily within shell scripts. -The Python implementation supports filters and actions that can be passed in via the config file and are written themselves in `Python`. For me it's not a reasonable effort to support `Python` features in that regards. +1. On the second implementation stage, we can embed a scripting engine like [rhai](https://crates.io/crates/rhai), where we expose some functionality of rusty `organize` as `functions` and register them with the `rhai` engine. + +1. Instead of pressing everything in a complicated configuration file syntax, we can utilize a scripting language and boil it down to its minimum syntax. + +That being said, a big factor for the Rust reiteration for me is that I like Rust. I want to reimplement `organize`'s approach in language that has better error handling, and makes it easier to maintain software. That is fast and at the same time makes development less error prone. + +I'm the first user of the Rust implementation, and will be going to use it with my private files. Thus an important goal for me is stability. ## License diff --git a/crates/organize-rs_core/src/rules.rs b/crates/organize-rs_core/src/rules.rs index c637176..49fe9ae 100644 --- a/crates/organize-rs_core/src/rules.rs +++ b/crates/organize-rs_core/src/rules.rs @@ -5,11 +5,8 @@ pub mod actions; pub mod aliases; pub mod filters; -// Generated from py-organize -pub mod py_organize; - use serde::{Deserialize, Serialize}; -use std::path::PathBuf; +// use std::path::PathBuf; use crate::rules::{actions::OrganizeAction, filters::OrganizeFilter}; diff --git a/crates/organize-rs_core/src/rules/actions.rs b/crates/organize-rs_core/src/rules/actions.rs index 117741c..aee6b97 100644 --- a/crates/organize-rs_core/src/rules/actions.rs +++ b/crates/organize-rs_core/src/rules/actions.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; /// Colours for `MacOS` tags #[cfg(target_os = "osx")] -#[derive(Debug, Clone, Copy, Deserialize, Serialize)] +#[derive(Debug, Clone, Copy, Deserialize, Serialize, ValueEnum)] pub enum MacOsTagColours { None, Gray, @@ -296,7 +296,7 @@ pub enum OrganizeAction { /// to be a target directory and the file / dir will be /// copied into `destination`and keep its name. #[clap(long)] - destination: String, + dest: String, /// What should happen in case dest already exists. /// One of skip, overwrite, trash, rename_new and rename_existing. /// @@ -358,7 +358,7 @@ pub enum OrganizeAction { #[serde(rename = "echo")] Echo { #[clap(long)] - message: String, + msg: String, }, /// Add macOS tags. /// @@ -434,7 +434,7 @@ pub enum OrganizeAction { /// to be a target directory and the file / dir will be /// moved into `destination`and keep its name. #[clap(long)] - destination: String, + dest: String, /// What should happen in case dest already exists. /// One of skip, overwrite, trash, rename_new and rename_existing. /// @@ -495,7 +495,7 @@ pub enum OrganizeAction { /// Only the local filesystem is supported. // TODO: Can contain placeholders? #[clap(long)] - destination: String, + dest: String, }, /// Move a file or dir into the trash. /// @@ -546,7 +546,7 @@ pub enum OrganizeAction { Write { /// The text that should be written. Supports templates. #[clap(long)] - text: String, + txt: String, /// The file `text` should be written into. Supports templates. /// // Defaults to `organize-out.txt` @@ -577,10 +577,6 @@ pub enum OrganizeAction { #[clap(long)] filesystem: Option, }, - #[cfg(feature = "research_organize")] - #[serde(rename = "python")] - Python, - #[cfg(feature = "research_organize")] #[serde(rename = "shell")] Shell, } @@ -633,7 +629,7 @@ impl OrganizeAction { } pub fn as_echo(&self) -> Option<&String> { - if let Self::Echo { message } = self { + if let Self::Echo { msg: message } = self { Some(message) } else { None @@ -641,7 +637,7 @@ impl OrganizeAction { } pub fn try_into_echo(self) -> Result { - if let Self::Echo { message } = self { + if let Self::Echo { msg: message } = self { Ok(message) } else { Err(self) @@ -700,7 +696,7 @@ impl OrganizeAction { } pub fn as_symlink(&self) -> Option<&String> { - if let Self::Symlink { destination } = self { + if let Self::Symlink { dest: destination } = self { Some(destination) } else { None @@ -708,7 +704,7 @@ impl OrganizeAction { } pub fn try_into_symlink(self) -> Result { - if let Self::Symlink { destination } = self { + if let Self::Symlink { dest: destination } = self { Ok(destination) } else { Err(self) diff --git a/crates/organize-rs_core/src/rules/filters.rs b/crates/organize-rs_core/src/rules/filters.rs index 326d017..43bc146 100644 --- a/crates/organize-rs_core/src/rules/filters.rs +++ b/crates/organize-rs_core/src/rules/filters.rs @@ -518,7 +518,7 @@ pub enum OrganizeFilter { #[serde(rename = "extension")] Extension { #[clap(long)] - extensions: Vec, + ext: Vec, }, /// Matches file content with the given regular expression /// @@ -545,7 +545,7 @@ pub enum OrganizeFilter { #[serde(rename = "filecontent")] Filecontent { #[clap(long)] - expression: String, + regex: String, }, // TODO: Check for available hash algorithms from organize-py // TODO: shake_256, sha3_256, sha1, sha3_224, sha384, sha512, blake2b, @@ -669,9 +669,6 @@ pub enum OrganizeFilter { #[clap(long)] case_sensitive: bool, }, - #[cfg(feature = "research_organize")] - #[serde(rename = "python")] - Python, /// Matches filenames with the given regular expression /// /// Any named groups `((?P.*))` in your regular @@ -698,7 +695,7 @@ pub enum OrganizeFilter { #[serde(rename = "regex")] Regex { #[clap(long)] - expression: String, + expr: String, }, /// Matches files and folders by size /// @@ -923,7 +920,7 @@ impl OrganizeFilter { } pub fn as_regex(&self) -> Option<&String> { - if let Self::Regex { expression } = self { + if let Self::Regex { expr: expression } = self { Some(expression) } else { None @@ -931,7 +928,7 @@ impl OrganizeFilter { } pub fn try_into_regex(self) -> Result { - if let Self::Regex { expression } = self { + if let Self::Regex { expr: expression } = self { Ok(expression) } else { Err(self) @@ -963,7 +960,7 @@ impl OrganizeFilter { } pub fn as_extension(&self) -> Option<&Vec> { - if let Self::Extension { extensions } = self { + if let Self::Extension { ext: extensions } = self { Some(extensions) } else { None @@ -971,7 +968,7 @@ impl OrganizeFilter { } pub fn try_into_extension(self) -> Result, Self> { - if let Self::Extension { extensions } = self { + if let Self::Extension { ext: extensions } = self { Ok(extensions) } else { Err(self) @@ -979,7 +976,7 @@ impl OrganizeFilter { } pub fn as_filecontent(&self) -> Option<&String> { - if let Self::Filecontent { expression } = self { + if let Self::Filecontent { regex: expression } = self { Some(expression) } else { None @@ -987,7 +984,7 @@ impl OrganizeFilter { } pub fn try_into_filecontent(self) -> Result { - if let Self::Filecontent { expression } = self { + if let Self::Filecontent { regex: expression } = self { Ok(expression) } else { Err(self) diff --git a/crates/organize-rs_core/src/rules/py_organize.rs b/crates/organize-rs_core/src/rules/py_organize.rs deleted file mode 100644 index 9379568..0000000 --- a/crates/organize-rs_core/src/rules/py_organize.rs +++ /dev/null @@ -1,3597 +0,0 @@ -#![allow(clippy::redundant_closure_call)] -#![allow(clippy::needless_lifetimes)] -#![allow(clippy::match_single_binding)] -#![allow(clippy::clone_on_copy)] - -use serde::{Deserialize, Serialize}; -use std::convert::TryFrom; -use std::convert::TryInto; - -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfiguration { - #[doc = "All rules are defined here."] - pub rules: Vec, -} -impl From<&Self> for OrganizeRuleConfiguration { - fn from(value: &Self) -> Self { - value.clone() - } -} -impl OrganizeRuleConfiguration { - #[must_use] - pub fn builder() -> builder::OrganizeRuleConfiguration { - builder::OrganizeRuleConfiguration::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItem { - pub actions: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filter_mode: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub filters: Vec, - pub locations: OrganizeRuleConfigurationRulesItemLocations, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subfolders: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub targets: Option, -} -impl From<&OrganizeRuleConfigurationRulesItem> for OrganizeRuleConfigurationRulesItem { - fn from(value: &OrganizeRuleConfigurationRulesItem) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItem { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItem { - builder::OrganizeRuleConfigurationRulesItem::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct OrganizeRuleConfigurationRulesItemActionsItem { - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_0: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_1: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_2: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_3: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_4: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_5: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_6: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_7: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_8: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_9: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_10: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_11: Option, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItem> - for OrganizeRuleConfigurationRulesItemActionsItem -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItem) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItem { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItem { - builder::OrganizeRuleConfigurationRulesItemActionsItem::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype0 { - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_0: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_1: Option, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype0> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype0) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype0 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype0 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype0::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 { - pub confirm: OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm { - Variant0(String), - Variant1 { - #[serde(default, skip_serializing_if = "Option::is_none")] - default: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - msg: Option, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm) -> Self { - value.clone() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype1 { - pub copy: OrganizeRuleConfigurationRulesItemActionsItemSubtype1Copy, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype1> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype1) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype1 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype1 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype1::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype11 { - pub write: OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype11> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype11) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype11 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype11 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype11::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub clear_before_first_write: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filesystem: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mode: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub newline: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - pub text: String, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write::default() - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode { - #[serde(rename = "prepend")] - Prepend, - #[serde(rename = "append")] - Append, - #[serde(rename = "overwrite")] - Overwrite, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode { - fn to_string(&self) -> String { - match *self { - Self::Prepend => "prepend".to_string(), - Self::Append => "append".to_string(), - Self::Overwrite => "overwrite".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "prepend" => Ok(Self::Prepend), - "append" => Ok(Self::Append), - "overwrite" => Ok(Self::Overwrite), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11WriteMode -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype1Copy { - Variant0(String), - Variant1 { - dest: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - filesystem: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - on_conflict: - Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - rename_template: Option, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype1Copy> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1Copy -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype1Copy) -> Self { - value.clone() - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict { - #[serde(rename = "skip")] - Skip, - #[serde(rename = "overwrite")] - Overwrite, - #[serde(rename = "trash")] - Trash, - #[serde(rename = "rename_new")] - RenameNew, - #[serde(rename = "rename_existing")] - RenameExisting, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict, - ) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict { - fn to_string(&self) -> String { - match *self { - Self::Skip => "skip".to_string(), - Self::Overwrite => "overwrite".to_string(), - Self::Trash => "trash".to_string(), - Self::RenameNew => "rename_new".to_string(), - Self::RenameExisting => "rename_existing".to_string(), - } - } -} -impl std::str::FromStr - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict -{ - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "skip" => Ok(Self::Skip), - "overwrite" => Ok(Self::Overwrite), - "trash" => Ok(Self::Trash), - "rename_new" => Ok(Self::RenameNew), - "rename_existing" => Ok(Self::RenameExisting), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1CopyVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype3 { - pub echo: String, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype3> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype3 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype3) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype3 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype3 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype3::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype4 { - pub macos_tags: OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype4> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype4 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype4) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype4 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype4 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype4::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags) -> Self { - value.clone() - } -} -impl From> for OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags { - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype5 { - #[serde(rename = "move")] - pub move_: OrganizeRuleConfigurationRulesItemActionsItemSubtype5Move, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype5> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype5) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype5 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype5 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype5::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype5Move { - Variant0(String), - Variant1 { - dest: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - filesystem: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - on_conflict: - Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - rename_template: Option, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype5Move> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5Move -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype5Move) -> Self { - value.clone() - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict { - #[serde(rename = "skip")] - Skip, - #[serde(rename = "overwrite")] - Overwrite, - #[serde(rename = "trash")] - Trash, - #[serde(rename = "rename_new")] - RenameNew, - #[serde(rename = "rename_existing")] - RenameExisting, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict, - ) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict { - fn to_string(&self) -> String { - match *self { - Self::Skip => "skip".to_string(), - Self::Overwrite => "overwrite".to_string(), - Self::Trash => "trash".to_string(), - Self::RenameNew => "rename_new".to_string(), - Self::RenameExisting => "rename_existing".to_string(), - } - } -} -impl std::str::FromStr - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict -{ - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "skip" => Ok(Self::Skip), - "overwrite" => Ok(Self::Overwrite), - "trash" => Ok(Self::Trash), - "rename_new" => Ok(Self::RenameNew), - "rename_existing" => Ok(Self::RenameExisting), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5MoveVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype6 { - pub python: OrganizeRuleConfigurationRulesItemActionsItemSubtype6Python, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype6> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype6 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype6) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype6 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype6 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype6::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype6Python { - Variant0(String), - Variant1 { - code: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - run_in_simulation: Option, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype6Python> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype6Python -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype6Python) -> Self { - value.clone() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype7 { - pub rename: OrganizeRuleConfigurationRulesItemActionsItemSubtype7Rename, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype7> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype7) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype7 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype7 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype7::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype7Rename { - Variant0(String), - Variant1 { - name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - on_conflict: - Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - rename_template: Option, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype7Rename> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7Rename -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype7Rename) -> Self { - value.clone() - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict { - #[serde(rename = "skip")] - Skip, - #[serde(rename = "overwrite")] - Overwrite, - #[serde(rename = "trash")] - Trash, - #[serde(rename = "rename_new")] - RenameNew, - #[serde(rename = "rename_existing")] - RenameExisting, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict, - ) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict { - fn to_string(&self) -> String { - match *self { - Self::Skip => "skip".to_string(), - Self::Overwrite => "overwrite".to_string(), - Self::Trash => "trash".to_string(), - Self::RenameNew => "rename_new".to_string(), - Self::RenameExisting => "rename_existing".to_string(), - } - } -} -impl std::str::FromStr - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict -{ - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "skip" => Ok(Self::Skip), - "overwrite" => Ok(Self::Overwrite), - "trash" => Ok(Self::Trash), - "rename_new" => Ok(Self::RenameNew), - "rename_existing" => Ok(Self::RenameExisting), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7RenameVariant1OnConflict -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype8 { - pub shell: OrganizeRuleConfigurationRulesItemActionsItemSubtype8Shell, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype8> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype8 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype8) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype8 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype8 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype8::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype8Shell { - Variant0(String), - Variant1 { - cmd: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - ignore_errors: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - run_in_simulation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - simulation_output: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - simulation_returncode: Option, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype8Shell> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype8Shell -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype8Shell) -> Self { - value.clone() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype9 { - pub symlink: OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink, -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype9> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype9 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype9) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemActionsItemSubtype9 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype9 { - builder::OrganizeRuleConfigurationRulesItemActionsItemSubtype9::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink { - Variant0(String), - Variant1(Vec), - Variant2(serde_json::Map), -} -impl From<&OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink -{ - fn from(value: &OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink) -> Self { - value.clone() - } -} -impl From> for OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink { - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -impl From> - for OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink -{ - fn from(value: serde_json::Map) -> Self { - Self::Variant2(value) - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFilterMode { - #[serde(rename = "all")] - All, - #[serde(rename = "any")] - Any, - #[serde(rename = "none")] - None, -} -impl From<&OrganizeRuleConfigurationRulesItemFilterMode> - for OrganizeRuleConfigurationRulesItemFilterMode -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFilterMode) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFilterMode { - fn to_string(&self) -> String { - match *self { - Self::All => "all".to_string(), - Self::Any => "any".to_string(), - Self::None => "none".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFilterMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "all" => Ok(Self::All), - "any" => Ok(Self::Any), - "none" => Ok(Self::None), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFilterMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> for OrganizeRuleConfigurationRulesItemFilterMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom for OrganizeRuleConfigurationRulesItemFilterMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct OrganizeRuleConfigurationRulesItemFiltersItem { - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_0: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_1: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_2: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_3: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_4: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_5: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_6: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_7: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_8: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_9: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_10: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_11: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_12: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_13: Option, -} -impl From<&Self> for OrganizeRuleConfigurationRulesItemFiltersItem { - fn from(value: &Self) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemFiltersItem { - #[must_use] - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemFiltersItem { - builder::OrganizeRuleConfigurationRulesItemFiltersItem::default() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype0 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype0) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Matches files / folders by created date"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 { - #[serde(rename = "not created")] - NotCreated, - #[serde(rename = "created")] - Created, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotCreated => "not created".to_string(), - Self::Created => "created".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not created" => Ok(Self::NotCreated), - "created" => Ok(Self::Created), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype0Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype1 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype1> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype1) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0) -> Self { - Self::Variant0(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype10 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype10> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype10) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Matches files by last modified date"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 { - #[serde(rename = "not lastmodified")] - NotLastmodified, - #[serde(rename = "lastmodified")] - Lastmodified, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotLastmodified => "not lastmodified".to_string(), - Self::Lastmodified => "lastmodified".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not lastmodified" => Ok(Self::NotLastmodified), - "lastmodified" => Ok(Self::Lastmodified), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype10Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype11 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype11> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype11) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Filter by macOS tags"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 { - #[serde(rename = "not macos_tags")] - NotMacosTags, - #[serde(rename = "macos_tags")] - MacosTags, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotMacosTags => "not macos_tags".to_string(), - Self::MacosTags => "macos_tags".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not macos_tags" => Ok(Self::NotMacosTags), - "macos_tags" => Ok(Self::MacosTags), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype11Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype12 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype12> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype12) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Filter by MIME type associated with the file extension."] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 { - #[serde(rename = "not mimetype")] - NotMimetype, - #[serde(rename = "mimetype")] - Mimetype, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotMimetype => "not mimetype".to_string(), - Self::Mimetype => "mimetype".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not mimetype" => Ok(Self::NotMimetype), - "mimetype" => Ok(Self::Mimetype), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype12Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 {} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype13> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype13) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 { - pub fn builder() -> builder::OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 { - builder::OrganizeRuleConfigurationRulesItemFiltersItemSubtype13::default() - } -} -#[doc = "Matches files by the time the file was added to a folder."] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 { - #[serde(rename = "not date_added")] - NotDateAdded, - #[serde(rename = "date_added")] - DateAdded, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotDateAdded => "not date_added".to_string(), - Self::DateAdded => "date_added".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not date_added" => Ok(Self::NotDateAdded), - "date_added" => Ok(Self::DateAdded), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype1Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype2 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype2> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype2) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Matches files by the time the file was last used."] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 { - #[serde(rename = "not date_lastused")] - NotDateLastused, - #[serde(rename = "date_lastused")] - DateLastused, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotDateLastused => "not date_lastused".to_string(), - Self::DateLastused => "date_lastused".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not date_lastused" => Ok(Self::NotDateLastused), - "date_lastused" => Ok(Self::DateLastused), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype2Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype3 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype3> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype3) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "A fast duplicate file finder."] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 { - #[serde(rename = "not duplicate")] - NotDuplicate, - #[serde(rename = "duplicate")] - Duplicate, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotDuplicate => "not duplicate".to_string(), - Self::Duplicate => "duplicate".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not duplicate" => Ok(Self::NotDuplicate), - "duplicate" => Ok(Self::Duplicate), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype3Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype4 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype4> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype4) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Filter by image EXIF data"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 { - #[serde(rename = "not exif")] - NotExif, - #[serde(rename = "exif")] - Exif, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotExif => "not exif".to_string(), - Self::Exif => "exif".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not exif" => Ok(Self::NotExif), - "exif" => Ok(Self::Exif), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype4Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype5 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype5> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype5) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Filter by file extension"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 { - #[serde(rename = "not extension")] - NotExtension, - #[serde(rename = "extension")] - Extension, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotExtension => "not extension".to_string(), - Self::Extension => "extension".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not extension" => Ok(Self::NotExtension), - "extension" => Ok(Self::Extension), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype5Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype6 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype6> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype6) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Matches file content with the given regular expression"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 { - #[serde(rename = "not filecontent")] - NotFilecontent, - #[serde(rename = "filecontent")] - Filecontent, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotFilecontent => "not filecontent".to_string(), - Self::Filecontent => "filecontent".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not filecontent" => Ok(Self::NotFilecontent), - "filecontent" => Ok(Self::Filecontent), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype6Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype7 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype7> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype7) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Calculates the hash of a file."] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 { - #[serde(rename = "not hash")] - NotHash, - #[serde(rename = "hash")] - Hash, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotHash => "not hash".to_string(), - Self::Hash => "hash".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not hash" => Ok(Self::NotHash), - "hash" => Ok(Self::Hash), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype7Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype8 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype8> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype8) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Match files and folders by name"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 { - #[serde(rename = "not name")] - NotName, - #[serde(rename = "name")] - Name, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotName => "not name".to_string(), - Self::Name => "name".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not name" => Ok(Self::NotName), - "name" => Ok(Self::Name), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype8Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype9 { - Variant0(OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0), - Variant1 {}, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype9> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype9) -> Self { - value.clone() - } -} -impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9 -{ - fn from(value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0) -> Self { - Self::Variant0(value) - } -} -#[doc = "Matches files and folders by size"] -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 { - #[serde(rename = "not size")] - NotSize, - #[serde(rename = "size")] - Size, -} -impl From<&OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 -{ - fn from(value: &OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 { - fn to_string(&self) -> String { - match *self { - Self::NotSize => "not size".to_string(), - Self::Size => "size".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "not size" => Ok(Self::NotSize), - "size" => Ok(Self::Size), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype9Variant0 -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocations { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocations> - for OrganizeRuleConfigurationRulesItemLocations -{ - fn from(value: &OrganizeRuleConfigurationRulesItemLocations) -> Self { - value.clone() - } -} -impl From> - for OrganizeRuleConfigurationRulesItemLocations -{ - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged, deny_unknown_fields)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1Item { - Variant0(String), - Variant1 { - #[serde(default, skip_serializing_if = "Option::is_none")] - exclude_dirs: - Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - exclude_files: - Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - filesystem: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - filter: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - filter_dirs: - Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - ignore_errors: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - max_depth: Option, - path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - search: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - system_exclude_dirs: Option< - OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeDirs, - >, - #[serde(default, skip_serializing_if = "Option::is_none")] - system_exclude_files: Option< - OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeFiles, - >, - }, -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1Item> - for OrganizeRuleConfigurationRulesItemLocationsVariant1Item -{ - fn from(value: &OrganizeRuleConfigurationRulesItemLocationsVariant1Item) -> Self { - value.clone() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeDirs { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeDirs> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeDirs -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeDirs, - ) -> Self { - value.clone() - } -} -impl From> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeDirs -{ - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeFiles { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeFiles> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeFiles -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeFiles, - ) -> Self { - value.clone() - } -} -impl From> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1ExcludeFiles -{ - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Filter { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Filter> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Filter -{ - fn from(value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Filter) -> Self { - value.clone() - } -} -impl From> for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Filter { - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1FilterDirs { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1FilterDirs> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1FilterDirs -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1FilterDirs, - ) -> Self { - value.clone() - } -} -impl From> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1FilterDirs -{ - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth { - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_0: Option, - #[serde(flatten, default, skip_serializing_if = "Option::is_none")] - pub subtype_1: Option, -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth, - ) -> Self { - value.clone() - } -} -impl OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth { - pub fn builder( - ) -> builder::OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth { - builder::OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth::default() - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search { - #[serde(rename = "depth")] - Depth, - #[serde(rename = "breadth")] - Breadth, -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search -{ - fn from(value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search { - fn to_string(&self) -> String { - match *self { - Self::Depth => "depth".to_string(), - Self::Breadth => "breadth".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "depth" => Ok(Self::Depth), - "breadth" => Ok(Self::Breadth), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search -{ - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search -{ - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1Search -{ - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeDirs { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeDirs> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeDirs -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeDirs, - ) -> Self { - value.clone() - } -} -impl From> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeDirs -{ - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeFiles { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeFiles> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeFiles -{ - fn from( - value: &OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeFiles, - ) -> Self { - value.clone() - } -} -impl From> - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1SystemExcludeFiles -{ - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(untagged)] -pub enum OrganizeRuleConfigurationRulesItemTags { - Variant0(String), - Variant1(Vec), -} -impl From<&OrganizeRuleConfigurationRulesItemTags> for OrganizeRuleConfigurationRulesItemTags { - fn from(value: &OrganizeRuleConfigurationRulesItemTags) -> Self { - value.clone() - } -} -impl From> for OrganizeRuleConfigurationRulesItemTags { - fn from(value: Vec) -> Self { - Self::Variant1(value) - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum OrganizeRuleConfigurationRulesItemTargets { - #[serde(rename = "dirs")] - Dirs, - #[serde(rename = "files")] - Files, -} -impl From<&OrganizeRuleConfigurationRulesItemTargets> - for OrganizeRuleConfigurationRulesItemTargets -{ - fn from(value: &OrganizeRuleConfigurationRulesItemTargets) -> Self { - value.clone() - } -} -impl ToString for OrganizeRuleConfigurationRulesItemTargets { - fn to_string(&self) -> String { - match *self { - Self::Dirs => "dirs".to_string(), - Self::Files => "files".to_string(), - } - } -} -impl std::str::FromStr for OrganizeRuleConfigurationRulesItemTargets { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "dirs" => Ok(Self::Dirs), - "files" => Ok(Self::Files), - _ => Err("invalid value"), - } - } -} -impl std::convert::TryFrom<&str> for OrganizeRuleConfigurationRulesItemTargets { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } -} -impl std::convert::TryFrom<&String> for OrganizeRuleConfigurationRulesItemTargets { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } -} -impl std::convert::TryFrom for OrganizeRuleConfigurationRulesItemTargets { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } -} -pub mod builder { - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfiguration { - rules: Result, String>, - } - impl Default for OrganizeRuleConfiguration { - fn default() -> Self { - Self { - rules: Err("no value supplied for rules".to_string()), - } - } - } - impl OrganizeRuleConfiguration { - pub fn rules(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.rules = value - .try_into() - .map_err(|e| format!("error converting supplied value for rules: {}", e)); - self - } - } - impl std::convert::TryFrom for super::OrganizeRuleConfiguration { - type Error = String; - fn try_from(value: OrganizeRuleConfiguration) -> Result { - Ok(Self { - rules: value.rules?, - }) - } - } - impl From for OrganizeRuleConfiguration { - fn from(value: super::OrganizeRuleConfiguration) -> Self { - Self { - rules: Ok(value.rules), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItem { - actions: Result, String>, - enabled: Result, String>, - filter_mode: Result, String>, - filters: Result, String>, - locations: Result, - name: Result, String>, - subfolders: Result, String>, - tags: Result, String>, - targets: Result, String>, - } - impl Default for OrganizeRuleConfigurationRulesItem { - fn default() -> Self { - Self { - actions: Err("no value supplied for actions".to_string()), - enabled: Ok(Default::default()), - filter_mode: Ok(Default::default()), - filters: Ok(Default::default()), - locations: Err("no value supplied for locations".to_string()), - name: Ok(Default::default()), - subfolders: Ok(Default::default()), - tags: Ok(Default::default()), - targets: Ok(Default::default()), - } - } - } - impl OrganizeRuleConfigurationRulesItem { - pub fn actions(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.actions = value - .try_into() - .map_err(|e| format!("error converting supplied value for actions: {}", e)); - self - } - pub fn enabled(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.enabled = value - .try_into() - .map_err(|e| format!("error converting supplied value for enabled: {}", e)); - self - } - pub fn filter_mode(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.filter_mode = value - .try_into() - .map_err(|e| format!("error converting supplied value for filter_mode: {}", e)); - self - } - pub fn filters(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.filters = value - .try_into() - .map_err(|e| format!("error converting supplied value for filters: {}", e)); - self - } - pub fn locations(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.locations = value - .try_into() - .map_err(|e| format!("error converting supplied value for locations: {}", e)); - self - } - pub fn name(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.name = value - .try_into() - .map_err(|e| format!("error converting supplied value for name: {}", e)); - self - } - pub fn subfolders(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.subfolders = value - .try_into() - .map_err(|e| format!("error converting supplied value for subfolders: {}", e)); - self - } - pub fn tags(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.tags = value - .try_into() - .map_err(|e| format!("error converting supplied value for tags: {}", e)); - self - } - pub fn targets(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.targets = value - .try_into() - .map_err(|e| format!("error converting supplied value for targets: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItem - { - type Error = String; - fn try_from(value: OrganizeRuleConfigurationRulesItem) -> Result { - Ok(Self { - actions: value.actions?, - enabled: value.enabled?, - filter_mode: value.filter_mode?, - filters: value.filters?, - locations: value.locations?, - name: value.name?, - subfolders: value.subfolders?, - tags: value.tags?, - targets: value.targets?, - }) - } - } - impl From for OrganizeRuleConfigurationRulesItem { - fn from(value: super::OrganizeRuleConfigurationRulesItem) -> Self { - Self { - actions: Ok(value.actions), - enabled: Ok(value.enabled), - filter_mode: Ok(value.filter_mode), - filters: Ok(value.filters), - locations: Ok(value.locations), - name: Ok(value.name), - subfolders: Ok(value.subfolders), - tags: Ok(value.tags), - targets: Ok(value.targets), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItem { - subtype_0: - Result, String>, - subtype_1: - Result, String>, - subtype_2: Result, String>, - subtype_3: - Result, String>, - subtype_4: - Result, String>, - subtype_5: - Result, String>, - subtype_6: - Result, String>, - subtype_7: - Result, String>, - subtype_8: - Result, String>, - subtype_9: - Result, String>, - subtype_10: Result, String>, - subtype_11: - Result, String>, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItem { - fn default() -> Self { - Self { - subtype_0: Ok(Default::default()), - subtype_1: Ok(Default::default()), - subtype_2: Ok(Default::default()), - subtype_3: Ok(Default::default()), - subtype_4: Ok(Default::default()), - subtype_5: Ok(Default::default()), - subtype_6: Ok(Default::default()), - subtype_7: Ok(Default::default()), - subtype_8: Ok(Default::default()), - subtype_9: Ok(Default::default()), - subtype_10: Ok(Default::default()), - subtype_11: Ok(Default::default()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItem { - pub fn subtype_0(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_0 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_0: {}", e)); - self - } - pub fn subtype_1(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_1 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_1: {}", e)); - self - } - pub fn subtype_2(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.subtype_2 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_2: {}", e)); - self - } - pub fn subtype_3(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_3 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_3: {}", e)); - self - } - pub fn subtype_4(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_4 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_4: {}", e)); - self - } - pub fn subtype_5(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_5 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_5: {}", e)); - self - } - pub fn subtype_6(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_6 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_6: {}", e)); - self - } - pub fn subtype_7(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_7 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_7: {}", e)); - self - } - pub fn subtype_8(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_8 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_8: {}", e)); - self - } - pub fn subtype_9(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_9 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_9: {}", e)); - self - } - pub fn subtype_10(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.subtype_10 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_10: {}", e)); - self - } - pub fn subtype_11(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_11 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_11: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItem - { - type Error = String; - fn try_from(value: OrganizeRuleConfigurationRulesItemActionsItem) -> Result { - Ok(Self { - subtype_0: value.subtype_0?, - subtype_1: value.subtype_1?, - subtype_2: value.subtype_2?, - subtype_3: value.subtype_3?, - subtype_4: value.subtype_4?, - subtype_5: value.subtype_5?, - subtype_6: value.subtype_6?, - subtype_7: value.subtype_7?, - subtype_8: value.subtype_8?, - subtype_9: value.subtype_9?, - subtype_10: value.subtype_10?, - subtype_11: value.subtype_11?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItem - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItem) -> Self { - Self { - subtype_0: Ok(value.subtype_0), - subtype_1: Ok(value.subtype_1), - subtype_2: Ok(value.subtype_2), - subtype_3: Ok(value.subtype_3), - subtype_4: Ok(value.subtype_4), - subtype_5: Ok(value.subtype_5), - subtype_6: Ok(value.subtype_6), - subtype_7: Ok(value.subtype_7), - subtype_8: Ok(value.subtype_8), - subtype_9: Ok(value.subtype_9), - subtype_10: Ok(value.subtype_10), - subtype_11: Ok(value.subtype_11), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype0 { - subtype_0: Result, String>, - subtype_1: Result< - Option, - String, - >, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype0 { - fn default() -> Self { - Self { - subtype_0: Ok(Default::default()), - subtype_1: Ok(Default::default()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype0 { - pub fn subtype_0(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.subtype_0 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_0: {}", e)); - self - } - pub fn subtype_1(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_1 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_1: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype0 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype0, - ) -> Result { - Ok(Self { - subtype_0: value.subtype_0?, - subtype_1: value.subtype_1?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype0 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype0) -> Self { - Self { - subtype_0: Ok(value.subtype_0), - subtype_1: Ok(value.subtype_1), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 { - confirm: Result< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm, - String, - >, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 { - fn default() -> Self { - Self { - confirm: Err("no value supplied for confirm".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 { - pub fn confirm(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1Confirm, - >, - T::Error: std::fmt::Display, - { - self.confirm = value - .try_into() - .map_err(|e| format!("error converting supplied value for confirm: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1, - ) -> Result { - Ok(Self { - confirm: value.confirm?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1 - { - fn from( - value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype0Subtype1, - ) -> Self { - Self { - confirm: Ok(value.confirm), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype1 { - copy: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype1 { - fn default() -> Self { - Self { - copy: Err("no value supplied for copy".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype1 { - pub fn copy(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype1Copy, - >, - T::Error: std::fmt::Display, - { - self.copy = value - .try_into() - .map_err(|e| format!("error converting supplied value for copy: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype1 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype1, - ) -> Result { - Ok(Self { copy: value.copy? }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype1 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype1) -> Self { - Self { - copy: Ok(value.copy), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype11 { - write: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype11 { - fn default() -> Self { - Self { - write: Err("no value supplied for write".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype11 { - pub fn write(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write, - >, - T::Error: std::fmt::Display, - { - self.write = value - .try_into() - .map_err(|e| format!("error converting supplied value for write: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype11 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype11, - ) -> Result { - Ok(Self { - write: value.write?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype11) -> Self { - Self { - write: Ok(value.write), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write { - clear_before_first_write: Result, String>, - filesystem: Result, String>, - mode: Result< - Option, - String, - >, - newline: Result, String>, - path: Result, String>, - text: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write { - fn default() -> Self { - Self { - clear_before_first_write: Ok(Default::default()), - filesystem: Ok(Default::default()), - mode: Ok(Default::default()), - newline: Ok(Default::default()), - path: Ok(Default::default()), - text: Err("no value supplied for text".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write { - pub fn clear_before_first_write(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.clear_before_first_write = value.try_into().map_err(|e| { - format!( - "error converting supplied value for clear_before_first_write: {}", - e - ) - }); - self - } - pub fn filesystem(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.filesystem = value - .try_into() - .map_err(|e| format!("error converting supplied value for filesystem: {}", e)); - self - } - pub fn mode(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.mode = value - .try_into() - .map_err(|e| format!("error converting supplied value for mode: {}", e)); - self - } - pub fn newline(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.newline = value - .try_into() - .map_err(|e| format!("error converting supplied value for newline: {}", e)); - self - } - pub fn path(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.path = value - .try_into() - .map_err(|e| format!("error converting supplied value for path: {}", e)); - self - } - pub fn text(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.text = value - .try_into() - .map_err(|e| format!("error converting supplied value for text: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write, - ) -> Result { - Ok(Self { - clear_before_first_write: value.clear_before_first_write?, - filesystem: value.filesystem?, - mode: value.mode?, - newline: value.newline?, - path: value.path?, - text: value.text?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype11Write) -> Self { - Self { - clear_before_first_write: Ok(value.clear_before_first_write), - filesystem: Ok(value.filesystem), - mode: Ok(value.mode), - newline: Ok(value.newline), - path: Ok(value.path), - text: Ok(value.text), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype3 { - echo: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype3 { - fn default() -> Self { - Self { - echo: Err("no value supplied for echo".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype3 { - pub fn echo(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.echo = value - .try_into() - .map_err(|e| format!("error converting supplied value for echo: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype3 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype3, - ) -> Result { - Ok(Self { echo: value.echo? }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype3 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype3) -> Self { - Self { - echo: Ok(value.echo), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype4 { - macos_tags: - Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype4 { - fn default() -> Self { - Self { - macos_tags: Err("no value supplied for macos_tags".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype4 { - pub fn macos_tags(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype4MacosTags, - >, - T::Error: std::fmt::Display, - { - self.macos_tags = value - .try_into() - .map_err(|e| format!("error converting supplied value for macos_tags: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype4 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype4, - ) -> Result { - Ok(Self { - macos_tags: value.macos_tags?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype4 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype4) -> Self { - Self { - macos_tags: Ok(value.macos_tags), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype5 { - move_: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype5 { - fn default() -> Self { - Self { - move_: Err("no value supplied for move_".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype5 { - pub fn move_(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype5Move, - >, - T::Error: std::fmt::Display, - { - self.move_ = value - .try_into() - .map_err(|e| format!("error converting supplied value for move_: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype5 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype5, - ) -> Result { - Ok(Self { - move_: value.move_?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype5 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype5) -> Self { - Self { - move_: Ok(value.move_), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype6 { - python: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype6 { - fn default() -> Self { - Self { - python: Err("no value supplied for python".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype6 { - pub fn python(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype6Python, - >, - T::Error: std::fmt::Display, - { - self.python = value - .try_into() - .map_err(|e| format!("error converting supplied value for python: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype6 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype6, - ) -> Result { - Ok(Self { - python: value.python?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype6 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype6) -> Self { - Self { - python: Ok(value.python), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype7 { - rename: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype7 { - fn default() -> Self { - Self { - rename: Err("no value supplied for rename".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype7 { - pub fn rename(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype7Rename, - >, - T::Error: std::fmt::Display, - { - self.rename = value - .try_into() - .map_err(|e| format!("error converting supplied value for rename: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype7 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype7, - ) -> Result { - Ok(Self { - rename: value.rename?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype7 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype7) -> Self { - Self { - rename: Ok(value.rename), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype8 { - shell: Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype8 { - fn default() -> Self { - Self { - shell: Err("no value supplied for shell".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype8 { - pub fn shell(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype8Shell, - >, - T::Error: std::fmt::Display, - { - self.shell = value - .try_into() - .map_err(|e| format!("error converting supplied value for shell: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype8 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype8, - ) -> Result { - Ok(Self { - shell: value.shell?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype8 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype8) -> Self { - Self { - shell: Ok(value.shell), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemActionsItemSubtype9 { - symlink: - Result, - } - impl Default for OrganizeRuleConfigurationRulesItemActionsItemSubtype9 { - fn default() -> Self { - Self { - symlink: Err("no value supplied for symlink".to_string()), - } - } - } - impl OrganizeRuleConfigurationRulesItemActionsItemSubtype9 { - pub fn symlink(mut self, value: T) -> Self - where - T: std::convert::TryInto< - super::OrganizeRuleConfigurationRulesItemActionsItemSubtype9Symlink, - >, - T::Error: std::fmt::Display, - { - self.symlink = value - .try_into() - .map_err(|e| format!("error converting supplied value for symlink: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemActionsItemSubtype9 - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemActionsItemSubtype9, - ) -> Result { - Ok(Self { - symlink: value.symlink?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemActionsItemSubtype9 - { - fn from(value: super::OrganizeRuleConfigurationRulesItemActionsItemSubtype9) -> Self { - Self { - symlink: Ok(value.symlink), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemFiltersItem { - subtype_0: - Result, String>, - subtype_1: - Result, String>, - subtype_2: - Result, String>, - subtype_3: - Result, String>, - subtype_4: - Result, String>, - subtype_5: - Result, String>, - subtype_6: - Result, String>, - subtype_7: - Result, String>, - subtype_8: - Result, String>, - subtype_9: - Result, String>, - subtype_10: - Result, String>, - subtype_11: - Result, String>, - subtype_12: - Result, String>, - subtype_13: - Result, String>, - } - impl Default for OrganizeRuleConfigurationRulesItemFiltersItem { - fn default() -> Self { - Self { - subtype_0: Ok(Default::default()), - subtype_1: Ok(Default::default()), - subtype_2: Ok(Default::default()), - subtype_3: Ok(Default::default()), - subtype_4: Ok(Default::default()), - subtype_5: Ok(Default::default()), - subtype_6: Ok(Default::default()), - subtype_7: Ok(Default::default()), - subtype_8: Ok(Default::default()), - subtype_9: Ok(Default::default()), - subtype_10: Ok(Default::default()), - subtype_11: Ok(Default::default()), - subtype_12: Ok(Default::default()), - subtype_13: Ok(Default::default()), - } - } - } - impl OrganizeRuleConfigurationRulesItemFiltersItem { - pub fn subtype_0(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_0 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_0: {}", e)); - self - } - pub fn subtype_1(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_1 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_1: {}", e)); - self - } - pub fn subtype_2(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_2 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_2: {}", e)); - self - } - pub fn subtype_3(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_3 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_3: {}", e)); - self - } - pub fn subtype_4(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_4 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_4: {}", e)); - self - } - pub fn subtype_5(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_5 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_5: {}", e)); - self - } - pub fn subtype_6(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_6 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_6: {}", e)); - self - } - pub fn subtype_7(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_7 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_7: {}", e)); - self - } - pub fn subtype_8(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_8 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_8: {}", e)); - self - } - pub fn subtype_9(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_9 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_9: {}", e)); - self - } - pub fn subtype_10(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_10 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_10: {}", e)); - self - } - pub fn subtype_11(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_11 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_11: {}", e)); - self - } - pub fn subtype_12(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_12 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_12: {}", e)); - self - } - pub fn subtype_13(mut self, value: T) -> Self - where - T: std::convert::TryInto< - Option, - >, - T::Error: std::fmt::Display, - { - self.subtype_13 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_13: {}", e)); - self - } - } - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemFiltersItem - { - type Error = String; - fn try_from(value: OrganizeRuleConfigurationRulesItemFiltersItem) -> Result { - Ok(Self { - subtype_0: value.subtype_0?, - subtype_1: value.subtype_1?, - subtype_2: value.subtype_2?, - subtype_3: value.subtype_3?, - subtype_4: value.subtype_4?, - subtype_5: value.subtype_5?, - subtype_6: value.subtype_6?, - subtype_7: value.subtype_7?, - subtype_8: value.subtype_8?, - subtype_9: value.subtype_9?, - subtype_10: value.subtype_10?, - subtype_11: value.subtype_11?, - subtype_12: value.subtype_12?, - subtype_13: value.subtype_13?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemFiltersItem - { - fn from(value: super::OrganizeRuleConfigurationRulesItemFiltersItem) -> Self { - Self { - subtype_0: Ok(value.subtype_0), - subtype_1: Ok(value.subtype_1), - subtype_2: Ok(value.subtype_2), - subtype_3: Ok(value.subtype_3), - subtype_4: Ok(value.subtype_4), - subtype_5: Ok(value.subtype_5), - subtype_6: Ok(value.subtype_6), - subtype_7: Ok(value.subtype_7), - subtype_8: Ok(value.subtype_8), - subtype_9: Ok(value.subtype_9), - subtype_10: Ok(value.subtype_10), - subtype_11: Ok(value.subtype_11), - subtype_12: Ok(value.subtype_12), - subtype_13: Ok(value.subtype_13), - } - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 {} - impl Default for OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 { - fn default() -> Self { - Self {} - } - } - impl OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 {} - impl std::convert::TryFrom - for super::OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 - { - type Error = String; - fn try_from( - _value: OrganizeRuleConfigurationRulesItemFiltersItemSubtype13, - ) -> Result { - Ok(Self {}) - } - } - impl From - for OrganizeRuleConfigurationRulesItemFiltersItemSubtype13 - { - fn from(_value: super::OrganizeRuleConfigurationRulesItemFiltersItemSubtype13) -> Self { - Self {} - } - } - #[derive(Clone, Debug)] - pub struct OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth { - subtype_0: Result, String>, - subtype_1: Result, String>, - } - impl Default for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth { - fn default() -> Self { - Self { - subtype_0: Ok(Default::default()), - subtype_1: Ok(Default::default()), - } - } - } - impl OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth { - pub fn subtype_0(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.subtype_0 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_0: {}", e)); - self - } - pub fn subtype_1(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.subtype_1 = value - .try_into() - .map_err(|e| format!("error converting supplied value for subtype_1: {}", e)); - self - } - } - impl - std::convert::TryFrom< - OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth, - > for super::OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth - { - type Error = String; - fn try_from( - value: OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth, - ) -> Result { - Ok(Self { - subtype_0: value.subtype_0?, - subtype_1: value.subtype_1?, - }) - } - } - impl From - for OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth - { - fn from( - value: super::OrganizeRuleConfigurationRulesItemLocationsVariant1ItemVariant1MaxDepth, - ) -> Self { - Self { - subtype_0: Ok(value.subtype_0), - subtype_1: Ok(value.subtype_1), - } - } - } -} diff --git a/tests/config.rs b/examples/.gitkeep similarity index 100% rename from tests/config.rs rename to examples/.gitkeep diff --git a/examples/parse_py_organize_config.rs b/examples/parse_py_organize_config.rs deleted file mode 100644 index e606096..0000000 --- a/examples/parse_py_organize_config.rs +++ /dev/null @@ -1,13 +0,0 @@ -use organize_rs_core::rules::py_organize::OrganizeRuleConfiguration; -use serde_yaml::from_reader; -use std::fs::File; -use std::io::Read; - -pub fn main() { - let file = - File::open(r#"C:\Users\dailyuse\AppData\Local\organize\organize_no_anchors.yaml"#).unwrap(); - - let parsed: OrganizeRuleConfiguration = from_reader(file).unwrap(); - - println!("{parsed:#?}") -} diff --git a/tests/acceptance.rs b/tests/acceptance.rs deleted file mode 100644 index c5c33ae..0000000 --- a/tests/acceptance.rs +++ /dev/null @@ -1,91 +0,0 @@ -//! Acceptance test: runs the application as a subprocess and asserts its -//! output for given argument combinations matches what is expected. -//! -//! Modify and/or delete these as you see fit to test the specific needs of -//! your application. -//! -//! For more information, see: -//! - -// Tip: Deny warnings with `RUSTFLAGS="-D warnings"` environment variable in CI - -#![forbid(unsafe_code)] -#![warn( - missing_docs, - rust_2018_idioms, - trivial_casts, - unused_lifetimes, - unused_qualifications -)] - -use abscissa_core::testing::prelude::*; -use organize::config::OrganizeConfig; -use once_cell::sync::Lazy; - -/// Executes your application binary via `cargo run`. -/// -/// Storing this value as a [`Lazy`] static ensures that all instances of -/// the runner acquire a mutex when executing commands and inspecting -/// exit statuses, serializing what would otherwise be multithreaded -/// invocations as `cargo test` executes tests in parallel by default. -pub static RUNNER: Lazy = Lazy::new(|| CmdRunner::default()); - -/// Use `OrganizeConfig::default()` value if no config or args -#[test] -fn start_no_args() { - let mut runner = RUNNER.clone(); - let mut cmd = runner.arg("start").capture_stdout().run(); - cmd.stdout().expect_line("Hello, world!"); - cmd.wait().unwrap().expect_success(); -} - -/// Use command-line argument value -#[test] -fn start_with_args() { - let mut runner = RUNNER.clone(); - let mut cmd = runner - .args(&["start", "acceptance", "test"]) - .capture_stdout() - .run(); - - cmd.stdout().expect_line("Hello, acceptance test!"); - cmd.wait().unwrap().expect_success(); -} - -/// Use configured value -#[test] -fn start_with_config_no_args() { - let mut config = OrganizeConfig::default(); - config.hello.recipient = "configured recipient".to_owned(); - let expected_line = format!("Hello, {}!", &config.hello.recipient); - - let mut runner = RUNNER.clone(); - let mut cmd = runner.config(&config).arg("start").capture_stdout().run(); - cmd.stdout().expect_line(&expected_line); - cmd.wait().unwrap().expect_success(); -} - -/// Override configured value with command-line argument -#[test] -fn start_with_config_and_args() { - let mut config = OrganizeConfig::default(); - config.hello.recipient = "configured recipient".to_owned(); - - let mut runner = RUNNER.clone(); - let mut cmd = runner - .config(&config) - .args(&["start", "acceptance", "test"]) - .capture_stdout() - .run(); - - cmd.stdout().expect_line("Hello, acceptance test!"); - cmd.wait().unwrap().expect_success(); -} - -/// Example of a test which matches a regular expression -#[test] -fn version_no_args() { - let mut runner = RUNNER.clone(); - let mut cmd = runner.arg("--version").capture_stdout().run(); - cmd.stdout().expect_regex(r"\A\w+ [\d\.\-]+\z"); -} diff --git a/tests/fixtures/.gitkeep b/tests/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixtures/config_schema.json b/tests/fixtures/config_schema.json deleted file mode 100644 index 14ccadc..0000000 --- a/tests/fixtures/config_schema.json +++ /dev/null @@ -1,772 +0,0 @@ -{ - "type": "object", - "properties": { - "rules": { - "description": "All rules are defined here.", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "subfolders": { - "type": "boolean" - }, - "filter_mode": { - "enum": [ - "all", - "any", - "none" - ] - }, - "tags": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "targets": { - "enum": [ - "dirs", - "files" - ] - }, - "locations": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "path": { - "type": "string" - }, - "max_depth": { - "anyOf": [ - { - "type": "integer" - }, - { - "const": null - } - ] - }, - "search": { - "enum": [ - "depth", - "breadth" - ] - }, - "exclude_files": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "exclude_dirs": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "system_exclude_files": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "system_exclude_dirs": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "filter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "filter_dirs": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "ignore_errors": { - "type": "boolean" - }, - "filesystem": { - "type": "string" - } - }, - "required": [ - "path" - ], - "additionalProperties": false - } - ] - } - } - ] - }, - "filters": { - "type": "array", - "items": { - "anyOf": [ - { - "anyOf": [ - { - "description": "Matches files / folders by created date", - "enum": [ - "not created", - "created" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Matches files by the time the file was added to a folder.", - "enum": [ - "not date_added", - "date_added" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Matches files by the time the file was last used.", - "enum": [ - "not date_lastused", - "date_lastused" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "A fast duplicate file finder.", - "enum": [ - "not duplicate", - "duplicate" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Filter by image EXIF data", - "enum": [ - "not exif", - "exif" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Filter by file extension", - "enum": [ - "not extension", - "extension" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Matches file content with the given regular expression", - "enum": [ - "not filecontent", - "filecontent" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Calculates the hash of a file.", - "enum": [ - "not hash", - "hash" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Match files and folders by name", - "enum": [ - "not name", - "name" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Matches files and folders by size", - "enum": [ - "not size", - "size" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Matches files by last modified date", - "enum": [ - "not lastmodified", - "lastmodified" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Filter by macOS tags", - "enum": [ - "not macos_tags", - "macos_tags" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "description": "Filter by MIME type associated with the file extension.", - "enum": [ - "not mimetype", - "mimetype" - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": false - } - ] - } - }, - "actions": { - "type": "array", - "items": { - "anyOf": [ - { - "anyOf": [ - { - "const": "confirm" - }, - { - "type": "object", - "properties": { - "confirm": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - }, - "default": { - "type": "boolean" - } - }, - "required": [], - "additionalProperties": false - } - ] - } - }, - "required": [ - "confirm" - ], - "additionalProperties": false - } - ] - }, - { - "type": "object", - "properties": { - "copy": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "dest": { - "type": "string" - }, - "on_conflict": { - "enum": [ - "skip", - "overwrite", - "trash", - "rename_new", - "rename_existing" - ] - }, - "rename_template": { - "type": "string" - }, - "filesystem": { - "type": "string" - } - }, - "required": [ - "dest" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "copy" - ], - "additionalProperties": false - }, - { - "const": "delete" - }, - { - "type": "object", - "properties": { - "echo": { - "type": "string" - } - }, - "required": [ - "echo" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "macos_tags": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - }, - "required": [ - "macos_tags" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "move": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "dest": { - "type": "string" - }, - "on_conflict": { - "enum": [ - "skip", - "overwrite", - "trash", - "rename_new", - "rename_existing" - ] - }, - "rename_template": { - "type": "string" - }, - "filesystem": { - "type": "string" - } - }, - "required": [ - "dest" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "move" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "python": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "run_in_simulation": { - "type": "boolean" - } - }, - "required": [ - "code" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "python" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "rename": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "on_conflict": { - "enum": [ - "skip", - "overwrite", - "trash", - "rename_new", - "rename_existing" - ] - }, - "rename_template": { - "type": "string" - } - }, - "required": [ - "name" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "rename" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "shell": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "cmd": { - "type": "string" - }, - "run_in_simulation": { - "type": "boolean" - }, - "ignore_errors": { - "type": "boolean" - }, - "simulation_output": { - "type": "string" - }, - "simulation_returncode": { - "type": "integer" - } - }, - "required": [ - "cmd" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "shell" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "symlink": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "object", - "properties": {}, - "required": [], - "additionalProperties": true - } - ] - } - }, - "required": [ - "symlink" - ], - "additionalProperties": false - }, - { - "const": "trash" - }, - { - "type": "object", - "properties": { - "write": { - "type": "object", - "properties": { - "text": { - "type": "string" - }, - "path": { - "type": "string" - }, - "mode": { - "enum": [ - "prepend", - "append", - "overwrite" - ] - }, - "newline": { - "type": "boolean" - }, - "clear_before_first_write": { - "type": "boolean" - }, - "filesystem": { - "type": "string" - } - }, - "required": [ - "text" - ], - "additionalProperties": false - } - }, - "required": [ - "write" - ], - "additionalProperties": false - } - ] - } - } - }, - "required": [ - "locations", - "actions" - ], - "additionalProperties": false - } - } - }, - "required": [ - "rules" - ], - "additionalProperties": false, - "$id": "https://tfeldmann.de/organize.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "organize rule configuration" -} \ No newline at end of file