1pub mod decoder;
15pub mod encoder;
16
17use std::collections::HashMap;
18
19use args::{FieldArgument, AmqpString};
20
21pub use self::connection::ConnectionClass;
22pub use self::channel::ChannelClass;
23pub use self::exchange::ExchangeClass;
24pub use self::queue::QueueClass;
25pub use self::basic::BasicClass;
26pub use self::tx::TxClass;
27
28
29#[derive(PartialEq, Clone, Debug)]
30pub enum MethodPayload {
31 Connection(ConnectionClass),
32 Channel(ChannelClass),
33 Exchange(ExchangeClass),
34 Queue(QueueClass),
35 Basic(BasicClass),
36 Tx(TxClass),
37}
38
39
40impl MethodPayload {
42 pub fn connection(&self) -> Option<&ConnectionClass> {
43 match self {
44 &MethodPayload::Connection(ref c) => Some(c),
45 _ => None,
46 }
47 }
48
49 pub fn channel(&self) -> Option<&ChannelClass> {
50 match self {
51 &MethodPayload::Channel(ref c) => Some(c),
52 _ => None,
53 }
54 }
55
56 pub fn exchange(&self) -> Option<&ExchangeClass> {
57 match self {
58 &MethodPayload::Exchange(ref c) => Some(c),
59 _ => None,
60 }
61 }
62
63 pub fn queue(&self) -> Option<&QueueClass> {
64 match self {
65 &MethodPayload::Queue(ref c) => Some(c),
66 _ => None,
67 }
68 }
69
70 pub fn basic(&self) -> Option<&BasicClass> {
71 match self {
72 &MethodPayload::Basic(ref c) => Some(c),
73 _ => None,
74 }
75 }
76
77 pub fn tx(&self) -> Option<&TxClass> {
78 match self {
79 &MethodPayload::Tx(ref c) => Some(c),
80 _ => None,
81 }
82 }
83}
84pub mod connection {
90 use super::*;
91
92 #[derive(PartialEq, Clone, Debug)]
93 pub enum ConnectionClass {
94 Start(StartMethod),
95 StartOk(StartOkMethod),
96 Secure(SecureMethod),
97 SecureOk(SecureOkMethod),
98 Tune(TuneMethod),
99 TuneOk(TuneOkMethod),
100 Open(OpenMethod),
101 OpenOk(OpenOkMethod),
102 Close(CloseMethod),
103 CloseOk,
104
105 Blocked(BlockedMethod),
107 Unblocked,
108 }
109
110 impl ConnectionClass {
112 pub fn start(&self) -> Option<&StartMethod> {
113 match self {
114 &ConnectionClass::Start(ref m) => Some(m),
115 _ => None,
116 }
117 }
118
119 pub fn start_ok(&self) -> Option<&StartOkMethod> {
120 match self {
121 &ConnectionClass::StartOk(ref m) => Some(m),
122 _ => None,
123 }
124 }
125
126 pub fn secure(&self) -> Option<&SecureMethod> {
127 match self {
128 &ConnectionClass::Secure(ref m) => Some(m),
129 _ => None,
130 }
131 }
132
133 pub fn secure_ok(&self) -> Option<&SecureOkMethod> {
134 match self {
135 &ConnectionClass::SecureOk(ref m) => Some(m),
136 _ => None,
137 }
138 }
139
140 pub fn tune(&self) -> Option<&TuneMethod> {
141 match self {
142 &ConnectionClass::Tune(ref m) => Some(m),
143 _ => None,
144 }
145 }
146
147 pub fn tune_ok(&self) -> Option<&TuneOkMethod> {
148 match self {
149 &ConnectionClass::TuneOk(ref m) => Some(m),
150 _ => None,
151 }
152 }
153
154 pub fn open(&self) -> Option<&OpenMethod> {
155 match self {
156 &ConnectionClass::Open(ref m) => Some(m),
157 _ => None,
158 }
159 }
160
161 pub fn open_ok(&self) -> Option<&OpenOkMethod> {
162 match self {
163 &ConnectionClass::OpenOk(ref m) => Some(m),
164 _ => None,
165 }
166 }
167
168 pub fn close(&self) -> Option<&CloseMethod> {
169 match self {
170 &ConnectionClass::Close(ref m) => Some(m),
171 _ => None,
172 }
173 }
174
175 pub fn close_ok(&self) -> Option<()> {
176 match self {
177 &ConnectionClass::CloseOk => Some(()),
178 _ => None,
179 }
180 }
181
182 pub fn blocked(&self) -> Option<&BlockedMethod> {
183 match self {
184 &ConnectionClass::Blocked(ref m) => Some(m),
185 _ => None,
186 }
187 }
188
189 pub fn unblocked(&self) -> Option<()> {
190 match self {
191 &ConnectionClass::Unblocked => Some(()),
192 _ => None,
193 }
194 }
195 }
196 #[derive(PartialEq, Clone, Debug)]
199 pub struct StartMethod {
200 pub version_major: u8,
201 pub version_minor: u8,
202 pub server_properties: HashMap<AmqpString, FieldArgument>,
203 pub mechanisms: AmqpString,
204 pub locales: AmqpString,
205 }
206
207 #[derive(PartialEq, Clone, Debug)]
208 pub struct StartOkMethod {
209 pub client_properties: HashMap<AmqpString, FieldArgument>,
210 pub mechanism: AmqpString,
211 pub response: AmqpString,
212 pub locale: AmqpString,
213 }
214
215 #[derive(PartialEq, Clone, Debug)]
216 pub struct SecureMethod {
217 pub challenge: AmqpString,
218 }
219
220 #[derive(PartialEq, Clone, Debug)]
221 pub struct SecureOkMethod {
222 pub response: AmqpString,
223 }
224
225 #[derive(PartialEq, Clone, Debug)]
226 pub struct TuneMethod {
227 pub channel_max: u16,
228 pub frame_max: u32,
229 pub heartbeat: u16,
230 }
231
232 #[derive(PartialEq, Clone, Debug)]
233 pub struct TuneOkMethod {
234 pub channel_max: u16,
235 pub frame_max: u32,
236 pub heartbeat: u16,
237 }
238
239 #[derive(PartialEq, Clone, Debug)]
240 pub struct OpenMethod {
241 pub virtual_host: AmqpString,
242 pub reserved1: AmqpString,
243 pub reserved2: bool,
244 }
245
246 #[derive(PartialEq, Clone, Debug)]
247 pub struct OpenOkMethod {
248 pub reserved1: AmqpString,
249 }
250
251 #[derive(PartialEq, Clone, Debug)]
252 pub struct CloseMethod {
253 pub reply_code: u16,
254 pub reply_text: AmqpString,
255 pub class_id: u16,
256 pub method_id: u16,
257 }
258
259 #[derive(PartialEq, Clone, Debug)]
260 pub struct BlockedMethod {
261 pub reason: AmqpString,
262 }
263}
264pub mod channel {
269 use super::*;
270
271 #[derive(PartialEq, Clone, Debug)]
272 pub enum ChannelClass {
273 Open(OpenMethod),
274 OpenOk(OpenOkMethod),
275 Flow(FlowMethod),
276 FlowOk(FlowOkMethod),
277 Close(CloseMethod),
278 CloseOk,
279 }
280
281 impl ChannelClass {
283 pub fn open(&self) -> Option<&OpenMethod> {
284 match self {
285 &ChannelClass::Open(ref m) => Some(m),
286 _ => None,
287 }
288 }
289
290 pub fn open_ok(&self) -> Option<&OpenOkMethod> {
291 match self {
292 &ChannelClass::OpenOk(ref m) => Some(m),
293 _ => None,
294 }
295 }
296
297 pub fn flow(&self) -> Option<&FlowMethod> {
298 match self {
299 &ChannelClass::Flow(ref m) => Some(m),
300 _ => None,
301 }
302 }
303
304 pub fn flow_ok(&self) -> Option<&FlowOkMethod> {
305 match self {
306 &ChannelClass::FlowOk(ref m) => Some(m),
307 _ => None,
308 }
309 }
310
311 pub fn close(&self) -> Option<&CloseMethod> {
312 match self {
313 &ChannelClass::Close(ref m) => Some(m),
314 _ => None,
315 }
316 }
317
318 pub fn close_ok(&self) -> Option<()> {
319 match self {
320 &ChannelClass::CloseOk => Some(()),
321 _ => None,
322 }
323 }
324 }
325 #[derive(PartialEq, Clone, Debug)]
328 pub struct OpenMethod {
329 pub reserved1: AmqpString,
330 }
331
332 #[derive(PartialEq, Clone, Debug)]
333 pub struct OpenOkMethod {
334 pub reserved1: AmqpString,
335 }
336
337 #[derive(PartialEq, Clone, Debug)]
338 pub struct FlowMethod {
339 pub active: bool,
340 }
341
342 #[derive(PartialEq, Clone, Debug)]
343 pub struct FlowOkMethod {
344 pub active: bool,
345 }
346
347 #[derive(PartialEq, Clone, Debug)]
348 pub struct CloseMethod {
349 pub reply_code: u16,
350 pub reply_text: AmqpString,
351 pub class_id: u16,
352 pub method_id: u16,
353 }
354}
355pub mod exchange {
360 use super::*;
361
362 #[derive(PartialEq, Clone, Debug)]
363 pub enum ExchangeClass {
364 Declare(DeclareMethod),
365 DeclareOk,
366 Delete(DeleteMethod),
367 DeleteOk,
368 Bind(BindMethod),
369 BindOk, Unbind(UnbindMethod),
371 UnbindOk, }
373
374 impl ExchangeClass {
376 pub fn declare(&self) -> Option<&DeclareMethod> {
377 match self {
378 &ExchangeClass::Declare(ref m) => Some(m),
379 _ => None,
380 }
381 }
382
383 pub fn declare_ok(&self) -> Option<()> {
384 match self {
385 &ExchangeClass::DeclareOk => Some(()),
386 _ => None,
387 }
388 }
389
390 pub fn delete(&self) -> Option<&DeleteMethod> {
391 match self {
392 &ExchangeClass::Delete(ref m) => Some(m),
393 _ => None,
394 }
395 }
396
397 pub fn delete_ok(&self) -> Option<()> {
398 match self {
399 &ExchangeClass::DeleteOk => Some(()),
400 _ => None,
401 }
402 }
403
404 pub fn bind(&self) -> Option<&BindMethod> {
405 match self {
406 &ExchangeClass::Bind(ref m) => Some(m),
407 _ => None,
408 }
409 }
410
411 pub fn bind_ok(&self) -> Option<()> {
412 match self {
413 &ExchangeClass::BindOk => Some(()),
414 _ => None,
415 }
416 }
417
418 pub fn unbind(&self) -> Option<&UnbindMethod> {
419 match self {
420 &ExchangeClass::Unbind(ref m) => Some(m),
421 _ => None,
422 }
423 }
424
425 pub fn unbind_ok(&self) -> Option<()> {
426 match self {
427 &ExchangeClass::UnbindOk => Some(()),
428 _ => None,
429 }
430 }
431 }
432 #[derive(PartialEq, Clone, Debug)]
435 pub struct DeclareMethod {
436 pub reserved1: u16,
437 pub exchange: AmqpString,
438 pub typ: AmqpString,
439 pub passive: bool,
440 pub durable: bool,
441 pub auto_delete: bool, pub internal: bool, pub no_wait: bool,
444 pub arguments: HashMap<AmqpString, FieldArgument>,
445 }
446
447 #[derive(PartialEq, Clone, Debug)]
448 pub struct DeleteMethod {
449 pub reserved1: u16,
450 pub exchange: AmqpString,
451 pub if_unused: bool,
452 pub no_wait: bool,
453 }
454
455 #[derive(PartialEq, Clone, Debug)]
456 pub struct BindMethod {
457 pub reserved1: u16,
458 pub destination: AmqpString,
459 pub source: AmqpString,
460 pub routing_key: AmqpString,
461 pub no_wait: bool,
462 pub arguments: HashMap<AmqpString, FieldArgument>,
463 }
464
465 #[derive(PartialEq, Clone, Debug)]
466 pub struct UnbindMethod {
467 pub reserved1: u16,
468 pub destination: AmqpString,
469 pub source: AmqpString,
470 pub routing_key: AmqpString,
471 pub no_wait: bool,
472 pub arguments: HashMap<AmqpString, FieldArgument>,
473 }
474}
475pub mod queue {
480 use super::*;
481
482 #[derive(PartialEq, Clone, Debug)]
483 pub enum QueueClass {
484 Declare(DeclareMethod),
485 DeclareOk(DeclareOkMethod),
486 Bind(BindMethod),
487 BindOk,
488 Unbind(UnbindMethod),
489 UnbindOk,
490 Purge(PurgeMethod),
491 PurgeOk(PurgeOkMethod),
492 Delete(DeleteMethod),
493 DeleteOk(DeleteOkMethod),
494 }
495
496 impl QueueClass {
498 pub fn declare(&self) -> Option<&DeclareMethod> {
499 match self {
500 &QueueClass::Declare(ref m) => Some(m),
501 _ => None,
502 }
503 }
504
505 pub fn declare_ok(&self) -> Option<&DeclareOkMethod> {
506 match self {
507 &QueueClass::DeclareOk(ref m) => Some(m),
508 _ => None,
509 }
510 }
511
512 pub fn bind(&self) -> Option<&BindMethod> {
513 match self {
514 &QueueClass::Bind(ref m) => Some(m),
515 _ => None,
516 }
517 }
518
519 pub fn bind_ok(&self) -> Option<()> {
520 match self {
521 &QueueClass::BindOk => Some(()),
522 _ => None,
523 }
524 }
525
526 pub fn unbind(&self) -> Option<&UnbindMethod> {
527 match self {
528 &QueueClass::Unbind(ref m) => Some(m),
529 _ => None,
530 }
531 }
532
533 pub fn unbind_ok(&self) -> Option<()> {
534 match self {
535 &QueueClass::UnbindOk => Some(()),
536 _ => None,
537 }
538 }
539
540 pub fn purge(&self) -> Option<&PurgeMethod> {
541 match self {
542 &QueueClass::Purge(ref m) => Some(m),
543 _ => None,
544 }
545 }
546
547 pub fn purge_ok(&self) -> Option<&PurgeOkMethod> {
548 match self {
549 &QueueClass::PurgeOk(ref m) => Some(m),
550 _ => None,
551 }
552 }
553
554 pub fn delete(&self) -> Option<&DeleteMethod> {
555 match self {
556 &QueueClass::Delete(ref m) => Some(m),
557 _ => None,
558 }
559 }
560
561 pub fn delete_ok(&self) -> Option<&DeleteOkMethod> {
562 match self {
563 &QueueClass::DeleteOk(ref m) => Some(m),
564 _ => None,
565 }
566 }
567 }
568 #[derive(PartialEq, Clone, Debug)]
572 pub struct DeclareMethod {
573 pub reserved1: u16,
574 pub queue: AmqpString,
575 pub passive: bool,
576 pub durable: bool,
577 pub exclusive: bool,
578 pub auto_delete: bool,
579 pub no_wait: bool,
580 pub arguments: HashMap<AmqpString, FieldArgument>,
581 }
582
583 #[derive(PartialEq, Clone, Debug)]
584 pub struct DeclareOkMethod {
585 pub queue: AmqpString,
586 pub message_count: u32,
587 pub consumer_count: u32,
588 }
589
590 #[derive(PartialEq, Clone, Debug)]
591 pub struct BindMethod {
592 pub reserved1: u16,
593 pub queue: AmqpString,
594 pub exchange: AmqpString,
595 pub routing_key: AmqpString,
596 pub no_wait: bool,
597 pub arguments: HashMap<AmqpString, FieldArgument>,
598 }
599
600 #[derive(PartialEq, Clone, Debug)]
601 pub struct UnbindMethod {
602 pub reserved1: u16,
603 pub queue: AmqpString,
604 pub exchange: AmqpString,
605 pub routing_key: AmqpString,
606 pub arguments: HashMap<AmqpString, FieldArgument>,
607 }
608
609 #[derive(PartialEq, Clone, Debug)]
610 pub struct PurgeMethod {
611 pub reserved1: u16,
612 pub queue: AmqpString,
613 pub no_wait: bool,
614 }
615
616 #[derive(PartialEq, Clone, Debug)]
617 pub struct PurgeOkMethod {
618 pub message_count: u32,
619 }
620
621 #[derive(PartialEq, Clone, Debug)]
622 pub struct DeleteMethod {
623 pub reserved1: u16,
624 pub queue: AmqpString,
625 pub if_unused: bool,
626 pub if_empty: bool,
627 pub no_wait: bool,
628 }
629
630 #[derive(PartialEq, Clone, Debug)]
631 pub struct DeleteOkMethod {
632 pub message_count: u32,
633 }
634}
635pub mod basic {
640 use super::*;
641
642 #[derive(PartialEq, Clone, Debug)]
664 pub enum BasicClass {
665 Qos(QosMethod),
666 QosOk,
667 Consume(ConsumeMethod),
668 ConsumeOk(ConsumeOkMethod),
669 Cancel(CancelMethod),
670 CancelOk(CancelOkMethod),
671 Publish(PublishMethod),
672 Return(ReturnMethod),
673 Deliver(DeliverMethod),
674 Get(GetMethod),
675 GetOk(GetOkMethod),
676 GetEmpty(GetEmptyMethod),
677 Ack(AckMethod),
678 Reject(RejectMethod),
679 Nack(NackMethod), RecoverAsync(RecoverAsyncMethod),
681 Recover(RecoverMethod),
682 RecoverOk,
683 }
684
685 impl BasicClass {
687 pub fn qos(&self) -> Option<&QosMethod> {
688 match self {
689 &BasicClass::Qos(ref m) => Some(m),
690 _ => None,
691 }
692 }
693
694 pub fn qos_ok(&self) -> Option<()> {
695 match self {
696 &BasicClass::QosOk => Some(()),
697 _ => None,
698 }
699 }
700
701 pub fn consume(&self) -> Option<&ConsumeMethod> {
702 match self {
703 &BasicClass::Consume(ref m) => Some(m),
704 _ => None,
705 }
706 }
707
708 pub fn consume_ok(&self) -> Option<&ConsumeOkMethod> {
709 match self {
710 &BasicClass::ConsumeOk(ref m) => Some(m),
711 _ => None,
712 }
713 }
714
715 pub fn cancel(&self) -> Option<&CancelMethod> {
716 match self {
717 &BasicClass::Cancel(ref m) => Some(m),
718 _ => None,
719 }
720 }
721
722 pub fn cancel_ok(&self) -> Option<&CancelOkMethod> {
723 match self {
724 &BasicClass::CancelOk(ref m) => Some(m),
725 _ => None,
726 }
727 }
728
729 pub fn publish(&self) -> Option<&PublishMethod> {
730 match self {
731 &BasicClass::Publish(ref m) => Some(m),
732 _ => None,
733 }
734 }
735
736 pub fn return_(&self) -> Option<&ReturnMethod> {
738 match self {
739 &BasicClass::Return(ref m) => Some(m),
740 _ => None,
741 }
742 }
743
744 pub fn deliver(&self) -> Option<&DeliverMethod> {
745 match self {
746 &BasicClass::Deliver(ref m) => Some(m),
747 _ => None,
748 }
749 }
750
751 pub fn get(&self) -> Option<&GetMethod> {
752 match self {
753 &BasicClass::Get(ref m) => Some(m),
754 _ => None,
755 }
756 }
757
758 pub fn get_ok(&self) -> Option<&GetOkMethod> {
759 match self {
760 &BasicClass::GetOk(ref m) => Some(m),
761 _ => None,
762 }
763 }
764
765 pub fn get_empty(&self) -> Option<&GetEmptyMethod> {
766 match self {
767 &BasicClass::GetEmpty(ref m) => Some(m),
768 _ => None,
769 }
770 }
771
772 pub fn ack(&self) -> Option<&AckMethod> {
773 match self {
774 &BasicClass::Ack(ref m) => Some(m),
775 _ => None,
776 }
777 }
778
779 pub fn reject(&self) -> Option<&RejectMethod> {
780 match self {
781 &BasicClass::Reject(ref m) => Some(m),
782 _ => None,
783 }
784 }
785
786 pub fn nack(&self) -> Option<&NackMethod> {
787 match self {
788 &BasicClass::Nack(ref m) => Some(m),
789 _ => None,
790 }
791 }
792
793 pub fn recover_async(&self) -> Option<&RecoverAsyncMethod> {
794 match self {
795 &BasicClass::RecoverAsync(ref m) => Some(m),
796 _ => None,
797 }
798 }
799
800 pub fn recover(&self) -> Option<&RecoverMethod> {
801 match self {
802 &BasicClass::Recover(ref m) => Some(m),
803 _ => None,
804 }
805 }
806
807 pub fn recover_ok(&self) -> Option<()> {
808 match self {
809 &BasicClass::RecoverOk => Some(()),
810 _ => None,
811 }
812 }
813 }
814 #[derive(PartialEq, Clone, Debug)]
817 pub struct QosMethod {
818 pub prefetch_size: u32,
819 pub prefetch_count: u16,
820 pub global: bool,
821 }
822
823 #[derive(PartialEq, Clone, Debug)]
824 pub struct ConsumeMethod {
825 pub reserved1: u16,
826 pub queue: AmqpString,
827 pub consumer_tag: AmqpString,
828 pub no_local: bool,
829 pub no_ack: bool,
830 pub exclusive: bool,
831 pub no_wait: bool,
832 pub arguments: HashMap<AmqpString, FieldArgument>,
833 }
834
835 #[derive(PartialEq, Clone, Debug)]
836 pub struct ConsumeOkMethod {
837 pub consumer_tag: AmqpString,
838 }
839
840 #[derive(PartialEq, Clone, Debug)]
841 pub struct CancelMethod {
842 pub consumer_tag: AmqpString,
843 pub no_wait: bool,
844 }
845
846 #[derive(PartialEq, Clone, Debug)]
847 pub struct CancelOkMethod {
848 pub consumer_tag: AmqpString,
849 }
850
851 #[derive(PartialEq, Clone, Debug)]
852 pub struct PublishMethod {
853 pub reserved1: u16,
854 pub exchange: AmqpString,
855 pub routing_key: AmqpString,
856 pub mandatory: bool,
857 pub immediate: bool,
858 }
859
860 #[derive(PartialEq, Clone, Debug)]
861 pub struct ReturnMethod {
862 pub reply_code: u16,
863 pub reply_text: AmqpString,
864 pub exchange: AmqpString,
865 pub routing_key: AmqpString,
866 }
867
868 #[derive(PartialEq, Clone, Debug)]
869 pub struct DeliverMethod {
870 pub consumer_tag: AmqpString,
871 pub delivery_tag: u64,
872 pub redeliverd: bool,
873 pub exchange: AmqpString,
874 pub routing_key: AmqpString,
875 }
876
877 #[derive(PartialEq, Clone, Debug)]
878 pub struct GetMethod {
879 pub reserved1: u16,
880 pub queue: AmqpString,
881 pub no_ack: bool,
882 }
883
884 #[derive(PartialEq, Clone, Debug)]
885 pub struct GetOkMethod {
886 pub delivery_tag: u64,
887 pub redeliverd: bool,
888 pub exchange: AmqpString,
889 pub routing_key: AmqpString,
890 pub message_count: u32,
891 }
892
893 #[derive(PartialEq, Clone, Debug)]
894 pub struct GetEmptyMethod {
895 pub reserved1: AmqpString,
896 }
897
898 #[derive(PartialEq, Clone, Debug)]
899 pub struct AckMethod {
900 pub delivery_tag: u64,
901 pub multiple: bool,
902 }
903
904 #[derive(PartialEq, Clone, Debug)]
905 pub struct RejectMethod {
906 pub delivery_tag: u64,
907 pub requeue: bool,
908 }
909
910 #[derive(PartialEq, Clone, Debug)]
911 pub struct RecoverAsyncMethod {
912 pub requeue: bool,
913 }
914
915 #[derive(PartialEq, Clone, Debug)]
916 pub struct RecoverMethod {
917 pub requeue: bool,
918 }
919
920 #[derive(PartialEq, Clone, Debug)]
922 pub struct NackMethod {
923 pub delivery_tag: u64,
924 pub multiple: bool,
925 }
926}
927pub mod tx {
932 #[derive(PartialEq, Clone, Debug)]
942 pub enum TxClass {
943 Select,
944 SelectOk,
945 Commit,
946 CommitOk,
947 Rollback,
948 RollbackOk,
949 }
950
951 impl TxClass {
953 pub fn select(&self) -> Option<()> {
954 match self {
955 &TxClass::Select => Some(()),
956 _ => None,
957 }
958 }
959
960 pub fn select_ok(&self) -> Option<()> {
961 match self {
962 &TxClass::SelectOk => Some(()),
963 _ => None,
964 }
965 }
966
967 pub fn commit(&self) -> Option<()> {
968 match self {
969 &TxClass::Commit => Some(()),
970 _ => None,
971 }
972 }
973
974 pub fn commit_ok(&self) -> Option<()> {
975 match self {
976 &TxClass::CommitOk => Some(()),
977 _ => None,
978 }
979 }
980
981 pub fn rollback(&self) -> Option<()> {
982 match self {
983 &TxClass::Rollback => Some(()),
984 _ => None,
985 }
986 }
987
988 pub fn rollback_ok(&self) -> Option<()> {
989 match self {
990 &TxClass::RollbackOk => Some(()),
991 _ => None,
992 }
993 }
994 }
995 }
997