1use serde::{Deserialize, Serialize};
2use std::{borrow::Cow, fmt};
3
4#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
10#[serde(into = "String", from = "String")]
11pub enum SemanticTokenTypes {
12 Namespace,
13 Type,
16 Class,
17 Enum,
18 Interface,
19 Struct,
20 TypeParameter,
21 Parameter,
22 Variable,
23 Property,
24 EnumMember,
25 Event,
26 Function,
27 Method,
28 Macro,
29 Keyword,
30 Modifier,
31 Comment,
32 String,
33 Number,
34 Regexp,
35 Operator,
36 Decorator,
38 Label,
40 #[serde(untagged)]
42 Custom(Cow<'static, str>),
43}
44impl From<SemanticTokenTypes> for String {
45 fn from(e: SemanticTokenTypes) -> Self {
46 match e {
47 SemanticTokenTypes::Namespace => "namespace".to_string(),
48 SemanticTokenTypes::Type => "type".to_string(),
49 SemanticTokenTypes::Class => "class".to_string(),
50 SemanticTokenTypes::Enum => "enum".to_string(),
51 SemanticTokenTypes::Interface => "interface".to_string(),
52 SemanticTokenTypes::Struct => "struct".to_string(),
53 SemanticTokenTypes::TypeParameter => "typeParameter".to_string(),
54 SemanticTokenTypes::Parameter => "parameter".to_string(),
55 SemanticTokenTypes::Variable => "variable".to_string(),
56 SemanticTokenTypes::Property => "property".to_string(),
57 SemanticTokenTypes::EnumMember => "enumMember".to_string(),
58 SemanticTokenTypes::Event => "event".to_string(),
59 SemanticTokenTypes::Function => "function".to_string(),
60 SemanticTokenTypes::Method => "method".to_string(),
61 SemanticTokenTypes::Macro => "macro".to_string(),
62 SemanticTokenTypes::Keyword => "keyword".to_string(),
63 SemanticTokenTypes::Modifier => "modifier".to_string(),
64 SemanticTokenTypes::Comment => "comment".to_string(),
65 SemanticTokenTypes::String => "string".to_string(),
66 SemanticTokenTypes::Number => "number".to_string(),
67 SemanticTokenTypes::Regexp => "regexp".to_string(),
68 SemanticTokenTypes::Operator => "operator".to_string(),
69 SemanticTokenTypes::Decorator => "decorator".to_string(),
70 SemanticTokenTypes::Label => "label".to_string(),
71 SemanticTokenTypes::Custom(any) => any.into_owned(),
72 }
73 }
74}
75impl From<String> for SemanticTokenTypes {
76 fn from(v: String) -> Self {
77 match v.as_str() {
78 "namespace" => Self::Namespace,
79 "type" => Self::Type,
80 "class" => Self::Class,
81 "enum" => Self::Enum,
82 "interface" => Self::Interface,
83 "struct" => Self::Struct,
84 "typeParameter" => Self::TypeParameter,
85 "parameter" => Self::Parameter,
86 "variable" => Self::Variable,
87 "property" => Self::Property,
88 "enumMember" => Self::EnumMember,
89 "event" => Self::Event,
90 "function" => Self::Function,
91 "method" => Self::Method,
92 "macro" => Self::Macro,
93 "keyword" => Self::Keyword,
94 "modifier" => Self::Modifier,
95 "comment" => Self::Comment,
96 "string" => Self::String,
97 "number" => Self::Number,
98 "regexp" => Self::Regexp,
99 "operator" => Self::Operator,
100 "decorator" => Self::Decorator,
101 "label" => Self::Label,
102 _ => Self::Custom(Cow::Owned(v)),
103 }
104 }
105}
106impl SemanticTokenTypes {
107 #[must_use]
109 pub const fn new(s: &'static str) -> Self {
110 Self::Custom(Cow::Borrowed(s))
111 }
112}
113impl From<&'static str> for SemanticTokenTypes {
114 fn from(s: &'static str) -> Self {
115 match s {
116 "namespace" => Self::Namespace,
117 "type" => Self::Type,
118 "class" => Self::Class,
119 "enum" => Self::Enum,
120 "interface" => Self::Interface,
121 "struct" => Self::Struct,
122 "typeParameter" => Self::TypeParameter,
123 "parameter" => Self::Parameter,
124 "variable" => Self::Variable,
125 "property" => Self::Property,
126 "enumMember" => Self::EnumMember,
127 "event" => Self::Event,
128 "function" => Self::Function,
129 "method" => Self::Method,
130 "macro" => Self::Macro,
131 "keyword" => Self::Keyword,
132 "modifier" => Self::Modifier,
133 "comment" => Self::Comment,
134 "string" => Self::String,
135 "number" => Self::Number,
136 "regexp" => Self::Regexp,
137 "operator" => Self::Operator,
138 "decorator" => Self::Decorator,
139 "label" => Self::Label,
140 _ => Self::Custom(Cow::Borrowed(s)),
141 }
142 }
143}
144impl fmt::Display for SemanticTokenTypes {
145 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
146 let s: String = self.clone().into();
147 write!(f, "{s}")
148 }
149}
150impl SemanticTokenTypes {
151 #[must_use]
152 pub fn as_str(&self) -> &str {
153 match self {
154 Self::Namespace => "namespace",
155 Self::Type => "type",
156 Self::Class => "class",
157 Self::Enum => "enum",
158 Self::Interface => "interface",
159 Self::Struct => "struct",
160 Self::TypeParameter => "typeParameter",
161 Self::Parameter => "parameter",
162 Self::Variable => "variable",
163 Self::Property => "property",
164 Self::EnumMember => "enumMember",
165 Self::Event => "event",
166 Self::Function => "function",
167 Self::Method => "method",
168 Self::Macro => "macro",
169 Self::Keyword => "keyword",
170 Self::Modifier => "modifier",
171 Self::Comment => "comment",
172 Self::String => "string",
173 Self::Number => "number",
174 Self::Regexp => "regexp",
175 Self::Operator => "operator",
176 Self::Decorator => "decorator",
177 Self::Label => "label",
178 Self::Custom(any) => any,
179 }
180 }
181}
182
183#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
189#[serde(into = "String", from = "String")]
190pub enum SemanticTokenModifiers {
191 Declaration,
192 Definition,
193 Readonly,
194 Static,
195 Deprecated,
196 Abstract,
197 Async,
198 Modification,
199 Documentation,
200 DefaultLibrary,
201 #[serde(untagged)]
203 Custom(Cow<'static, str>),
204}
205impl From<SemanticTokenModifiers> for String {
206 fn from(e: SemanticTokenModifiers) -> Self {
207 match e {
208 SemanticTokenModifiers::Declaration => "declaration".to_string(),
209 SemanticTokenModifiers::Definition => "definition".to_string(),
210 SemanticTokenModifiers::Readonly => "readonly".to_string(),
211 SemanticTokenModifiers::Static => "static".to_string(),
212 SemanticTokenModifiers::Deprecated => "deprecated".to_string(),
213 SemanticTokenModifiers::Abstract => "abstract".to_string(),
214 SemanticTokenModifiers::Async => "async".to_string(),
215 SemanticTokenModifiers::Modification => "modification".to_string(),
216 SemanticTokenModifiers::Documentation => "documentation".to_string(),
217 SemanticTokenModifiers::DefaultLibrary => "defaultLibrary".to_string(),
218 SemanticTokenModifiers::Custom(any) => any.into_owned(),
219 }
220 }
221}
222impl From<String> for SemanticTokenModifiers {
223 fn from(v: String) -> Self {
224 match v.as_str() {
225 "declaration" => Self::Declaration,
226 "definition" => Self::Definition,
227 "readonly" => Self::Readonly,
228 "static" => Self::Static,
229 "deprecated" => Self::Deprecated,
230 "abstract" => Self::Abstract,
231 "async" => Self::Async,
232 "modification" => Self::Modification,
233 "documentation" => Self::Documentation,
234 "defaultLibrary" => Self::DefaultLibrary,
235 _ => Self::Custom(Cow::Owned(v)),
236 }
237 }
238}
239impl SemanticTokenModifiers {
240 #[must_use]
242 pub const fn new(s: &'static str) -> Self {
243 Self::Custom(Cow::Borrowed(s))
244 }
245}
246impl From<&'static str> for SemanticTokenModifiers {
247 fn from(s: &'static str) -> Self {
248 match s {
249 "declaration" => Self::Declaration,
250 "definition" => Self::Definition,
251 "readonly" => Self::Readonly,
252 "static" => Self::Static,
253 "deprecated" => Self::Deprecated,
254 "abstract" => Self::Abstract,
255 "async" => Self::Async,
256 "modification" => Self::Modification,
257 "documentation" => Self::Documentation,
258 "defaultLibrary" => Self::DefaultLibrary,
259 _ => Self::Custom(Cow::Borrowed(s)),
260 }
261 }
262}
263impl fmt::Display for SemanticTokenModifiers {
264 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
265 let s: String = self.clone().into();
266 write!(f, "{s}")
267 }
268}
269impl SemanticTokenModifiers {
270 #[must_use]
271 pub fn as_str(&self) -> &str {
272 match self {
273 Self::Declaration => "declaration",
274 Self::Definition => "definition",
275 Self::Readonly => "readonly",
276 Self::Static => "static",
277 Self::Deprecated => "deprecated",
278 Self::Abstract => "abstract",
279 Self::Async => "async",
280 Self::Modification => "modification",
281 Self::Documentation => "documentation",
282 Self::DefaultLibrary => "defaultLibrary",
283 Self::Custom(any) => any,
284 }
285 }
286}
287
288#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
292#[serde(into = "String", from = "String")]
293pub enum DocumentDiagnosticReportKind {
294 Full,
297 Unchanged,
300 #[serde(untagged)]
302 Custom(Cow<'static, str>),
303}
304impl From<DocumentDiagnosticReportKind> for String {
305 fn from(e: DocumentDiagnosticReportKind) -> Self {
306 match e {
307 DocumentDiagnosticReportKind::Full => "full".to_string(),
308 DocumentDiagnosticReportKind::Unchanged => "unchanged".to_string(),
309 DocumentDiagnosticReportKind::Custom(any) => any.into_owned(),
310 }
311 }
312}
313impl From<String> for DocumentDiagnosticReportKind {
314 fn from(v: String) -> Self {
315 match v.as_str() {
316 "full" => Self::Full,
317 "unchanged" => Self::Unchanged,
318 _ => Self::Custom(Cow::Owned(v)),
319 }
320 }
321}
322impl DocumentDiagnosticReportKind {
323 #[must_use]
325 pub const fn new(s: &'static str) -> Self {
326 Self::Custom(Cow::Borrowed(s))
327 }
328}
329impl From<&'static str> for DocumentDiagnosticReportKind {
330 fn from(s: &'static str) -> Self {
331 match s {
332 "full" => Self::Full,
333 "unchanged" => Self::Unchanged,
334 _ => Self::Custom(Cow::Borrowed(s)),
335 }
336 }
337}
338impl fmt::Display for DocumentDiagnosticReportKind {
339 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
340 let s: String = self.clone().into();
341 write!(f, "{s}")
342 }
343}
344impl DocumentDiagnosticReportKind {
345 #[must_use]
346 pub fn as_str(&self) -> &str {
347 match self {
348 Self::Full => "full",
349 Self::Unchanged => "unchanged",
350 Self::Custom(any) => any,
351 }
352 }
353}
354
355#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
357#[serde(into = "i32", from = "i32")]
358pub enum ErrorCodes {
359 ParseError,
360 InvalidRequest,
361 MethodNotFound,
362 InvalidParams,
363 InternalError,
364 ServerNotInitialized,
367 UnknownErrorCode,
368 #[serde(untagged)]
370 Custom(i32),
371}
372impl From<ErrorCodes> for i32 {
373 fn from(e: ErrorCodes) -> Self {
374 match e {
375 ErrorCodes::ParseError => -32700i32,
376 ErrorCodes::InvalidRequest => -32600i32,
377 ErrorCodes::MethodNotFound => -32601i32,
378 ErrorCodes::InvalidParams => -32602i32,
379 ErrorCodes::InternalError => -32603i32,
380 ErrorCodes::ServerNotInitialized => -32002i32,
381 ErrorCodes::UnknownErrorCode => -32001i32,
382 ErrorCodes::Custom(any) => any,
383 }
384 }
385}
386impl From<i32> for ErrorCodes {
387 fn from(v: i32) -> Self {
388 match v {
389 -32700i32 => Self::ParseError,
390 -32600i32 => Self::InvalidRequest,
391 -32601i32 => Self::MethodNotFound,
392 -32602i32 => Self::InvalidParams,
393 -32603i32 => Self::InternalError,
394 -32002i32 => Self::ServerNotInitialized,
395 -32001i32 => Self::UnknownErrorCode,
396 _ => Self::Custom(v),
397 }
398 }
399}
400
401#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
402#[serde(into = "i32", from = "i32")]
403pub enum LspErrorCodes {
404 RequestFailed,
411 ServerCancelled,
417 ContentModified,
426 RequestCancelled,
429 #[serde(untagged)]
431 Custom(i32),
432}
433impl From<LspErrorCodes> for i32 {
434 fn from(e: LspErrorCodes) -> Self {
435 match e {
436 LspErrorCodes::RequestFailed => -32803i32,
437 LspErrorCodes::ServerCancelled => -32802i32,
438 LspErrorCodes::ContentModified => -32801i32,
439 LspErrorCodes::RequestCancelled => -32800i32,
440 LspErrorCodes::Custom(any) => any,
441 }
442 }
443}
444impl From<i32> for LspErrorCodes {
445 fn from(v: i32) -> Self {
446 match v {
447 -32803i32 => Self::RequestFailed,
448 -32802i32 => Self::ServerCancelled,
449 -32801i32 => Self::ContentModified,
450 -32800i32 => Self::RequestCancelled,
451 _ => Self::Custom(v),
452 }
453 }
454}
455
456#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
458#[serde(into = "String", from = "String")]
459pub enum FoldingRangeKind {
460 Comment,
462 Imports,
464 Region,
466 #[serde(untagged)]
468 Custom(Cow<'static, str>),
469}
470impl From<FoldingRangeKind> for String {
471 fn from(e: FoldingRangeKind) -> Self {
472 match e {
473 FoldingRangeKind::Comment => "comment".to_string(),
474 FoldingRangeKind::Imports => "imports".to_string(),
475 FoldingRangeKind::Region => "region".to_string(),
476 FoldingRangeKind::Custom(any) => any.into_owned(),
477 }
478 }
479}
480impl From<String> for FoldingRangeKind {
481 fn from(v: String) -> Self {
482 match v.as_str() {
483 "comment" => Self::Comment,
484 "imports" => Self::Imports,
485 "region" => Self::Region,
486 _ => Self::Custom(Cow::Owned(v)),
487 }
488 }
489}
490impl FoldingRangeKind {
491 #[must_use]
493 pub const fn new(s: &'static str) -> Self {
494 Self::Custom(Cow::Borrowed(s))
495 }
496}
497impl From<&'static str> for FoldingRangeKind {
498 fn from(s: &'static str) -> Self {
499 match s {
500 "comment" => Self::Comment,
501 "imports" => Self::Imports,
502 "region" => Self::Region,
503 _ => Self::Custom(Cow::Borrowed(s)),
504 }
505 }
506}
507impl fmt::Display for FoldingRangeKind {
508 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
509 let s: String = self.clone().into();
510 write!(f, "{s}")
511 }
512}
513impl FoldingRangeKind {
514 #[must_use]
515 pub fn as_str(&self) -> &str {
516 match self {
517 Self::Comment => "comment",
518 Self::Imports => "imports",
519 Self::Region => "region",
520 Self::Custom(any) => any,
521 }
522 }
523}
524
525#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
527#[serde(into = "u32", from = "u32")]
528pub enum SymbolKind {
529 File,
530 Module,
531 Namespace,
532 Package,
533 Class,
534 Method,
535 Property,
536 Field,
537 Constructor,
538 Enum,
539 Interface,
540 Function,
541 Variable,
542 Constant,
543 String,
544 Number,
545 Boolean,
546 Array,
547 Object,
548 Key,
549 Null,
550 EnumMember,
551 Struct,
552 Event,
553 Operator,
554 TypeParameter,
555 #[serde(untagged)]
557 Custom(u32),
558}
559impl From<SymbolKind> for u32 {
560 fn from(e: SymbolKind) -> Self {
561 match e {
562 SymbolKind::File => 1u32,
563 SymbolKind::Module => 2u32,
564 SymbolKind::Namespace => 3u32,
565 SymbolKind::Package => 4u32,
566 SymbolKind::Class => 5u32,
567 SymbolKind::Method => 6u32,
568 SymbolKind::Property => 7u32,
569 SymbolKind::Field => 8u32,
570 SymbolKind::Constructor => 9u32,
571 SymbolKind::Enum => 10u32,
572 SymbolKind::Interface => 11u32,
573 SymbolKind::Function => 12u32,
574 SymbolKind::Variable => 13u32,
575 SymbolKind::Constant => 14u32,
576 SymbolKind::String => 15u32,
577 SymbolKind::Number => 16u32,
578 SymbolKind::Boolean => 17u32,
579 SymbolKind::Array => 18u32,
580 SymbolKind::Object => 19u32,
581 SymbolKind::Key => 20u32,
582 SymbolKind::Null => 21u32,
583 SymbolKind::EnumMember => 22u32,
584 SymbolKind::Struct => 23u32,
585 SymbolKind::Event => 24u32,
586 SymbolKind::Operator => 25u32,
587 SymbolKind::TypeParameter => 26u32,
588 SymbolKind::Custom(any) => any,
589 }
590 }
591}
592impl From<u32> for SymbolKind {
593 fn from(v: u32) -> Self {
594 match v {
595 1u32 => Self::File,
596 2u32 => Self::Module,
597 3u32 => Self::Namespace,
598 4u32 => Self::Package,
599 5u32 => Self::Class,
600 6u32 => Self::Method,
601 7u32 => Self::Property,
602 8u32 => Self::Field,
603 9u32 => Self::Constructor,
604 10u32 => Self::Enum,
605 11u32 => Self::Interface,
606 12u32 => Self::Function,
607 13u32 => Self::Variable,
608 14u32 => Self::Constant,
609 15u32 => Self::String,
610 16u32 => Self::Number,
611 17u32 => Self::Boolean,
612 18u32 => Self::Array,
613 19u32 => Self::Object,
614 20u32 => Self::Key,
615 21u32 => Self::Null,
616 22u32 => Self::EnumMember,
617 23u32 => Self::Struct,
618 24u32 => Self::Event,
619 25u32 => Self::Operator,
620 26u32 => Self::TypeParameter,
621 _ => Self::Custom(v),
622 }
623 }
624}
625
626#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
630#[serde(into = "u32", from = "u32")]
631pub enum SymbolTag {
632 Deprecated,
634 #[serde(untagged)]
636 Custom(u32),
637}
638impl From<SymbolTag> for u32 {
639 fn from(e: SymbolTag) -> Self {
640 match e {
641 SymbolTag::Deprecated => 1u32,
642 SymbolTag::Custom(any) => any,
643 }
644 }
645}
646impl From<u32> for SymbolTag {
647 fn from(v: u32) -> Self {
648 match v {
649 1u32 => Self::Deprecated,
650 _ => Self::Custom(v),
651 }
652 }
653}
654
655#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
659#[serde(into = "String", from = "String")]
660pub enum UniquenessLevel {
661 Document,
663 Project,
665 Group,
667 Scheme,
669 Global,
671 #[serde(untagged)]
673 Custom(Cow<'static, str>),
674}
675impl From<UniquenessLevel> for String {
676 fn from(e: UniquenessLevel) -> Self {
677 match e {
678 UniquenessLevel::Document => "document".to_string(),
679 UniquenessLevel::Project => "project".to_string(),
680 UniquenessLevel::Group => "group".to_string(),
681 UniquenessLevel::Scheme => "scheme".to_string(),
682 UniquenessLevel::Global => "global".to_string(),
683 UniquenessLevel::Custom(any) => any.into_owned(),
684 }
685 }
686}
687impl From<String> for UniquenessLevel {
688 fn from(v: String) -> Self {
689 match v.as_str() {
690 "document" => Self::Document,
691 "project" => Self::Project,
692 "group" => Self::Group,
693 "scheme" => Self::Scheme,
694 "global" => Self::Global,
695 _ => Self::Custom(Cow::Owned(v)),
696 }
697 }
698}
699impl UniquenessLevel {
700 #[must_use]
702 pub const fn new(s: &'static str) -> Self {
703 Self::Custom(Cow::Borrowed(s))
704 }
705}
706impl From<&'static str> for UniquenessLevel {
707 fn from(s: &'static str) -> Self {
708 match s {
709 "document" => Self::Document,
710 "project" => Self::Project,
711 "group" => Self::Group,
712 "scheme" => Self::Scheme,
713 "global" => Self::Global,
714 _ => Self::Custom(Cow::Borrowed(s)),
715 }
716 }
717}
718impl fmt::Display for UniquenessLevel {
719 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
720 let s: String = self.clone().into();
721 write!(f, "{s}")
722 }
723}
724impl UniquenessLevel {
725 #[must_use]
726 pub fn as_str(&self) -> &str {
727 match self {
728 Self::Document => "document",
729 Self::Project => "project",
730 Self::Group => "group",
731 Self::Scheme => "scheme",
732 Self::Global => "global",
733 Self::Custom(any) => any,
734 }
735 }
736}
737
738#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
742#[serde(into = "String", from = "String")]
743pub enum MonikerKind {
744 Import,
746 Export,
748 Local,
751 #[serde(untagged)]
753 Custom(Cow<'static, str>),
754}
755impl From<MonikerKind> for String {
756 fn from(e: MonikerKind) -> Self {
757 match e {
758 MonikerKind::Import => "import".to_string(),
759 MonikerKind::Export => "export".to_string(),
760 MonikerKind::Local => "local".to_string(),
761 MonikerKind::Custom(any) => any.into_owned(),
762 }
763 }
764}
765impl From<String> for MonikerKind {
766 fn from(v: String) -> Self {
767 match v.as_str() {
768 "import" => Self::Import,
769 "export" => Self::Export,
770 "local" => Self::Local,
771 _ => Self::Custom(Cow::Owned(v)),
772 }
773 }
774}
775impl MonikerKind {
776 #[must_use]
778 pub const fn new(s: &'static str) -> Self {
779 Self::Custom(Cow::Borrowed(s))
780 }
781}
782impl From<&'static str> for MonikerKind {
783 fn from(s: &'static str) -> Self {
784 match s {
785 "import" => Self::Import,
786 "export" => Self::Export,
787 "local" => Self::Local,
788 _ => Self::Custom(Cow::Borrowed(s)),
789 }
790 }
791}
792impl fmt::Display for MonikerKind {
793 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
794 let s: String = self.clone().into();
795 write!(f, "{s}")
796 }
797}
798impl MonikerKind {
799 #[must_use]
800 pub fn as_str(&self) -> &str {
801 match self {
802 Self::Import => "import",
803 Self::Export => "export",
804 Self::Local => "local",
805 Self::Custom(any) => any,
806 }
807 }
808}
809
810#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
814#[serde(into = "u32", from = "u32")]
815pub enum InlayHintKind {
816 Type,
818 Parameter,
820 #[serde(untagged)]
822 Custom(u32),
823}
824impl From<InlayHintKind> for u32 {
825 fn from(e: InlayHintKind) -> Self {
826 match e {
827 InlayHintKind::Type => 1u32,
828 InlayHintKind::Parameter => 2u32,
829 InlayHintKind::Custom(any) => any,
830 }
831 }
832}
833impl From<u32> for InlayHintKind {
834 fn from(v: u32) -> Self {
835 match v {
836 1u32 => Self::Type,
837 2u32 => Self::Parameter,
838 _ => Self::Custom(v),
839 }
840 }
841}
842
843#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
845#[serde(into = "u32", from = "u32")]
846pub enum MessageType {
847 Error,
849 Warning,
851 Info,
853 Log,
855 Debug,
859 #[serde(untagged)]
861 Custom(u32),
862}
863impl From<MessageType> for u32 {
864 fn from(e: MessageType) -> Self {
865 match e {
866 MessageType::Error => 1u32,
867 MessageType::Warning => 2u32,
868 MessageType::Info => 3u32,
869 MessageType::Log => 4u32,
870 MessageType::Debug => 5u32,
871 MessageType::Custom(any) => any,
872 }
873 }
874}
875impl From<u32> for MessageType {
876 fn from(v: u32) -> Self {
877 match v {
878 1u32 => Self::Error,
879 2u32 => Self::Warning,
880 3u32 => Self::Info,
881 4u32 => Self::Log,
882 5u32 => Self::Debug,
883 _ => Self::Custom(v),
884 }
885 }
886}
887
888#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
891#[serde(into = "u32", from = "u32")]
892pub enum TextDocumentSyncKind {
893 None,
895 Full,
898 Incremental,
902 #[serde(untagged)]
904 Custom(u32),
905}
906impl From<TextDocumentSyncKind> for u32 {
907 fn from(e: TextDocumentSyncKind) -> Self {
908 match e {
909 TextDocumentSyncKind::None => 0u32,
910 TextDocumentSyncKind::Full => 1u32,
911 TextDocumentSyncKind::Incremental => 2u32,
912 TextDocumentSyncKind::Custom(any) => any,
913 }
914 }
915}
916impl From<u32> for TextDocumentSyncKind {
917 fn from(v: u32) -> Self {
918 match v {
919 0u32 => Self::None,
920 1u32 => Self::Full,
921 2u32 => Self::Incremental,
922 _ => Self::Custom(v),
923 }
924 }
925}
926
927#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
929#[serde(into = "u32", from = "u32")]
930pub enum TextDocumentSaveReason {
931 Manual,
934 AfterDelay,
936 FocusOut,
938 #[serde(untagged)]
940 Custom(u32),
941}
942impl From<TextDocumentSaveReason> for u32 {
943 fn from(e: TextDocumentSaveReason) -> Self {
944 match e {
945 TextDocumentSaveReason::Manual => 1u32,
946 TextDocumentSaveReason::AfterDelay => 2u32,
947 TextDocumentSaveReason::FocusOut => 3u32,
948 TextDocumentSaveReason::Custom(any) => any,
949 }
950 }
951}
952impl From<u32> for TextDocumentSaveReason {
953 fn from(v: u32) -> Self {
954 match v {
955 1u32 => Self::Manual,
956 2u32 => Self::AfterDelay,
957 3u32 => Self::FocusOut,
958 _ => Self::Custom(v),
959 }
960 }
961}
962
963#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
965#[serde(into = "u32", from = "u32")]
966pub enum CompletionItemKind {
967 Text,
968 Method,
969 Function,
970 Constructor,
971 Field,
972 Variable,
973 Class,
974 Interface,
975 Module,
976 Property,
977 Unit,
978 Value,
979 Enum,
980 Keyword,
981 Snippet,
982 Color,
983 File,
984 Reference,
985 Folder,
986 EnumMember,
987 Constant,
988 Struct,
989 Event,
990 Operator,
991 TypeParameter,
992 #[serde(untagged)]
994 Custom(u32),
995}
996impl From<CompletionItemKind> for u32 {
997 fn from(e: CompletionItemKind) -> Self {
998 match e {
999 CompletionItemKind::Text => 1u32,
1000 CompletionItemKind::Method => 2u32,
1001 CompletionItemKind::Function => 3u32,
1002 CompletionItemKind::Constructor => 4u32,
1003 CompletionItemKind::Field => 5u32,
1004 CompletionItemKind::Variable => 6u32,
1005 CompletionItemKind::Class => 7u32,
1006 CompletionItemKind::Interface => 8u32,
1007 CompletionItemKind::Module => 9u32,
1008 CompletionItemKind::Property => 10u32,
1009 CompletionItemKind::Unit => 11u32,
1010 CompletionItemKind::Value => 12u32,
1011 CompletionItemKind::Enum => 13u32,
1012 CompletionItemKind::Keyword => 14u32,
1013 CompletionItemKind::Snippet => 15u32,
1014 CompletionItemKind::Color => 16u32,
1015 CompletionItemKind::File => 17u32,
1016 CompletionItemKind::Reference => 18u32,
1017 CompletionItemKind::Folder => 19u32,
1018 CompletionItemKind::EnumMember => 20u32,
1019 CompletionItemKind::Constant => 21u32,
1020 CompletionItemKind::Struct => 22u32,
1021 CompletionItemKind::Event => 23u32,
1022 CompletionItemKind::Operator => 24u32,
1023 CompletionItemKind::TypeParameter => 25u32,
1024 CompletionItemKind::Custom(any) => any,
1025 }
1026 }
1027}
1028impl From<u32> for CompletionItemKind {
1029 fn from(v: u32) -> Self {
1030 match v {
1031 1u32 => Self::Text,
1032 2u32 => Self::Method,
1033 3u32 => Self::Function,
1034 4u32 => Self::Constructor,
1035 5u32 => Self::Field,
1036 6u32 => Self::Variable,
1037 7u32 => Self::Class,
1038 8u32 => Self::Interface,
1039 9u32 => Self::Module,
1040 10u32 => Self::Property,
1041 11u32 => Self::Unit,
1042 12u32 => Self::Value,
1043 13u32 => Self::Enum,
1044 14u32 => Self::Keyword,
1045 15u32 => Self::Snippet,
1046 16u32 => Self::Color,
1047 17u32 => Self::File,
1048 18u32 => Self::Reference,
1049 19u32 => Self::Folder,
1050 20u32 => Self::EnumMember,
1051 21u32 => Self::Constant,
1052 22u32 => Self::Struct,
1053 23u32 => Self::Event,
1054 24u32 => Self::Operator,
1055 25u32 => Self::TypeParameter,
1056 _ => Self::Custom(v),
1057 }
1058 }
1059}
1060
1061#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
1066#[serde(into = "u32", from = "u32")]
1067pub enum CompletionItemTag {
1068 Deprecated,
1070 #[serde(untagged)]
1072 Custom(u32),
1073}
1074impl From<CompletionItemTag> for u32 {
1075 fn from(e: CompletionItemTag) -> Self {
1076 match e {
1077 CompletionItemTag::Deprecated => 1u32,
1078 CompletionItemTag::Custom(any) => any,
1079 }
1080 }
1081}
1082impl From<u32> for CompletionItemTag {
1083 fn from(v: u32) -> Self {
1084 match v {
1085 1u32 => Self::Deprecated,
1086 _ => Self::Custom(v),
1087 }
1088 }
1089}
1090
1091#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
1094#[serde(into = "u32", from = "u32")]
1095pub enum InsertTextFormat {
1096 PlainText,
1098 Snippet,
1107 #[serde(untagged)]
1109 Custom(u32),
1110}
1111impl From<InsertTextFormat> for u32 {
1112 fn from(e: InsertTextFormat) -> Self {
1113 match e {
1114 InsertTextFormat::PlainText => 1u32,
1115 InsertTextFormat::Snippet => 2u32,
1116 InsertTextFormat::Custom(any) => any,
1117 }
1118 }
1119}
1120impl From<u32> for InsertTextFormat {
1121 fn from(v: u32) -> Self {
1122 match v {
1123 1u32 => Self::PlainText,
1124 2u32 => Self::Snippet,
1125 _ => Self::Custom(v),
1126 }
1127 }
1128}
1129
1130#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
1135#[serde(into = "u32", from = "u32")]
1136pub enum InsertTextMode {
1137 AsIs,
1143 AdjustIndentation,
1151 #[serde(untagged)]
1153 Custom(u32),
1154}
1155impl From<InsertTextMode> for u32 {
1156 fn from(e: InsertTextMode) -> Self {
1157 match e {
1158 InsertTextMode::AsIs => 1u32,
1159 InsertTextMode::AdjustIndentation => 2u32,
1160 InsertTextMode::Custom(any) => any,
1161 }
1162 }
1163}
1164impl From<u32> for InsertTextMode {
1165 fn from(v: u32) -> Self {
1166 match v {
1167 1u32 => Self::AsIs,
1168 2u32 => Self::AdjustIndentation,
1169 _ => Self::Custom(v),
1170 }
1171 }
1172}
1173
1174#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
1176#[serde(into = "u32", from = "u32")]
1177pub enum DocumentHighlightKind {
1178 Text,
1180 Read,
1182 Write,
1184 #[serde(untagged)]
1186 Custom(u32),
1187}
1188impl From<DocumentHighlightKind> for u32 {
1189 fn from(e: DocumentHighlightKind) -> Self {
1190 match e {
1191 DocumentHighlightKind::Text => 1u32,
1192 DocumentHighlightKind::Read => 2u32,
1193 DocumentHighlightKind::Write => 3u32,
1194 DocumentHighlightKind::Custom(any) => any,
1195 }
1196 }
1197}
1198impl From<u32> for DocumentHighlightKind {
1199 fn from(v: u32) -> Self {
1200 match v {
1201 1u32 => Self::Text,
1202 2u32 => Self::Read,
1203 3u32 => Self::Write,
1204 _ => Self::Custom(v),
1205 }
1206 }
1207}
1208
1209#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
1211#[serde(into = "String", from = "String")]
1212pub enum CodeActionKind {
1213 Empty,
1215 QuickFix,
1217 Refactor,
1219 RefactorExtract,
1229 RefactorInline,
1238 RefactorMove,
1249 RefactorRewrite,
1260 Source,
1264 SourceOrganizeImports,
1266 SourceFixAll,
1273 Notebook,
1278 #[serde(untagged)]
1280 Custom(Cow<'static, str>),
1281}
1282impl From<CodeActionKind> for String {
1283 fn from(e: CodeActionKind) -> Self {
1284 match e {
1285 CodeActionKind::Empty => "".to_string(),
1286 CodeActionKind::QuickFix => "quickfix".to_string(),
1287 CodeActionKind::Refactor => "refactor".to_string(),
1288 CodeActionKind::RefactorExtract => "refactor.extract".to_string(),
1289 CodeActionKind::RefactorInline => "refactor.inline".to_string(),
1290 CodeActionKind::RefactorMove => "refactor.move".to_string(),
1291 CodeActionKind::RefactorRewrite => "refactor.rewrite".to_string(),
1292 CodeActionKind::Source => "source".to_string(),
1293 CodeActionKind::SourceOrganizeImports => "source.organizeImports".to_string(),
1294 CodeActionKind::SourceFixAll => "source.fixAll".to_string(),
1295 CodeActionKind::Notebook => "notebook".to_string(),
1296 CodeActionKind::Custom(any) => any.into_owned(),
1297 }
1298 }
1299}
1300impl From<String> for CodeActionKind {
1301 fn from(v: String) -> Self {
1302 match v.as_str() {
1303 "" => Self::Empty,
1304 "quickfix" => Self::QuickFix,
1305 "refactor" => Self::Refactor,
1306 "refactor.extract" => Self::RefactorExtract,
1307 "refactor.inline" => Self::RefactorInline,
1308 "refactor.move" => Self::RefactorMove,
1309 "refactor.rewrite" => Self::RefactorRewrite,
1310 "source" => Self::Source,
1311 "source.organizeImports" => Self::SourceOrganizeImports,
1312 "source.fixAll" => Self::SourceFixAll,
1313 "notebook" => Self::Notebook,
1314 _ => Self::Custom(Cow::Owned(v)),
1315 }
1316 }
1317}
1318impl CodeActionKind {
1319 #[must_use]
1321 pub const fn new(s: &'static str) -> Self {
1322 Self::Custom(Cow::Borrowed(s))
1323 }
1324}
1325impl From<&'static str> for CodeActionKind {
1326 fn from(s: &'static str) -> Self {
1327 match s {
1328 "" => Self::Empty,
1329 "quickfix" => Self::QuickFix,
1330 "refactor" => Self::Refactor,
1331 "refactor.extract" => Self::RefactorExtract,
1332 "refactor.inline" => Self::RefactorInline,
1333 "refactor.move" => Self::RefactorMove,
1334 "refactor.rewrite" => Self::RefactorRewrite,
1335 "source" => Self::Source,
1336 "source.organizeImports" => Self::SourceOrganizeImports,
1337 "source.fixAll" => Self::SourceFixAll,
1338 "notebook" => Self::Notebook,
1339 _ => Self::Custom(Cow::Borrowed(s)),
1340 }
1341 }
1342}
1343impl fmt::Display for CodeActionKind {
1344 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1345 let s: String = self.clone().into();
1346 write!(f, "{s}")
1347 }
1348}
1349impl CodeActionKind {
1350 #[must_use]
1351 pub fn as_str(&self) -> &str {
1352 match self {
1353 Self::Empty => "",
1354 Self::QuickFix => "quickfix",
1355 Self::Refactor => "refactor",
1356 Self::RefactorExtract => "refactor.extract",
1357 Self::RefactorInline => "refactor.inline",
1358 Self::RefactorMove => "refactor.move",
1359 Self::RefactorRewrite => "refactor.rewrite",
1360 Self::Source => "source",
1361 Self::SourceOrganizeImports => "source.organizeImports",
1362 Self::SourceFixAll => "source.fixAll",
1363 Self::Notebook => "notebook",
1364 Self::Custom(any) => any,
1365 }
1366 }
1367}
1368
1369#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
1373#[serde(into = "u32", from = "u32")]
1374pub enum CodeActionTag {
1375 LLMGenerated,
1377 #[serde(untagged)]
1379 Custom(u32),
1380}
1381impl From<CodeActionTag> for u32 {
1382 fn from(e: CodeActionTag) -> Self {
1383 match e {
1384 CodeActionTag::LLMGenerated => 1u32,
1385 CodeActionTag::Custom(any) => any,
1386 }
1387 }
1388}
1389impl From<u32> for CodeActionTag {
1390 fn from(v: u32) -> Self {
1391 match v {
1392 1u32 => Self::LLMGenerated,
1393 _ => Self::Custom(v),
1394 }
1395 }
1396}
1397
1398#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
1399#[serde(into = "String", from = "String")]
1400pub enum TraceValue {
1401 Off,
1403 Messages,
1405 Verbose,
1407 #[serde(untagged)]
1409 Custom(Cow<'static, str>),
1410}
1411impl From<TraceValue> for String {
1412 fn from(e: TraceValue) -> Self {
1413 match e {
1414 TraceValue::Off => "off".to_string(),
1415 TraceValue::Messages => "messages".to_string(),
1416 TraceValue::Verbose => "verbose".to_string(),
1417 TraceValue::Custom(any) => any.into_owned(),
1418 }
1419 }
1420}
1421impl From<String> for TraceValue {
1422 fn from(v: String) -> Self {
1423 match v.as_str() {
1424 "off" => Self::Off,
1425 "messages" => Self::Messages,
1426 "verbose" => Self::Verbose,
1427 _ => Self::Custom(Cow::Owned(v)),
1428 }
1429 }
1430}
1431impl TraceValue {
1432 #[must_use]
1434 pub const fn new(s: &'static str) -> Self {
1435 Self::Custom(Cow::Borrowed(s))
1436 }
1437}
1438impl From<&'static str> for TraceValue {
1439 fn from(s: &'static str) -> Self {
1440 match s {
1441 "off" => Self::Off,
1442 "messages" => Self::Messages,
1443 "verbose" => Self::Verbose,
1444 _ => Self::Custom(Cow::Borrowed(s)),
1445 }
1446 }
1447}
1448impl fmt::Display for TraceValue {
1449 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1450 let s: String = self.clone().into();
1451 write!(f, "{s}")
1452 }
1453}
1454impl TraceValue {
1455 #[must_use]
1456 pub fn as_str(&self) -> &str {
1457 match self {
1458 Self::Off => "off",
1459 Self::Messages => "messages",
1460 Self::Verbose => "verbose",
1461 Self::Custom(any) => any,
1462 }
1463 }
1464}
1465
1466#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
1472#[serde(into = "String", from = "String")]
1473pub enum MarkupKind {
1474 PlainText,
1476 Markdown,
1478 #[serde(untagged)]
1480 Custom(Cow<'static, str>),
1481}
1482impl From<MarkupKind> for String {
1483 fn from(e: MarkupKind) -> Self {
1484 match e {
1485 MarkupKind::PlainText => "plaintext".to_string(),
1486 MarkupKind::Markdown => "markdown".to_string(),
1487 MarkupKind::Custom(any) => any.into_owned(),
1488 }
1489 }
1490}
1491impl From<String> for MarkupKind {
1492 fn from(v: String) -> Self {
1493 match v.as_str() {
1494 "plaintext" => Self::PlainText,
1495 "markdown" => Self::Markdown,
1496 _ => Self::Custom(Cow::Owned(v)),
1497 }
1498 }
1499}
1500impl MarkupKind {
1501 #[must_use]
1503 pub const fn new(s: &'static str) -> Self {
1504 Self::Custom(Cow::Borrowed(s))
1505 }
1506}
1507impl From<&'static str> for MarkupKind {
1508 fn from(s: &'static str) -> Self {
1509 match s {
1510 "plaintext" => Self::PlainText,
1511 "markdown" => Self::Markdown,
1512 _ => Self::Custom(Cow::Borrowed(s)),
1513 }
1514 }
1515}
1516impl fmt::Display for MarkupKind {
1517 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1518 let s: String = self.clone().into();
1519 write!(f, "{s}")
1520 }
1521}
1522impl MarkupKind {
1523 #[must_use]
1524 pub fn as_str(&self) -> &str {
1525 match self {
1526 Self::PlainText => "plaintext",
1527 Self::Markdown => "markdown",
1528 Self::Custom(any) => any,
1529 }
1530 }
1531}
1532
1533#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
1536#[serde(into = "String", from = "String")]
1537pub enum LanguageKind {
1538 ABAP,
1539 WindowsBat,
1540 BibTeX,
1541 Clojure,
1542 Coffeescript,
1543 C,
1544 CPP,
1545 CSharp,
1546 CSS,
1547 D,
1549 Delphi,
1551 Diff,
1552 Dart,
1553 Dockerfile,
1554 Elixir,
1555 Erlang,
1556 FSharp,
1557 GitCommit,
1558 GitRebase,
1559 Go,
1560 Groovy,
1561 Handlebars,
1562 Haskell,
1563 HTML,
1564 Ini,
1565 Java,
1566 JavaScript,
1567 JavaScriptReact,
1568 JSON,
1569 LaTeX,
1570 Less,
1571 Lua,
1572 Makefile,
1573 Markdown,
1574 ObjectiveC,
1575 ObjectiveCPP,
1576 Pascal,
1578 Perl,
1579 Perl6,
1580 PHP,
1581 Plaintext,
1582 Powershell,
1583 Pug,
1584 Python,
1585 R,
1586 Razor,
1587 Ruby,
1588 Rust,
1589 SCSS,
1590 SASS,
1591 Scala,
1592 ShaderLab,
1593 ShellScript,
1594 SQL,
1595 Swift,
1596 TypeScript,
1597 TypeScriptReact,
1598 TeX,
1599 VisualBasic,
1600 XML,
1601 XSL,
1602 YAML,
1603 #[serde(untagged)]
1605 Custom(Cow<'static, str>),
1606}
1607impl From<LanguageKind> for String {
1608 fn from(e: LanguageKind) -> Self {
1609 match e {
1610 LanguageKind::ABAP => "abap".to_string(),
1611 LanguageKind::WindowsBat => "bat".to_string(),
1612 LanguageKind::BibTeX => "bibtex".to_string(),
1613 LanguageKind::Clojure => "clojure".to_string(),
1614 LanguageKind::Coffeescript => "coffeescript".to_string(),
1615 LanguageKind::C => "c".to_string(),
1616 LanguageKind::CPP => "cpp".to_string(),
1617 LanguageKind::CSharp => "csharp".to_string(),
1618 LanguageKind::CSS => "css".to_string(),
1619 LanguageKind::D => "d".to_string(),
1620 LanguageKind::Delphi => "pascal".to_string(),
1621 LanguageKind::Diff => "diff".to_string(),
1622 LanguageKind::Dart => "dart".to_string(),
1623 LanguageKind::Dockerfile => "dockerfile".to_string(),
1624 LanguageKind::Elixir => "elixir".to_string(),
1625 LanguageKind::Erlang => "erlang".to_string(),
1626 LanguageKind::FSharp => "fsharp".to_string(),
1627 LanguageKind::GitCommit => "git-commit".to_string(),
1628 LanguageKind::GitRebase => "git-rebase".to_string(),
1629 LanguageKind::Go => "go".to_string(),
1630 LanguageKind::Groovy => "groovy".to_string(),
1631 LanguageKind::Handlebars => "handlebars".to_string(),
1632 LanguageKind::Haskell => "haskell".to_string(),
1633 LanguageKind::HTML => "html".to_string(),
1634 LanguageKind::Ini => "ini".to_string(),
1635 LanguageKind::Java => "java".to_string(),
1636 LanguageKind::JavaScript => "javascript".to_string(),
1637 LanguageKind::JavaScriptReact => "javascriptreact".to_string(),
1638 LanguageKind::JSON => "json".to_string(),
1639 LanguageKind::LaTeX => "latex".to_string(),
1640 LanguageKind::Less => "less".to_string(),
1641 LanguageKind::Lua => "lua".to_string(),
1642 LanguageKind::Makefile => "makefile".to_string(),
1643 LanguageKind::Markdown => "markdown".to_string(),
1644 LanguageKind::ObjectiveC => "objective-c".to_string(),
1645 LanguageKind::ObjectiveCPP => "objective-cpp".to_string(),
1646 LanguageKind::Pascal => "pascal".to_string(),
1647 LanguageKind::Perl => "perl".to_string(),
1648 LanguageKind::Perl6 => "perl6".to_string(),
1649 LanguageKind::PHP => "php".to_string(),
1650 LanguageKind::Plaintext => "plaintext".to_string(),
1651 LanguageKind::Powershell => "powershell".to_string(),
1652 LanguageKind::Pug => "jade".to_string(),
1653 LanguageKind::Python => "python".to_string(),
1654 LanguageKind::R => "r".to_string(),
1655 LanguageKind::Razor => "razor".to_string(),
1656 LanguageKind::Ruby => "ruby".to_string(),
1657 LanguageKind::Rust => "rust".to_string(),
1658 LanguageKind::SCSS => "scss".to_string(),
1659 LanguageKind::SASS => "sass".to_string(),
1660 LanguageKind::Scala => "scala".to_string(),
1661 LanguageKind::ShaderLab => "shaderlab".to_string(),
1662 LanguageKind::ShellScript => "shellscript".to_string(),
1663 LanguageKind::SQL => "sql".to_string(),
1664 LanguageKind::Swift => "swift".to_string(),
1665 LanguageKind::TypeScript => "typescript".to_string(),
1666 LanguageKind::TypeScriptReact => "typescriptreact".to_string(),
1667 LanguageKind::TeX => "tex".to_string(),
1668 LanguageKind::VisualBasic => "vb".to_string(),
1669 LanguageKind::XML => "xml".to_string(),
1670 LanguageKind::XSL => "xsl".to_string(),
1671 LanguageKind::YAML => "yaml".to_string(),
1672 LanguageKind::Custom(any) => any.into_owned(),
1673 }
1674 }
1675}
1676impl From<String> for LanguageKind {
1677 fn from(v: String) -> Self {
1678 match v.as_str() {
1679 "abap" => Self::ABAP,
1680 "bat" => Self::WindowsBat,
1681 "bibtex" => Self::BibTeX,
1682 "clojure" => Self::Clojure,
1683 "coffeescript" => Self::Coffeescript,
1684 "c" => Self::C,
1685 "cpp" => Self::CPP,
1686 "csharp" => Self::CSharp,
1687 "css" => Self::CSS,
1688 "d" => Self::D,
1689 "pascal" => Self::Delphi,
1690 "diff" => Self::Diff,
1691 "dart" => Self::Dart,
1692 "dockerfile" => Self::Dockerfile,
1693 "elixir" => Self::Elixir,
1694 "erlang" => Self::Erlang,
1695 "fsharp" => Self::FSharp,
1696 "git-commit" => Self::GitCommit,
1697 "git-rebase" => Self::GitRebase,
1698 "go" => Self::Go,
1699 "groovy" => Self::Groovy,
1700 "handlebars" => Self::Handlebars,
1701 "haskell" => Self::Haskell,
1702 "html" => Self::HTML,
1703 "ini" => Self::Ini,
1704 "java" => Self::Java,
1705 "javascript" => Self::JavaScript,
1706 "javascriptreact" => Self::JavaScriptReact,
1707 "json" => Self::JSON,
1708 "latex" => Self::LaTeX,
1709 "less" => Self::Less,
1710 "lua" => Self::Lua,
1711 "makefile" => Self::Makefile,
1712 "markdown" => Self::Markdown,
1713 "objective-c" => Self::ObjectiveC,
1714 "objective-cpp" => Self::ObjectiveCPP,
1715 "pascal" => Self::Pascal,
1716 "perl" => Self::Perl,
1717 "perl6" => Self::Perl6,
1718 "php" => Self::PHP,
1719 "plaintext" => Self::Plaintext,
1720 "powershell" => Self::Powershell,
1721 "jade" => Self::Pug,
1722 "python" => Self::Python,
1723 "r" => Self::R,
1724 "razor" => Self::Razor,
1725 "ruby" => Self::Ruby,
1726 "rust" => Self::Rust,
1727 "scss" => Self::SCSS,
1728 "sass" => Self::SASS,
1729 "scala" => Self::Scala,
1730 "shaderlab" => Self::ShaderLab,
1731 "shellscript" => Self::ShellScript,
1732 "sql" => Self::SQL,
1733 "swift" => Self::Swift,
1734 "typescript" => Self::TypeScript,
1735 "typescriptreact" => Self::TypeScriptReact,
1736 "tex" => Self::TeX,
1737 "vb" => Self::VisualBasic,
1738 "xml" => Self::XML,
1739 "xsl" => Self::XSL,
1740 "yaml" => Self::YAML,
1741 _ => Self::Custom(Cow::Owned(v)),
1742 }
1743 }
1744}
1745impl LanguageKind {
1746 #[must_use]
1748 pub const fn new(s: &'static str) -> Self {
1749 Self::Custom(Cow::Borrowed(s))
1750 }
1751}
1752impl From<&'static str> for LanguageKind {
1753 fn from(s: &'static str) -> Self {
1754 match s {
1755 "abap" => Self::ABAP,
1756 "bat" => Self::WindowsBat,
1757 "bibtex" => Self::BibTeX,
1758 "clojure" => Self::Clojure,
1759 "coffeescript" => Self::Coffeescript,
1760 "c" => Self::C,
1761 "cpp" => Self::CPP,
1762 "csharp" => Self::CSharp,
1763 "css" => Self::CSS,
1764 "d" => Self::D,
1765 "pascal" => Self::Delphi,
1766 "diff" => Self::Diff,
1767 "dart" => Self::Dart,
1768 "dockerfile" => Self::Dockerfile,
1769 "elixir" => Self::Elixir,
1770 "erlang" => Self::Erlang,
1771 "fsharp" => Self::FSharp,
1772 "git-commit" => Self::GitCommit,
1773 "git-rebase" => Self::GitRebase,
1774 "go" => Self::Go,
1775 "groovy" => Self::Groovy,
1776 "handlebars" => Self::Handlebars,
1777 "haskell" => Self::Haskell,
1778 "html" => Self::HTML,
1779 "ini" => Self::Ini,
1780 "java" => Self::Java,
1781 "javascript" => Self::JavaScript,
1782 "javascriptreact" => Self::JavaScriptReact,
1783 "json" => Self::JSON,
1784 "latex" => Self::LaTeX,
1785 "less" => Self::Less,
1786 "lua" => Self::Lua,
1787 "makefile" => Self::Makefile,
1788 "markdown" => Self::Markdown,
1789 "objective-c" => Self::ObjectiveC,
1790 "objective-cpp" => Self::ObjectiveCPP,
1791 "pascal" => Self::Pascal,
1792 "perl" => Self::Perl,
1793 "perl6" => Self::Perl6,
1794 "php" => Self::PHP,
1795 "plaintext" => Self::Plaintext,
1796 "powershell" => Self::Powershell,
1797 "jade" => Self::Pug,
1798 "python" => Self::Python,
1799 "r" => Self::R,
1800 "razor" => Self::Razor,
1801 "ruby" => Self::Ruby,
1802 "rust" => Self::Rust,
1803 "scss" => Self::SCSS,
1804 "sass" => Self::SASS,
1805 "scala" => Self::Scala,
1806 "shaderlab" => Self::ShaderLab,
1807 "shellscript" => Self::ShellScript,
1808 "sql" => Self::SQL,
1809 "swift" => Self::Swift,
1810 "typescript" => Self::TypeScript,
1811 "typescriptreact" => Self::TypeScriptReact,
1812 "tex" => Self::TeX,
1813 "vb" => Self::VisualBasic,
1814 "xml" => Self::XML,
1815 "xsl" => Self::XSL,
1816 "yaml" => Self::YAML,
1817 _ => Self::Custom(Cow::Borrowed(s)),
1818 }
1819 }
1820}
1821impl fmt::Display for LanguageKind {
1822 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1823 let s: String = self.clone().into();
1824 write!(f, "{s}")
1825 }
1826}
1827impl LanguageKind {
1828 #[must_use]
1829 pub fn as_str(&self) -> &str {
1830 match self {
1831 Self::ABAP => "abap",
1832 Self::WindowsBat => "bat",
1833 Self::BibTeX => "bibtex",
1834 Self::Clojure => "clojure",
1835 Self::Coffeescript => "coffeescript",
1836 Self::C => "c",
1837 Self::CPP => "cpp",
1838 Self::CSharp => "csharp",
1839 Self::CSS => "css",
1840 Self::D => "d",
1841 Self::Delphi => "pascal",
1842 Self::Diff => "diff",
1843 Self::Dart => "dart",
1844 Self::Dockerfile => "dockerfile",
1845 Self::Elixir => "elixir",
1846 Self::Erlang => "erlang",
1847 Self::FSharp => "fsharp",
1848 Self::GitCommit => "git-commit",
1849 Self::GitRebase => "git-rebase",
1850 Self::Go => "go",
1851 Self::Groovy => "groovy",
1852 Self::Handlebars => "handlebars",
1853 Self::Haskell => "haskell",
1854 Self::HTML => "html",
1855 Self::Ini => "ini",
1856 Self::Java => "java",
1857 Self::JavaScript => "javascript",
1858 Self::JavaScriptReact => "javascriptreact",
1859 Self::JSON => "json",
1860 Self::LaTeX => "latex",
1861 Self::Less => "less",
1862 Self::Lua => "lua",
1863 Self::Makefile => "makefile",
1864 Self::Markdown => "markdown",
1865 Self::ObjectiveC => "objective-c",
1866 Self::ObjectiveCPP => "objective-cpp",
1867 Self::Pascal => "pascal",
1868 Self::Perl => "perl",
1869 Self::Perl6 => "perl6",
1870 Self::PHP => "php",
1871 Self::Plaintext => "plaintext",
1872 Self::Powershell => "powershell",
1873 Self::Pug => "jade",
1874 Self::Python => "python",
1875 Self::R => "r",
1876 Self::Razor => "razor",
1877 Self::Ruby => "ruby",
1878 Self::Rust => "rust",
1879 Self::SCSS => "scss",
1880 Self::SASS => "sass",
1881 Self::Scala => "scala",
1882 Self::ShaderLab => "shaderlab",
1883 Self::ShellScript => "shellscript",
1884 Self::SQL => "sql",
1885 Self::Swift => "swift",
1886 Self::TypeScript => "typescript",
1887 Self::TypeScriptReact => "typescriptreact",
1888 Self::TeX => "tex",
1889 Self::VisualBasic => "vb",
1890 Self::XML => "xml",
1891 Self::XSL => "xsl",
1892 Self::YAML => "yaml",
1893 Self::Custom(any) => any,
1894 }
1895 }
1896}
1897
1898#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
1902#[serde(into = "u32", from = "u32")]
1903pub enum InlineCompletionTriggerKind {
1904 Invoked,
1906 Automatic,
1908 #[serde(untagged)]
1910 Custom(u32),
1911}
1912impl From<InlineCompletionTriggerKind> for u32 {
1913 fn from(e: InlineCompletionTriggerKind) -> Self {
1914 match e {
1915 InlineCompletionTriggerKind::Invoked => 1u32,
1916 InlineCompletionTriggerKind::Automatic => 2u32,
1917 InlineCompletionTriggerKind::Custom(any) => any,
1918 }
1919 }
1920}
1921impl From<u32> for InlineCompletionTriggerKind {
1922 fn from(v: u32) -> Self {
1923 match v {
1924 1u32 => Self::Invoked,
1925 2u32 => Self::Automatic,
1926 _ => Self::Custom(v),
1927 }
1928 }
1929}
1930
1931#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
1935#[serde(into = "String", from = "String")]
1936pub enum PositionEncodingKind {
1937 UTF8,
1939 UTF16,
1944 UTF32,
1950 #[serde(untagged)]
1952 Custom(Cow<'static, str>),
1953}
1954impl From<PositionEncodingKind> for String {
1955 fn from(e: PositionEncodingKind) -> Self {
1956 match e {
1957 PositionEncodingKind::UTF8 => "utf-8".to_string(),
1958 PositionEncodingKind::UTF16 => "utf-16".to_string(),
1959 PositionEncodingKind::UTF32 => "utf-32".to_string(),
1960 PositionEncodingKind::Custom(any) => any.into_owned(),
1961 }
1962 }
1963}
1964impl From<String> for PositionEncodingKind {
1965 fn from(v: String) -> Self {
1966 match v.as_str() {
1967 "utf-8" => Self::UTF8,
1968 "utf-16" => Self::UTF16,
1969 "utf-32" => Self::UTF32,
1970 _ => Self::Custom(Cow::Owned(v)),
1971 }
1972 }
1973}
1974impl PositionEncodingKind {
1975 #[must_use]
1977 pub const fn new(s: &'static str) -> Self {
1978 Self::Custom(Cow::Borrowed(s))
1979 }
1980}
1981impl From<&'static str> for PositionEncodingKind {
1982 fn from(s: &'static str) -> Self {
1983 match s {
1984 "utf-8" => Self::UTF8,
1985 "utf-16" => Self::UTF16,
1986 "utf-32" => Self::UTF32,
1987 _ => Self::Custom(Cow::Borrowed(s)),
1988 }
1989 }
1990}
1991impl fmt::Display for PositionEncodingKind {
1992 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1993 let s: String = self.clone().into();
1994 write!(f, "{s}")
1995 }
1996}
1997impl PositionEncodingKind {
1998 #[must_use]
1999 pub fn as_str(&self) -> &str {
2000 match self {
2001 Self::UTF8 => "utf-8",
2002 Self::UTF16 => "utf-16",
2003 Self::UTF32 => "utf-32",
2004 Self::Custom(any) => any,
2005 }
2006 }
2007}
2008
2009#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2011#[serde(into = "u32", from = "u32")]
2012pub enum FileChangeType {
2013 Created,
2015 Changed,
2017 Deleted,
2019 #[serde(untagged)]
2021 Custom(u32),
2022}
2023impl From<FileChangeType> for u32 {
2024 fn from(e: FileChangeType) -> Self {
2025 match e {
2026 FileChangeType::Created => 1u32,
2027 FileChangeType::Changed => 2u32,
2028 FileChangeType::Deleted => 3u32,
2029 FileChangeType::Custom(any) => any,
2030 }
2031 }
2032}
2033impl From<u32> for FileChangeType {
2034 fn from(v: u32) -> Self {
2035 match v {
2036 1u32 => Self::Created,
2037 2u32 => Self::Changed,
2038 3u32 => Self::Deleted,
2039 _ => Self::Custom(v),
2040 }
2041 }
2042}
2043
2044#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2045#[serde(into = "u32", from = "u32")]
2046pub enum WatchKind {
2047 Create,
2049 Change,
2051 Delete,
2053 #[serde(untagged)]
2055 Custom(u32),
2056}
2057impl From<WatchKind> for u32 {
2058 fn from(e: WatchKind) -> Self {
2059 match e {
2060 WatchKind::Create => 1u32,
2061 WatchKind::Change => 2u32,
2062 WatchKind::Delete => 4u32,
2063 WatchKind::Custom(any) => any,
2064 }
2065 }
2066}
2067impl From<u32> for WatchKind {
2068 fn from(v: u32) -> Self {
2069 match v {
2070 1u32 => Self::Create,
2071 2u32 => Self::Change,
2072 4u32 => Self::Delete,
2073 _ => Self::Custom(v),
2074 }
2075 }
2076}
2077
2078#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2080#[serde(into = "u32", from = "u32")]
2081pub enum DiagnosticSeverity {
2082 Error,
2084 Warning,
2086 Information,
2088 Hint,
2090 #[serde(untagged)]
2092 Custom(u32),
2093}
2094impl From<DiagnosticSeverity> for u32 {
2095 fn from(e: DiagnosticSeverity) -> Self {
2096 match e {
2097 DiagnosticSeverity::Error => 1u32,
2098 DiagnosticSeverity::Warning => 2u32,
2099 DiagnosticSeverity::Information => 3u32,
2100 DiagnosticSeverity::Hint => 4u32,
2101 DiagnosticSeverity::Custom(any) => any,
2102 }
2103 }
2104}
2105impl From<u32> for DiagnosticSeverity {
2106 fn from(v: u32) -> Self {
2107 match v {
2108 1u32 => Self::Error,
2109 2u32 => Self::Warning,
2110 3u32 => Self::Information,
2111 4u32 => Self::Hint,
2112 _ => Self::Custom(v),
2113 }
2114 }
2115}
2116
2117#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2121#[serde(into = "u32", from = "u32")]
2122pub enum DiagnosticTag {
2123 Unnecessary,
2128 Deprecated,
2132 #[serde(untagged)]
2134 Custom(u32),
2135}
2136impl From<DiagnosticTag> for u32 {
2137 fn from(e: DiagnosticTag) -> Self {
2138 match e {
2139 DiagnosticTag::Unnecessary => 1u32,
2140 DiagnosticTag::Deprecated => 2u32,
2141 DiagnosticTag::Custom(any) => any,
2142 }
2143 }
2144}
2145impl From<u32> for DiagnosticTag {
2146 fn from(v: u32) -> Self {
2147 match v {
2148 1u32 => Self::Unnecessary,
2149 2u32 => Self::Deprecated,
2150 _ => Self::Custom(v),
2151 }
2152 }
2153}
2154
2155#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2157#[serde(into = "u32", from = "u32")]
2158pub enum CompletionTriggerKind {
2159 Invoked,
2162 TriggerCharacter,
2165 TriggerForIncompleteCompletions,
2167 #[serde(untagged)]
2169 Custom(u32),
2170}
2171impl From<CompletionTriggerKind> for u32 {
2172 fn from(e: CompletionTriggerKind) -> Self {
2173 match e {
2174 CompletionTriggerKind::Invoked => 1u32,
2175 CompletionTriggerKind::TriggerCharacter => 2u32,
2176 CompletionTriggerKind::TriggerForIncompleteCompletions => 3u32,
2177 CompletionTriggerKind::Custom(any) => any,
2178 }
2179 }
2180}
2181impl From<u32> for CompletionTriggerKind {
2182 fn from(v: u32) -> Self {
2183 match v {
2184 1u32 => Self::Invoked,
2185 2u32 => Self::TriggerCharacter,
2186 3u32 => Self::TriggerForIncompleteCompletions,
2187 _ => Self::Custom(v),
2188 }
2189 }
2190}
2191
2192#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2197#[serde(into = "u32", from = "u32")]
2198pub enum ApplyKind {
2199 Replace,
2202 Merge,
2207 #[serde(untagged)]
2209 Custom(u32),
2210}
2211impl From<ApplyKind> for u32 {
2212 fn from(e: ApplyKind) -> Self {
2213 match e {
2214 ApplyKind::Replace => 1u32,
2215 ApplyKind::Merge => 2u32,
2216 ApplyKind::Custom(any) => any,
2217 }
2218 }
2219}
2220impl From<u32> for ApplyKind {
2221 fn from(v: u32) -> Self {
2222 match v {
2223 1u32 => Self::Replace,
2224 2u32 => Self::Merge,
2225 _ => Self::Custom(v),
2226 }
2227 }
2228}
2229
2230#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2234#[serde(into = "u32", from = "u32")]
2235pub enum SignatureHelpTriggerKind {
2236 Invoked,
2238 TriggerCharacter,
2240 ContentChange,
2242 #[serde(untagged)]
2244 Custom(u32),
2245}
2246impl From<SignatureHelpTriggerKind> for u32 {
2247 fn from(e: SignatureHelpTriggerKind) -> Self {
2248 match e {
2249 SignatureHelpTriggerKind::Invoked => 1u32,
2250 SignatureHelpTriggerKind::TriggerCharacter => 2u32,
2251 SignatureHelpTriggerKind::ContentChange => 3u32,
2252 SignatureHelpTriggerKind::Custom(any) => any,
2253 }
2254 }
2255}
2256impl From<u32> for SignatureHelpTriggerKind {
2257 fn from(v: u32) -> Self {
2258 match v {
2259 1u32 => Self::Invoked,
2260 2u32 => Self::TriggerCharacter,
2261 3u32 => Self::ContentChange,
2262 _ => Self::Custom(v),
2263 }
2264 }
2265}
2266
2267#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2271#[serde(into = "u32", from = "u32")]
2272pub enum CodeActionTriggerKind {
2273 Invoked,
2275 Automatic,
2280 #[serde(untagged)]
2282 Custom(u32),
2283}
2284impl From<CodeActionTriggerKind> for u32 {
2285 fn from(e: CodeActionTriggerKind) -> Self {
2286 match e {
2287 CodeActionTriggerKind::Invoked => 1u32,
2288 CodeActionTriggerKind::Automatic => 2u32,
2289 CodeActionTriggerKind::Custom(any) => any,
2290 }
2291 }
2292}
2293impl From<u32> for CodeActionTriggerKind {
2294 fn from(v: u32) -> Self {
2295 match v {
2296 1u32 => Self::Invoked,
2297 2u32 => Self::Automatic,
2298 _ => Self::Custom(v),
2299 }
2300 }
2301}
2302
2303#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
2308#[serde(into = "String", from = "String")]
2309pub enum FileOperationPatternKind {
2310 File,
2312 Folder,
2314 #[serde(untagged)]
2316 Custom(Cow<'static, str>),
2317}
2318impl From<FileOperationPatternKind> for String {
2319 fn from(e: FileOperationPatternKind) -> Self {
2320 match e {
2321 FileOperationPatternKind::File => "file".to_string(),
2322 FileOperationPatternKind::Folder => "folder".to_string(),
2323 FileOperationPatternKind::Custom(any) => any.into_owned(),
2324 }
2325 }
2326}
2327impl From<String> for FileOperationPatternKind {
2328 fn from(v: String) -> Self {
2329 match v.as_str() {
2330 "file" => Self::File,
2331 "folder" => Self::Folder,
2332 _ => Self::Custom(Cow::Owned(v)),
2333 }
2334 }
2335}
2336impl FileOperationPatternKind {
2337 #[must_use]
2339 pub const fn new(s: &'static str) -> Self {
2340 Self::Custom(Cow::Borrowed(s))
2341 }
2342}
2343impl From<&'static str> for FileOperationPatternKind {
2344 fn from(s: &'static str) -> Self {
2345 match s {
2346 "file" => Self::File,
2347 "folder" => Self::Folder,
2348 _ => Self::Custom(Cow::Borrowed(s)),
2349 }
2350 }
2351}
2352impl fmt::Display for FileOperationPatternKind {
2353 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2354 let s: String = self.clone().into();
2355 write!(f, "{s}")
2356 }
2357}
2358impl FileOperationPatternKind {
2359 #[must_use]
2360 pub fn as_str(&self) -> &str {
2361 match self {
2362 Self::File => "file",
2363 Self::Folder => "folder",
2364 Self::Custom(any) => any,
2365 }
2366 }
2367}
2368
2369#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2373#[serde(into = "u32", from = "u32")]
2374pub enum NotebookCellKind {
2375 Markup,
2377 Code,
2379 #[serde(untagged)]
2381 Custom(u32),
2382}
2383impl From<NotebookCellKind> for u32 {
2384 fn from(e: NotebookCellKind) -> Self {
2385 match e {
2386 NotebookCellKind::Markup => 1u32,
2387 NotebookCellKind::Code => 2u32,
2388 NotebookCellKind::Custom(any) => any,
2389 }
2390 }
2391}
2392impl From<u32> for NotebookCellKind {
2393 fn from(v: u32) -> Self {
2394 match v {
2395 1u32 => Self::Markup,
2396 2u32 => Self::Code,
2397 _ => Self::Custom(v),
2398 }
2399 }
2400}
2401
2402#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
2403#[serde(into = "String", from = "String")]
2404pub enum ResourceOperationKind {
2405 Create,
2407 Rename,
2409 Delete,
2411 #[serde(untagged)]
2413 Custom(Cow<'static, str>),
2414}
2415impl From<ResourceOperationKind> for String {
2416 fn from(e: ResourceOperationKind) -> Self {
2417 match e {
2418 ResourceOperationKind::Create => "create".to_string(),
2419 ResourceOperationKind::Rename => "rename".to_string(),
2420 ResourceOperationKind::Delete => "delete".to_string(),
2421 ResourceOperationKind::Custom(any) => any.into_owned(),
2422 }
2423 }
2424}
2425impl From<String> for ResourceOperationKind {
2426 fn from(v: String) -> Self {
2427 match v.as_str() {
2428 "create" => Self::Create,
2429 "rename" => Self::Rename,
2430 "delete" => Self::Delete,
2431 _ => Self::Custom(Cow::Owned(v)),
2432 }
2433 }
2434}
2435impl ResourceOperationKind {
2436 #[must_use]
2438 pub const fn new(s: &'static str) -> Self {
2439 Self::Custom(Cow::Borrowed(s))
2440 }
2441}
2442impl From<&'static str> for ResourceOperationKind {
2443 fn from(s: &'static str) -> Self {
2444 match s {
2445 "create" => Self::Create,
2446 "rename" => Self::Rename,
2447 "delete" => Self::Delete,
2448 _ => Self::Custom(Cow::Borrowed(s)),
2449 }
2450 }
2451}
2452impl fmt::Display for ResourceOperationKind {
2453 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2454 let s: String = self.clone().into();
2455 write!(f, "{s}")
2456 }
2457}
2458impl ResourceOperationKind {
2459 #[must_use]
2460 pub fn as_str(&self) -> &str {
2461 match self {
2462 Self::Create => "create",
2463 Self::Rename => "rename",
2464 Self::Delete => "delete",
2465 Self::Custom(any) => any,
2466 }
2467 }
2468}
2469
2470#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
2471#[serde(into = "String", from = "String")]
2472pub enum FailureHandlingKind {
2473 Abort,
2476 Transactional,
2479 TextOnlyTransactional,
2483 Undo,
2486 #[serde(untagged)]
2488 Custom(Cow<'static, str>),
2489}
2490impl From<FailureHandlingKind> for String {
2491 fn from(e: FailureHandlingKind) -> Self {
2492 match e {
2493 FailureHandlingKind::Abort => "abort".to_string(),
2494 FailureHandlingKind::Transactional => "transactional".to_string(),
2495 FailureHandlingKind::TextOnlyTransactional => {
2496 "textOnlyTransactional".to_string()
2497 }
2498 FailureHandlingKind::Undo => "undo".to_string(),
2499 FailureHandlingKind::Custom(any) => any.into_owned(),
2500 }
2501 }
2502}
2503impl From<String> for FailureHandlingKind {
2504 fn from(v: String) -> Self {
2505 match v.as_str() {
2506 "abort" => Self::Abort,
2507 "transactional" => Self::Transactional,
2508 "textOnlyTransactional" => Self::TextOnlyTransactional,
2509 "undo" => Self::Undo,
2510 _ => Self::Custom(Cow::Owned(v)),
2511 }
2512 }
2513}
2514impl FailureHandlingKind {
2515 #[must_use]
2517 pub const fn new(s: &'static str) -> Self {
2518 Self::Custom(Cow::Borrowed(s))
2519 }
2520}
2521impl From<&'static str> for FailureHandlingKind {
2522 fn from(s: &'static str) -> Self {
2523 match s {
2524 "abort" => Self::Abort,
2525 "transactional" => Self::Transactional,
2526 "textOnlyTransactional" => Self::TextOnlyTransactional,
2527 "undo" => Self::Undo,
2528 _ => Self::Custom(Cow::Borrowed(s)),
2529 }
2530 }
2531}
2532impl fmt::Display for FailureHandlingKind {
2533 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2534 let s: String = self.clone().into();
2535 write!(f, "{s}")
2536 }
2537}
2538impl FailureHandlingKind {
2539 #[must_use]
2540 pub fn as_str(&self) -> &str {
2541 match self {
2542 Self::Abort => "abort",
2543 Self::Transactional => "transactional",
2544 Self::TextOnlyTransactional => "textOnlyTransactional",
2545 Self::Undo => "undo",
2546 Self::Custom(any) => any,
2547 }
2548 }
2549}
2550
2551#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize, Copy)]
2552#[serde(into = "u32", from = "u32")]
2553pub enum PrepareSupportDefaultBehavior {
2554 Identifier,
2557 #[serde(untagged)]
2559 Custom(u32),
2560}
2561impl From<PrepareSupportDefaultBehavior> for u32 {
2562 fn from(e: PrepareSupportDefaultBehavior) -> Self {
2563 match e {
2564 PrepareSupportDefaultBehavior::Identifier => 1u32,
2565 PrepareSupportDefaultBehavior::Custom(any) => any,
2566 }
2567 }
2568}
2569impl From<u32> for PrepareSupportDefaultBehavior {
2570 fn from(v: u32) -> Self {
2571 match v {
2572 1u32 => Self::Identifier,
2573 _ => Self::Custom(v),
2574 }
2575 }
2576}
2577
2578#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)]
2579#[serde(into = "String", from = "String")]
2580pub enum TokenFormat {
2581 Relative,
2582 #[serde(untagged)]
2584 Custom(Cow<'static, str>),
2585}
2586impl From<TokenFormat> for String {
2587 fn from(e: TokenFormat) -> Self {
2588 match e {
2589 TokenFormat::Relative => "relative".to_string(),
2590 TokenFormat::Custom(any) => any.into_owned(),
2591 }
2592 }
2593}
2594impl From<String> for TokenFormat {
2595 fn from(v: String) -> Self {
2596 match v.as_str() {
2597 "relative" => Self::Relative,
2598 _ => Self::Custom(Cow::Owned(v)),
2599 }
2600 }
2601}
2602impl TokenFormat {
2603 #[must_use]
2605 pub const fn new(s: &'static str) -> Self {
2606 Self::Custom(Cow::Borrowed(s))
2607 }
2608}
2609impl From<&'static str> for TokenFormat {
2610 fn from(s: &'static str) -> Self {
2611 match s {
2612 "relative" => Self::Relative,
2613 _ => Self::Custom(Cow::Borrowed(s)),
2614 }
2615 }
2616}
2617impl fmt::Display for TokenFormat {
2618 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2619 let s: String = self.clone().into();
2620 write!(f, "{s}")
2621 }
2622}
2623impl TokenFormat {
2624 #[must_use]
2625 pub fn as_str(&self) -> &str {
2626 match self {
2627 Self::Relative => "relative",
2628 Self::Custom(any) => any,
2629 }
2630 }
2631}
2632
2633impl std::ops::BitOr for WatchKind {
2634 type Output = Self;
2635 fn bitor(self, rhs: Self) -> Self {
2636 (Into::<u32>::into(self) | Into::<u32>::into(rhs)).into()
2637 }
2638}
2639impl std::ops::BitOrAssign for WatchKind {
2640 fn bitor_assign(&mut self, rhs: Self) {
2641 *self = (Into::<u32>::into(*self) | Into::<u32>::into(rhs)).into();
2642 }
2643}
2644impl std::ops::BitAnd for WatchKind {
2645 type Output = Self;
2646 fn bitand(self, rhs: Self) -> Self {
2647 (Into::<u32>::into(self) & Into::<u32>::into(rhs)).into()
2648 }
2649}
2650impl std::ops::BitAndAssign for WatchKind {
2651 fn bitand_assign(&mut self, rhs: Self) {
2652 *self = (Into::<u32>::into(*self) & Into::<u32>::into(rhs)).into();
2653 }
2654}
2655impl std::ops::BitXor for WatchKind {
2656 type Output = Self;
2657 fn bitxor(self, rhs: Self) -> Self {
2658 (Into::<u32>::into(self) ^ Into::<u32>::into(rhs)).into()
2659 }
2660}
2661impl std::ops::BitXorAssign for WatchKind {
2662 fn bitxor_assign(&mut self, rhs: Self) {
2663 *self = (Into::<u32>::into(*self) ^ Into::<u32>::into(rhs)).into();
2664 }
2665}