From df3eeea62503aae0405fe52a99012a23809dc8ca Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Sat, 18 Nov 2023 23:34:49 +0100 Subject: [PATCH] Inline NotebookDocumentFilter variants. --- src/notebook.rs | 82 +++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 51 deletions(-) diff --git a/src/notebook.rs b/src/notebook.rs index 6673f0c..777bc5a 100644 --- a/src/notebook.rs +++ b/src/notebook.rs @@ -207,63 +207,43 @@ pub enum Notebook { NotebookDocumentFilter(NotebookDocumentFilter), } -#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] -#[serde(untagged)] -pub enum NotebookDocumentFilter { - ByType(NotebookDocumentFilterByType), - ByScheme(NotebookDocumentFilterByScheme), - ByPattern(NotebookDocumentFilterByPattern), -} - -/// A notebook document filter denotes a notebook document by -/// different properties. -/// -/// @since 3.17.0 -#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct NotebookDocumentFilterByType { - /// The type of the enclosing notebook. - pub notebook_type: String, - /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`. - #[serde(skip_serializing_if = "Option::is_none")] - pub scheme: Option, - /// A glob pattern. - #[serde(skip_serializing_if = "Option::is_none")] - pub pattern: Option, -} - /// A notebook document filter denotes a notebook document by /// different properties. /// /// @since 3.17.0 #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct NotebookDocumentFilterByScheme { - /// The type of the enclosing notebook. - #[serde(skip_serializing_if = "Option::is_none")] - pub notebook_type: Option, - /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`. - pub scheme: String, - /// A glob pattern. - #[serde(skip_serializing_if = "Option::is_none")] - pub pattern: Option, -} - -/// A notebook document filter denotes a notebook document by -/// different properties. -/// -/// @since 3.17.0 -#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct NotebookDocumentFilterByPattern { - /// The type of the enclosing notebook. - #[serde(skip_serializing_if = "Option::is_none")] - pub notebook_type: Option, - /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`. - #[serde(skip_serializing_if = "Option::is_none")] - pub scheme: Option, - /// A glob pattern. - pub pattern: String, +pub enum NotebookDocumentFilter { + ByType { + /// The type of the enclosing notebook. + notebook_type: String, + /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`. + #[serde(skip_serializing_if = "Option::is_none")] + scheme: Option, + /// A glob pattern. + #[serde(skip_serializing_if = "Option::is_none")] + pattern: Option, + }, + ByScheme { + /// The type of the enclosing notebook. + #[serde(skip_serializing_if = "Option::is_none")] + notebook_type: Option, + /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`. + scheme: String, + /// A glob pattern. + #[serde(skip_serializing_if = "Option::is_none")] + pattern: Option, + }, + ByPattern { + /// The type of the enclosing notebook. + #[serde(skip_serializing_if = "Option::is_none")] + notebook_type: Option, + /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`. + #[serde(skip_serializing_if = "Option::is_none")] + scheme: Option, + /// A glob pattern. + pattern: String, + }, } mod notification_params {