1#![allow(
8 clippy::too_many_arguments,
9 clippy::missing_errors_doc,
10 clippy::doc_markdown
11)]
12
13use fred::bytes::Bytes;
14use fred::bytes_utils::Str;
15use fred::error::Error;
16use fred::interfaces::{
17 FunctionInterface, HashesInterface, KeysInterface, ListInterface, PubsubInterface,
18 SetsInterface, SortedSetsInterface, StreamsInterface,
19};
20use fred::types::lists::{LMoveDirection, ListLocation};
21use fred::types::scripts::FnPolicy;
22use fred::types::sorted_sets::{
23 AggregateOptions, MultipleWeights, MultipleZaddValues, Ordering, ZCmp, ZRange, ZSort,
24};
25use fred::types::streams::{MultipleIDs, MultipleOrderedPairs, XCap, XID, XPendingArgs};
26use fred::types::{
27 Expiration, ExpireOptions, Key, Limit, Map, MultipleKeys, MultipleStrings, MultipleValues,
28 SetOptions, SortOrder, Value,
29};
30
31use super::{RedisPipeline, Segment};
32
33impl RedisPipeline {
34 pub async fn randomkey(&self) -> Result<(), Error> {
39 match self.segment().await? {
40 Segment::Plain(segment) => segment.randomkey::<()>().await,
41 Segment::Atomic(segment) => segment.randomkey::<()>().await,
42 }
43 }
44
45 pub async fn copy<S, D>(
50 &self,
51 source: S,
52 destination: D,
53 db: Option<u8>,
54 replace: bool,
55 ) -> Result<(), Error>
56 where
57 S: Into<Key> + Send,
58 D: Into<Key> + Send,
59 {
60 match self.segment().await? {
61 Segment::Plain(segment) => {
62 segment
63 .copy::<(), S, D>(source, destination, db, replace)
64 .await
65 }
66 Segment::Atomic(segment) => {
67 segment
68 .copy::<(), S, D>(source, destination, db, replace)
69 .await
70 }
71 }
72 }
73
74 pub async fn dump<K>(&self, key: K) -> Result<(), Error>
79 where
80 K: Into<Key> + Send,
81 {
82 match self.segment().await? {
83 Segment::Plain(segment) => segment.dump::<(), K>(key).await,
84 Segment::Atomic(segment) => segment.dump::<(), K>(key).await,
85 }
86 }
87
88 pub async fn r#type<K>(&self, key: K) -> Result<(), Error>
93 where
94 K: Into<Key> + Send,
95 {
96 match self.segment().await? {
97 Segment::Plain(segment) => segment.r#type::<(), K>(key).await,
98 Segment::Atomic(segment) => segment.r#type::<(), K>(key).await,
99 }
100 }
101
102 pub async fn restore<K>(
107 &self,
108 key: K,
109 ttl: i64,
110 serialized: Value,
111 replace: bool,
112 absttl: bool,
113 idletime: Option<i64>,
114 frequency: Option<i64>,
115 ) -> Result<(), Error>
116 where
117 K: Into<Key> + Send,
118 {
119 match self.segment().await? {
120 Segment::Plain(segment) => {
121 segment
122 .restore::<(), K>(key, ttl, serialized, replace, absttl, idletime, frequency)
123 .await
124 }
125 Segment::Atomic(segment) => {
126 segment
127 .restore::<(), K>(key, ttl, serialized, replace, absttl, idletime, frequency)
128 .await
129 }
130 }
131 }
132
133 pub async fn set<K, V>(
138 &self,
139 key: K,
140 value: V,
141 expire: Option<Expiration>,
142 options: Option<SetOptions>,
143 get: bool,
144 ) -> Result<(), Error>
145 where
146 K: Into<Key> + Send,
147 V: TryInto<Value> + Send,
148 V::Error: Into<Error> + Send,
149 {
150 match self.segment().await? {
151 Segment::Plain(segment) => {
152 segment
153 .set::<(), K, V>(key, value, expire, options, get)
154 .await
155 }
156 Segment::Atomic(segment) => {
157 segment
158 .set::<(), K, V>(key, value, expire, options, get)
159 .await
160 }
161 }
162 }
163
164 pub async fn setnx<K, V>(&self, key: K, value: V) -> Result<(), Error>
169 where
170 K: Into<Key> + Send,
171 V: TryInto<Value> + Send,
172 V::Error: Into<Error> + Send,
173 {
174 match self.segment().await? {
175 Segment::Plain(segment) => segment.setnx::<(), K, V>(key, value).await,
176 Segment::Atomic(segment) => segment.setnx::<(), K, V>(key, value).await,
177 }
178 }
179
180 pub async fn get<K>(&self, key: K) -> Result<(), Error>
185 where
186 K: Into<Key> + Send,
187 {
188 match self.segment().await? {
189 Segment::Plain(segment) => segment.get::<(), K>(key).await,
190 Segment::Atomic(segment) => segment.get::<(), K>(key).await,
191 }
192 }
193
194 pub async fn getrange<K>(&self, key: K, start: usize, end: usize) -> Result<(), Error>
199 where
200 K: Into<Key> + Send,
201 {
202 match self.segment().await? {
203 Segment::Plain(segment) => segment.getrange::<(), K>(key, start, end).await,
204 Segment::Atomic(segment) => segment.getrange::<(), K>(key, start, end).await,
205 }
206 }
207
208 pub async fn setrange<K, V>(&self, key: K, offset: u32, value: V) -> Result<(), Error>
213 where
214 K: Into<Key> + Send,
215 V: TryInto<Value> + Send,
216 V::Error: Into<Error> + Send,
217 {
218 match self.segment().await? {
219 Segment::Plain(segment) => segment.setrange::<(), K, V>(key, offset, value).await,
220 Segment::Atomic(segment) => segment.setrange::<(), K, V>(key, offset, value).await,
221 }
222 }
223
224 pub async fn getset<K, V>(&self, key: K, value: V) -> Result<(), Error>
229 where
230 K: Into<Key> + Send,
231 V: TryInto<Value> + Send,
232 V::Error: Into<Error> + Send,
233 {
234 match self.segment().await? {
235 Segment::Plain(segment) => segment.getset::<(), K, V>(key, value).await,
236 Segment::Atomic(segment) => segment.getset::<(), K, V>(key, value).await,
237 }
238 }
239
240 pub async fn getdel<K>(&self, key: K) -> Result<(), Error>
245 where
246 K: Into<Key> + Send,
247 {
248 match self.segment().await? {
249 Segment::Plain(segment) => segment.getdel::<(), K>(key).await,
250 Segment::Atomic(segment) => segment.getdel::<(), K>(key).await,
251 }
252 }
253
254 pub async fn strlen<K>(&self, key: K) -> Result<(), Error>
259 where
260 K: Into<Key> + Send,
261 {
262 match self.segment().await? {
263 Segment::Plain(segment) => segment.strlen::<(), K>(key).await,
264 Segment::Atomic(segment) => segment.strlen::<(), K>(key).await,
265 }
266 }
267
268 pub async fn del<K>(&self, keys: K) -> Result<(), Error>
273 where
274 K: Into<MultipleKeys> + Send,
275 {
276 match self.segment().await? {
277 Segment::Plain(segment) => segment.del::<(), K>(keys).await,
278 Segment::Atomic(segment) => segment.del::<(), K>(keys).await,
279 }
280 }
281
282 pub async fn unlink<K>(&self, keys: K) -> Result<(), Error>
287 where
288 K: Into<MultipleKeys> + Send,
289 {
290 match self.segment().await? {
291 Segment::Plain(segment) => segment.unlink::<(), K>(keys).await,
292 Segment::Atomic(segment) => segment.unlink::<(), K>(keys).await,
293 }
294 }
295
296 pub async fn rename<S, D>(&self, source: S, destination: D) -> Result<(), Error>
301 where
302 S: Into<Key> + Send,
303 D: Into<Key> + Send,
304 {
305 match self.segment().await? {
306 Segment::Plain(segment) => segment.rename::<(), S, D>(source, destination).await,
307 Segment::Atomic(segment) => segment.rename::<(), S, D>(source, destination).await,
308 }
309 }
310
311 pub async fn renamenx<S, D>(&self, source: S, destination: D) -> Result<(), Error>
316 where
317 S: Into<Key> + Send,
318 D: Into<Key> + Send,
319 {
320 match self.segment().await? {
321 Segment::Plain(segment) => segment.renamenx::<(), S, D>(source, destination).await,
322 Segment::Atomic(segment) => segment.renamenx::<(), S, D>(source, destination).await,
323 }
324 }
325
326 pub async fn append<K, V>(&self, key: K, value: V) -> Result<(), Error>
331 where
332 K: Into<Key> + Send,
333 V: TryInto<Value> + Send,
334 V::Error: Into<Error> + Send,
335 {
336 match self.segment().await? {
337 Segment::Plain(segment) => segment.append::<(), K, V>(key, value).await,
338 Segment::Atomic(segment) => segment.append::<(), K, V>(key, value).await,
339 }
340 }
341
342 pub async fn mget<K>(&self, keys: K) -> Result<(), Error>
347 where
348 K: Into<MultipleKeys> + Send,
349 {
350 match self.segment().await? {
351 Segment::Plain(segment) => segment.mget::<(), K>(keys).await,
352 Segment::Atomic(segment) => segment.mget::<(), K>(keys).await,
353 }
354 }
355
356 pub async fn mset<V>(&self, values: V) -> Result<(), Error>
361 where
362 V: TryInto<Map> + Send,
363 V::Error: Into<Error> + Send,
364 {
365 match self.segment().await? {
366 Segment::Plain(segment) => segment.mset(values).await,
367 Segment::Atomic(segment) => segment.mset(values).await,
368 }
369 }
370
371 pub async fn msetnx<V>(&self, values: V) -> Result<(), Error>
376 where
377 V: TryInto<Map> + Send,
378 V::Error: Into<Error> + Send,
379 {
380 match self.segment().await? {
381 Segment::Plain(segment) => segment.msetnx::<(), V>(values).await,
382 Segment::Atomic(segment) => segment.msetnx::<(), V>(values).await,
383 }
384 }
385
386 pub async fn incr<K>(&self, key: K) -> Result<(), Error>
391 where
392 K: Into<Key> + Send,
393 {
394 match self.segment().await? {
395 Segment::Plain(segment) => segment.incr::<(), K>(key).await,
396 Segment::Atomic(segment) => segment.incr::<(), K>(key).await,
397 }
398 }
399
400 pub async fn incr_by<K>(&self, key: K, val: i64) -> Result<(), Error>
405 where
406 K: Into<Key> + Send,
407 {
408 match self.segment().await? {
409 Segment::Plain(segment) => segment.incr_by::<(), K>(key, val).await,
410 Segment::Atomic(segment) => segment.incr_by::<(), K>(key, val).await,
411 }
412 }
413
414 pub async fn incr_by_float<K>(&self, key: K, val: f64) -> Result<(), Error>
419 where
420 K: Into<Key> + Send,
421 {
422 match self.segment().await? {
423 Segment::Plain(segment) => segment.incr_by_float::<(), K>(key, val).await,
424 Segment::Atomic(segment) => segment.incr_by_float::<(), K>(key, val).await,
425 }
426 }
427
428 pub async fn decr<K>(&self, key: K) -> Result<(), Error>
433 where
434 K: Into<Key> + Send,
435 {
436 match self.segment().await? {
437 Segment::Plain(segment) => segment.decr::<(), K>(key).await,
438 Segment::Atomic(segment) => segment.decr::<(), K>(key).await,
439 }
440 }
441
442 pub async fn decr_by<K>(&self, key: K, val: i64) -> Result<(), Error>
447 where
448 K: Into<Key> + Send,
449 {
450 match self.segment().await? {
451 Segment::Plain(segment) => segment.decr_by::<(), K>(key, val).await,
452 Segment::Atomic(segment) => segment.decr_by::<(), K>(key, val).await,
453 }
454 }
455
456 pub async fn ttl<K>(&self, key: K) -> Result<(), Error>
461 where
462 K: Into<Key> + Send,
463 {
464 match self.segment().await? {
465 Segment::Plain(segment) => segment.ttl::<(), K>(key).await,
466 Segment::Atomic(segment) => segment.ttl::<(), K>(key).await,
467 }
468 }
469
470 pub async fn pttl<K>(&self, key: K) -> Result<(), Error>
475 where
476 K: Into<Key> + Send,
477 {
478 match self.segment().await? {
479 Segment::Plain(segment) => segment.pttl::<(), K>(key).await,
480 Segment::Atomic(segment) => segment.pttl::<(), K>(key).await,
481 }
482 }
483
484 pub async fn persist<K>(&self, key: K) -> Result<(), Error>
489 where
490 K: Into<Key> + Send,
491 {
492 match self.segment().await? {
493 Segment::Plain(segment) => segment.persist::<(), K>(key).await,
494 Segment::Atomic(segment) => segment.persist::<(), K>(key).await,
495 }
496 }
497
498 pub async fn expire<K>(
503 &self,
504 key: K,
505 seconds: i64,
506 options: Option<ExpireOptions>,
507 ) -> Result<(), Error>
508 where
509 K: Into<Key> + Send,
510 {
511 match self.segment().await? {
512 Segment::Plain(segment) => segment.expire::<(), K>(key, seconds, options).await,
513 Segment::Atomic(segment) => segment.expire::<(), K>(key, seconds, options).await,
514 }
515 }
516
517 pub async fn expire_at<K>(
522 &self,
523 key: K,
524 timestamp: i64,
525 options: Option<ExpireOptions>,
526 ) -> Result<(), Error>
527 where
528 K: Into<Key> + Send,
529 {
530 match self.segment().await? {
531 Segment::Plain(segment) => segment.expire_at::<(), K>(key, timestamp, options).await,
532 Segment::Atomic(segment) => segment.expire_at::<(), K>(key, timestamp, options).await,
533 }
534 }
535
536 pub async fn expire_time<K>(&self, key: K) -> Result<(), Error>
541 where
542 K: Into<Key> + Send,
543 {
544 match self.segment().await? {
545 Segment::Plain(segment) => segment.expire_time::<(), K>(key).await,
546 Segment::Atomic(segment) => segment.expire_time::<(), K>(key).await,
547 }
548 }
549
550 pub async fn pexpire<K>(
555 &self,
556 key: K,
557 milliseconds: i64,
558 options: Option<ExpireOptions>,
559 ) -> Result<(), Error>
560 where
561 K: Into<Key> + Send,
562 {
563 match self.segment().await? {
564 Segment::Plain(segment) => segment.pexpire::<(), K>(key, milliseconds, options).await,
565 Segment::Atomic(segment) => segment.pexpire::<(), K>(key, milliseconds, options).await,
566 }
567 }
568
569 pub async fn pexpire_at<K>(
574 &self,
575 key: K,
576 timestamp: i64,
577 options: Option<ExpireOptions>,
578 ) -> Result<(), Error>
579 where
580 K: Into<Key> + Send,
581 {
582 match self.segment().await? {
583 Segment::Plain(segment) => segment.pexpire_at::<(), K>(key, timestamp, options).await,
584 Segment::Atomic(segment) => segment.pexpire_at::<(), K>(key, timestamp, options).await,
585 }
586 }
587
588 pub async fn pexpire_time<K>(&self, key: K) -> Result<(), Error>
593 where
594 K: Into<Key> + Send,
595 {
596 match self.segment().await? {
597 Segment::Plain(segment) => segment.pexpire_time::<(), K>(key).await,
598 Segment::Atomic(segment) => segment.pexpire_time::<(), K>(key).await,
599 }
600 }
601
602 pub async fn exists<K>(&self, keys: K) -> Result<(), Error>
607 where
608 K: Into<MultipleKeys> + Send,
609 {
610 match self.segment().await? {
611 Segment::Plain(segment) => segment.exists::<(), K>(keys).await,
612 Segment::Atomic(segment) => segment.exists::<(), K>(keys).await,
613 }
614 }
615
616 pub async fn hgetall<K>(&self, key: K) -> Result<(), Error>
621 where
622 K: Into<Key> + Send,
623 {
624 match self.segment().await? {
625 Segment::Plain(segment) => segment.hgetall::<(), K>(key).await,
626 Segment::Atomic(segment) => segment.hgetall::<(), K>(key).await,
627 }
628 }
629
630 pub async fn hdel<K, F>(&self, key: K, fields: F) -> Result<(), Error>
635 where
636 K: Into<Key> + Send,
637 F: Into<MultipleKeys> + Send,
638 {
639 match self.segment().await? {
640 Segment::Plain(segment) => segment.hdel::<(), K, F>(key, fields).await,
641 Segment::Atomic(segment) => segment.hdel::<(), K, F>(key, fields).await,
642 }
643 }
644
645 pub async fn hexists<K, F>(&self, key: K, field: F) -> Result<(), Error>
650 where
651 K: Into<Key> + Send,
652 F: Into<Key> + Send,
653 {
654 match self.segment().await? {
655 Segment::Plain(segment) => segment.hexists::<(), K, F>(key, field).await,
656 Segment::Atomic(segment) => segment.hexists::<(), K, F>(key, field).await,
657 }
658 }
659
660 pub async fn hget<K, F>(&self, key: K, field: F) -> Result<(), Error>
665 where
666 K: Into<Key> + Send,
667 F: Into<Key> + Send,
668 {
669 match self.segment().await? {
670 Segment::Plain(segment) => segment.hget::<(), K, F>(key, field).await,
671 Segment::Atomic(segment) => segment.hget::<(), K, F>(key, field).await,
672 }
673 }
674
675 pub async fn hincrby<K, F>(&self, key: K, field: F, increment: i64) -> Result<(), Error>
680 where
681 K: Into<Key> + Send,
682 F: Into<Key> + Send,
683 {
684 match self.segment().await? {
685 Segment::Plain(segment) => segment.hincrby::<(), K, F>(key, field, increment).await,
686 Segment::Atomic(segment) => segment.hincrby::<(), K, F>(key, field, increment).await,
687 }
688 }
689
690 pub async fn hincrbyfloat<K, F>(&self, key: K, field: F, increment: f64) -> Result<(), Error>
695 where
696 K: Into<Key> + Send,
697 F: Into<Key> + Send,
698 {
699 match self.segment().await? {
700 Segment::Plain(segment) => {
701 segment
702 .hincrbyfloat::<(), K, F>(key, field, increment)
703 .await
704 }
705 Segment::Atomic(segment) => {
706 segment
707 .hincrbyfloat::<(), K, F>(key, field, increment)
708 .await
709 }
710 }
711 }
712
713 pub async fn hkeys<K>(&self, key: K) -> Result<(), Error>
718 where
719 K: Into<Key> + Send,
720 {
721 match self.segment().await? {
722 Segment::Plain(segment) => segment.hkeys::<(), K>(key).await,
723 Segment::Atomic(segment) => segment.hkeys::<(), K>(key).await,
724 }
725 }
726
727 pub async fn hlen<K>(&self, key: K) -> Result<(), Error>
732 where
733 K: Into<Key> + Send,
734 {
735 match self.segment().await? {
736 Segment::Plain(segment) => segment.hlen::<(), K>(key).await,
737 Segment::Atomic(segment) => segment.hlen::<(), K>(key).await,
738 }
739 }
740
741 pub async fn hmget<K, F>(&self, key: K, fields: F) -> Result<(), Error>
746 where
747 K: Into<Key> + Send,
748 F: Into<MultipleKeys> + Send,
749 {
750 match self.segment().await? {
751 Segment::Plain(segment) => segment.hmget::<(), K, F>(key, fields).await,
752 Segment::Atomic(segment) => segment.hmget::<(), K, F>(key, fields).await,
753 }
754 }
755
756 pub async fn hmset<K, V>(&self, key: K, values: V) -> Result<(), Error>
761 where
762 K: Into<Key> + Send,
763 V: TryInto<Map> + Send,
764 V::Error: Into<Error> + Send,
765 {
766 match self.segment().await? {
767 Segment::Plain(segment) => segment.hmset::<(), K, V>(key, values).await,
768 Segment::Atomic(segment) => segment.hmset::<(), K, V>(key, values).await,
769 }
770 }
771
772 pub async fn hset<K, V>(&self, key: K, values: V) -> Result<(), Error>
777 where
778 K: Into<Key> + Send,
779 V: TryInto<Map> + Send,
780 V::Error: Into<Error> + Send,
781 {
782 match self.segment().await? {
783 Segment::Plain(segment) => segment.hset::<(), K, V>(key, values).await,
784 Segment::Atomic(segment) => segment.hset::<(), K, V>(key, values).await,
785 }
786 }
787
788 pub async fn hsetnx<K, F, V>(&self, key: K, field: F, value: V) -> Result<(), Error>
793 where
794 K: Into<Key> + Send,
795 F: Into<Key> + Send,
796 V: TryInto<Value> + Send,
797 V::Error: Into<Error> + Send,
798 {
799 match self.segment().await? {
800 Segment::Plain(segment) => segment.hsetnx::<(), K, F, V>(key, field, value).await,
801 Segment::Atomic(segment) => segment.hsetnx::<(), K, F, V>(key, field, value).await,
802 }
803 }
804
805 pub async fn hrandfield<K>(&self, key: K, count: Option<(i64, bool)>) -> Result<(), Error>
810 where
811 K: Into<Key> + Send,
812 {
813 match self.segment().await? {
814 Segment::Plain(segment) => segment.hrandfield::<(), K>(key, count).await,
815 Segment::Atomic(segment) => segment.hrandfield::<(), K>(key, count).await,
816 }
817 }
818
819 pub async fn hstrlen<K, F>(&self, key: K, field: F) -> Result<(), Error>
824 where
825 K: Into<Key> + Send,
826 F: Into<Key> + Send,
827 {
828 match self.segment().await? {
829 Segment::Plain(segment) => segment.hstrlen::<(), K, F>(key, field).await,
830 Segment::Atomic(segment) => segment.hstrlen::<(), K, F>(key, field).await,
831 }
832 }
833
834 pub async fn hvals<K>(&self, key: K) -> Result<(), Error>
839 where
840 K: Into<Key> + Send,
841 {
842 match self.segment().await? {
843 Segment::Plain(segment) => segment.hvals::<(), K>(key).await,
844 Segment::Atomic(segment) => segment.hvals::<(), K>(key).await,
845 }
846 }
847
848 pub async fn lmpop<K>(
853 &self,
854 keys: K,
855 direction: LMoveDirection,
856 count: Option<i64>,
857 ) -> Result<(), Error>
858 where
859 K: Into<MultipleKeys> + Send,
860 {
861 match self.segment().await? {
862 Segment::Plain(segment) => segment.lmpop::<(), K>(keys, direction, count).await,
863 Segment::Atomic(segment) => segment.lmpop::<(), K>(keys, direction, count).await,
864 }
865 }
866
867 pub async fn lindex<K>(&self, key: K, index: i64) -> Result<(), Error>
872 where
873 K: Into<Key> + Send,
874 {
875 match self.segment().await? {
876 Segment::Plain(segment) => segment.lindex::<(), K>(key, index).await,
877 Segment::Atomic(segment) => segment.lindex::<(), K>(key, index).await,
878 }
879 }
880
881 pub async fn linsert<K, P, V>(
886 &self,
887 key: K,
888 location: ListLocation,
889 pivot: P,
890 element: V,
891 ) -> Result<(), Error>
892 where
893 K: Into<Key> + Send,
894 P: TryInto<Value> + Send,
895 P::Error: Into<Error> + Send,
896 V: TryInto<Value> + Send,
897 V::Error: Into<Error> + Send,
898 {
899 match self.segment().await? {
900 Segment::Plain(segment) => {
901 segment
902 .linsert::<(), K, P, V>(key, location, pivot, element)
903 .await
904 }
905 Segment::Atomic(segment) => {
906 segment
907 .linsert::<(), K, P, V>(key, location, pivot, element)
908 .await
909 }
910 }
911 }
912
913 pub async fn llen<K>(&self, key: K) -> Result<(), Error>
918 where
919 K: Into<Key> + Send,
920 {
921 match self.segment().await? {
922 Segment::Plain(segment) => segment.llen::<(), K>(key).await,
923 Segment::Atomic(segment) => segment.llen::<(), K>(key).await,
924 }
925 }
926
927 pub async fn lpop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
932 where
933 K: Into<Key> + Send,
934 {
935 match self.segment().await? {
936 Segment::Plain(segment) => segment.lpop::<(), K>(key, count).await,
937 Segment::Atomic(segment) => segment.lpop::<(), K>(key, count).await,
938 }
939 }
940
941 pub async fn lpos<K, V>(
946 &self,
947 key: K,
948 element: V,
949 rank: Option<i64>,
950 count: Option<i64>,
951 maxlen: Option<i64>,
952 ) -> Result<(), Error>
953 where
954 K: Into<Key> + Send,
955 V: TryInto<Value> + Send,
956 V::Error: Into<Error> + Send,
957 {
958 match self.segment().await? {
959 Segment::Plain(segment) => {
960 segment
961 .lpos::<(), K, V>(key, element, rank, count, maxlen)
962 .await
963 }
964 Segment::Atomic(segment) => {
965 segment
966 .lpos::<(), K, V>(key, element, rank, count, maxlen)
967 .await
968 }
969 }
970 }
971
972 pub async fn lpush<K, V>(&self, key: K, elements: V) -> Result<(), Error>
977 where
978 K: Into<Key> + Send,
979 V: TryInto<MultipleValues> + Send,
980 V::Error: Into<Error> + Send,
981 {
982 match self.segment().await? {
983 Segment::Plain(segment) => segment.lpush::<(), K, V>(key, elements).await,
984 Segment::Atomic(segment) => segment.lpush::<(), K, V>(key, elements).await,
985 }
986 }
987
988 pub async fn lpushx<K, V>(&self, key: K, elements: V) -> Result<(), Error>
993 where
994 K: Into<Key> + Send,
995 V: TryInto<MultipleValues> + Send,
996 V::Error: Into<Error> + Send,
997 {
998 match self.segment().await? {
999 Segment::Plain(segment) => segment.lpushx::<(), K, V>(key, elements).await,
1000 Segment::Atomic(segment) => segment.lpushx::<(), K, V>(key, elements).await,
1001 }
1002 }
1003
1004 pub async fn lrange<K>(&self, key: K, start: i64, stop: i64) -> Result<(), Error>
1009 where
1010 K: Into<Key> + Send,
1011 {
1012 match self.segment().await? {
1013 Segment::Plain(segment) => segment.lrange::<(), K>(key, start, stop).await,
1014 Segment::Atomic(segment) => segment.lrange::<(), K>(key, start, stop).await,
1015 }
1016 }
1017
1018 pub async fn lrem<K, V>(&self, key: K, count: i64, element: V) -> Result<(), Error>
1023 where
1024 K: Into<Key> + Send,
1025 V: TryInto<Value> + Send,
1026 V::Error: Into<Error> + Send,
1027 {
1028 match self.segment().await? {
1029 Segment::Plain(segment) => segment.lrem::<(), K, V>(key, count, element).await,
1030 Segment::Atomic(segment) => segment.lrem::<(), K, V>(key, count, element).await,
1031 }
1032 }
1033
1034 pub async fn lset<K, V>(&self, key: K, index: i64, element: V) -> Result<(), Error>
1039 where
1040 K: Into<Key> + Send,
1041 V: TryInto<Value> + Send,
1042 V::Error: Into<Error> + Send,
1043 {
1044 match self.segment().await? {
1045 Segment::Plain(segment) => segment.lset::<(), K, V>(key, index, element).await,
1046 Segment::Atomic(segment) => segment.lset::<(), K, V>(key, index, element).await,
1047 }
1048 }
1049
1050 pub async fn ltrim<K>(&self, key: K, start: i64, stop: i64) -> Result<(), Error>
1055 where
1056 K: Into<Key> + Send,
1057 {
1058 match self.segment().await? {
1059 Segment::Plain(segment) => segment.ltrim::<(), K>(key, start, stop).await,
1060 Segment::Atomic(segment) => segment.ltrim::<(), K>(key, start, stop).await,
1061 }
1062 }
1063
1064 pub async fn rpop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
1069 where
1070 K: Into<Key> + Send,
1071 {
1072 match self.segment().await? {
1073 Segment::Plain(segment) => segment.rpop::<(), K>(key, count).await,
1074 Segment::Atomic(segment) => segment.rpop::<(), K>(key, count).await,
1075 }
1076 }
1077
1078 pub async fn rpoplpush<S, D>(&self, source: S, dest: D) -> Result<(), Error>
1083 where
1084 S: Into<Key> + Send,
1085 D: Into<Key> + Send,
1086 {
1087 match self.segment().await? {
1088 Segment::Plain(segment) => segment.rpoplpush::<(), S, D>(source, dest).await,
1089 Segment::Atomic(segment) => segment.rpoplpush::<(), S, D>(source, dest).await,
1090 }
1091 }
1092
1093 pub async fn lmove<S, D>(
1098 &self,
1099 source: S,
1100 dest: D,
1101 source_direction: LMoveDirection,
1102 dest_direction: LMoveDirection,
1103 ) -> Result<(), Error>
1104 where
1105 S: Into<Key> + Send,
1106 D: Into<Key> + Send,
1107 {
1108 match self.segment().await? {
1109 Segment::Plain(segment) => {
1110 segment
1111 .lmove::<(), S, D>(source, dest, source_direction, dest_direction)
1112 .await
1113 }
1114 Segment::Atomic(segment) => {
1115 segment
1116 .lmove::<(), S, D>(source, dest, source_direction, dest_direction)
1117 .await
1118 }
1119 }
1120 }
1121
1122 pub async fn rpush<K, V>(&self, key: K, elements: V) -> Result<(), Error>
1127 where
1128 K: Into<Key> + Send,
1129 V: TryInto<MultipleValues> + Send,
1130 V::Error: Into<Error> + Send,
1131 {
1132 match self.segment().await? {
1133 Segment::Plain(segment) => segment.rpush::<(), K, V>(key, elements).await,
1134 Segment::Atomic(segment) => segment.rpush::<(), K, V>(key, elements).await,
1135 }
1136 }
1137
1138 pub async fn rpushx<K, V>(&self, key: K, elements: V) -> Result<(), Error>
1143 where
1144 K: Into<Key> + Send,
1145 V: TryInto<MultipleValues> + Send,
1146 V::Error: Into<Error> + Send,
1147 {
1148 match self.segment().await? {
1149 Segment::Plain(segment) => segment.rpushx::<(), K, V>(key, elements).await,
1150 Segment::Atomic(segment) => segment.rpushx::<(), K, V>(key, elements).await,
1151 }
1152 }
1153
1154 pub async fn sort<K, S>(
1159 &self,
1160 key: K,
1161 by: Option<Str>,
1162 limit: Option<Limit>,
1163 get: S,
1164 order: Option<SortOrder>,
1165 alpha: bool,
1166 store: Option<Key>,
1167 ) -> Result<(), Error>
1168 where
1169 K: Into<Key> + Send,
1170 S: Into<MultipleStrings> + Send,
1171 {
1172 match self.segment().await? {
1173 Segment::Plain(segment) => {
1174 segment
1175 .sort::<(), K, S>(key, by, limit, get, order, alpha, store)
1176 .await
1177 }
1178 Segment::Atomic(segment) => {
1179 segment
1180 .sort::<(), K, S>(key, by, limit, get, order, alpha, store)
1181 .await
1182 }
1183 }
1184 }
1185
1186 pub async fn sort_ro<K, S>(
1191 &self,
1192 key: K,
1193 by: Option<Str>,
1194 limit: Option<Limit>,
1195 get: S,
1196 order: Option<SortOrder>,
1197 alpha: bool,
1198 ) -> Result<(), Error>
1199 where
1200 K: Into<Key> + Send,
1201 S: Into<MultipleStrings> + Send,
1202 {
1203 match self.segment().await? {
1204 Segment::Plain(segment) => {
1205 segment
1206 .sort_ro::<(), K, S>(key, by, limit, get, order, alpha)
1207 .await
1208 }
1209 Segment::Atomic(segment) => {
1210 segment
1211 .sort_ro::<(), K, S>(key, by, limit, get, order, alpha)
1212 .await
1213 }
1214 }
1215 }
1216
1217 pub async fn sadd<K, V>(&self, key: K, members: V) -> Result<(), Error>
1222 where
1223 K: Into<Key> + Send,
1224 V: TryInto<MultipleValues> + Send,
1225 V::Error: Into<Error> + Send,
1226 {
1227 match self.segment().await? {
1228 Segment::Plain(segment) => segment.sadd::<(), K, V>(key, members).await,
1229 Segment::Atomic(segment) => segment.sadd::<(), K, V>(key, members).await,
1230 }
1231 }
1232
1233 pub async fn scard<K>(&self, key: K) -> Result<(), Error>
1238 where
1239 K: Into<Key> + Send,
1240 {
1241 match self.segment().await? {
1242 Segment::Plain(segment) => segment.scard::<(), K>(key).await,
1243 Segment::Atomic(segment) => segment.scard::<(), K>(key).await,
1244 }
1245 }
1246
1247 pub async fn sdiff<K>(&self, keys: K) -> Result<(), Error>
1252 where
1253 K: Into<MultipleKeys> + Send,
1254 {
1255 match self.segment().await? {
1256 Segment::Plain(segment) => segment.sdiff::<(), K>(keys).await,
1257 Segment::Atomic(segment) => segment.sdiff::<(), K>(keys).await,
1258 }
1259 }
1260
1261 pub async fn sdiffstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
1266 where
1267 D: Into<Key> + Send,
1268 K: Into<MultipleKeys> + Send,
1269 {
1270 match self.segment().await? {
1271 Segment::Plain(segment) => segment.sdiffstore::<(), D, K>(dest, keys).await,
1272 Segment::Atomic(segment) => segment.sdiffstore::<(), D, K>(dest, keys).await,
1273 }
1274 }
1275
1276 pub async fn sinter<K>(&self, keys: K) -> Result<(), Error>
1281 where
1282 K: Into<MultipleKeys> + Send,
1283 {
1284 match self.segment().await? {
1285 Segment::Plain(segment) => segment.sinter::<(), K>(keys).await,
1286 Segment::Atomic(segment) => segment.sinter::<(), K>(keys).await,
1287 }
1288 }
1289
1290 pub async fn sinterstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
1295 where
1296 D: Into<Key> + Send,
1297 K: Into<MultipleKeys> + Send,
1298 {
1299 match self.segment().await? {
1300 Segment::Plain(segment) => segment.sinterstore::<(), D, K>(dest, keys).await,
1301 Segment::Atomic(segment) => segment.sinterstore::<(), D, K>(dest, keys).await,
1302 }
1303 }
1304
1305 pub async fn sismember<K, V>(&self, key: K, member: V) -> Result<(), Error>
1310 where
1311 K: Into<Key> + Send,
1312 V: TryInto<Value> + Send,
1313 V::Error: Into<Error> + Send,
1314 {
1315 match self.segment().await? {
1316 Segment::Plain(segment) => segment.sismember::<(), K, V>(key, member).await,
1317 Segment::Atomic(segment) => segment.sismember::<(), K, V>(key, member).await,
1318 }
1319 }
1320
1321 pub async fn smismember<K, V>(&self, key: K, members: V) -> Result<(), Error>
1326 where
1327 K: Into<Key> + Send,
1328 V: TryInto<MultipleValues> + Send,
1329 V::Error: Into<Error> + Send,
1330 {
1331 match self.segment().await? {
1332 Segment::Plain(segment) => segment.smismember::<(), K, V>(key, members).await,
1333 Segment::Atomic(segment) => segment.smismember::<(), K, V>(key, members).await,
1334 }
1335 }
1336
1337 pub async fn smembers<K>(&self, key: K) -> Result<(), Error>
1342 where
1343 K: Into<Key> + Send,
1344 {
1345 match self.segment().await? {
1346 Segment::Plain(segment) => segment.smembers::<(), K>(key).await,
1347 Segment::Atomic(segment) => segment.smembers::<(), K>(key).await,
1348 }
1349 }
1350
1351 pub async fn smove<S, D, V>(&self, source: S, dest: D, member: V) -> Result<(), Error>
1356 where
1357 S: Into<Key> + Send,
1358 D: Into<Key> + Send,
1359 V: TryInto<Value> + Send,
1360 V::Error: Into<Error> + Send,
1361 {
1362 match self.segment().await? {
1363 Segment::Plain(segment) => segment.smove::<(), S, D, V>(source, dest, member).await,
1364 Segment::Atomic(segment) => segment.smove::<(), S, D, V>(source, dest, member).await,
1365 }
1366 }
1367
1368 pub async fn spop<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
1373 where
1374 K: Into<Key> + Send,
1375 {
1376 match self.segment().await? {
1377 Segment::Plain(segment) => segment.spop::<(), K>(key, count).await,
1378 Segment::Atomic(segment) => segment.spop::<(), K>(key, count).await,
1379 }
1380 }
1381
1382 pub async fn srandmember<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
1387 where
1388 K: Into<Key> + Send,
1389 {
1390 match self.segment().await? {
1391 Segment::Plain(segment) => segment.srandmember::<(), K>(key, count).await,
1392 Segment::Atomic(segment) => segment.srandmember::<(), K>(key, count).await,
1393 }
1394 }
1395
1396 pub async fn srem<K, V>(&self, key: K, members: V) -> Result<(), Error>
1401 where
1402 K: Into<Key> + Send,
1403 V: TryInto<MultipleValues> + Send,
1404 V::Error: Into<Error> + Send,
1405 {
1406 match self.segment().await? {
1407 Segment::Plain(segment) => segment.srem::<(), K, V>(key, members).await,
1408 Segment::Atomic(segment) => segment.srem::<(), K, V>(key, members).await,
1409 }
1410 }
1411
1412 pub async fn sunion<K>(&self, keys: K) -> Result<(), Error>
1417 where
1418 K: Into<MultipleKeys> + Send,
1419 {
1420 match self.segment().await? {
1421 Segment::Plain(segment) => segment.sunion::<(), K>(keys).await,
1422 Segment::Atomic(segment) => segment.sunion::<(), K>(keys).await,
1423 }
1424 }
1425
1426 pub async fn sunionstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
1431 where
1432 D: Into<Key> + Send,
1433 K: Into<MultipleKeys> + Send,
1434 {
1435 match self.segment().await? {
1436 Segment::Plain(segment) => segment.sunionstore::<(), D, K>(dest, keys).await,
1437 Segment::Atomic(segment) => segment.sunionstore::<(), D, K>(dest, keys).await,
1438 }
1439 }
1440
1441 pub async fn zadd<K, V>(
1446 &self,
1447 key: K,
1448 options: Option<SetOptions>,
1449 ordering: Option<Ordering>,
1450 changed: bool,
1451 incr: bool,
1452 values: V,
1453 ) -> Result<(), Error>
1454 where
1455 K: Into<Key> + Send,
1456 V: TryInto<MultipleZaddValues> + Send,
1457 V::Error: Into<Error> + Send,
1458 {
1459 match self.segment().await? {
1460 Segment::Plain(segment) => {
1461 segment
1462 .zadd::<(), K, V>(key, options, ordering, changed, incr, values)
1463 .await
1464 }
1465 Segment::Atomic(segment) => {
1466 segment
1467 .zadd::<(), K, V>(key, options, ordering, changed, incr, values)
1468 .await
1469 }
1470 }
1471 }
1472
1473 pub async fn zcard<K>(&self, key: K) -> Result<(), Error>
1478 where
1479 K: Into<Key> + Send,
1480 {
1481 match self.segment().await? {
1482 Segment::Plain(segment) => segment.zcard::<(), K>(key).await,
1483 Segment::Atomic(segment) => segment.zcard::<(), K>(key).await,
1484 }
1485 }
1486
1487 pub async fn zcount<K>(&self, key: K, min: f64, max: f64) -> Result<(), Error>
1492 where
1493 K: Into<Key> + Send,
1494 {
1495 match self.segment().await? {
1496 Segment::Plain(segment) => segment.zcount::<(), K>(key, min, max).await,
1497 Segment::Atomic(segment) => segment.zcount::<(), K>(key, min, max).await,
1498 }
1499 }
1500
1501 pub async fn zdiff<K>(&self, keys: K, withscores: bool) -> Result<(), Error>
1506 where
1507 K: Into<MultipleKeys> + Send,
1508 {
1509 match self.segment().await? {
1510 Segment::Plain(segment) => segment.zdiff::<(), K>(keys, withscores).await,
1511 Segment::Atomic(segment) => segment.zdiff::<(), K>(keys, withscores).await,
1512 }
1513 }
1514
1515 pub async fn zdiffstore<D, K>(&self, dest: D, keys: K) -> Result<(), Error>
1520 where
1521 D: Into<Key> + Send,
1522 K: Into<MultipleKeys> + Send,
1523 {
1524 match self.segment().await? {
1525 Segment::Plain(segment) => segment.zdiffstore::<(), D, K>(dest, keys).await,
1526 Segment::Atomic(segment) => segment.zdiffstore::<(), D, K>(dest, keys).await,
1527 }
1528 }
1529
1530 pub async fn zincrby<K, V>(&self, key: K, increment: f64, member: V) -> Result<(), Error>
1535 where
1536 K: Into<Key> + Send,
1537 V: TryInto<Value> + Send,
1538 V::Error: Into<Error> + Send,
1539 {
1540 match self.segment().await? {
1541 Segment::Plain(segment) => segment.zincrby::<(), K, V>(key, increment, member).await,
1542 Segment::Atomic(segment) => segment.zincrby::<(), K, V>(key, increment, member).await,
1543 }
1544 }
1545
1546 pub async fn zinter<K, W>(
1551 &self,
1552 keys: K,
1553 weights: W,
1554 aggregate: Option<AggregateOptions>,
1555 withscores: bool,
1556 ) -> Result<(), Error>
1557 where
1558 K: Into<MultipleKeys> + Send,
1559 W: Into<MultipleWeights> + Send,
1560 {
1561 match self.segment().await? {
1562 Segment::Plain(segment) => {
1563 segment
1564 .zinter::<(), K, W>(keys, weights, aggregate, withscores)
1565 .await
1566 }
1567 Segment::Atomic(segment) => {
1568 segment
1569 .zinter::<(), K, W>(keys, weights, aggregate, withscores)
1570 .await
1571 }
1572 }
1573 }
1574
1575 pub async fn zinterstore<D, K, W>(
1580 &self,
1581 dest: D,
1582 keys: K,
1583 weights: W,
1584 aggregate: Option<AggregateOptions>,
1585 ) -> Result<(), Error>
1586 where
1587 D: Into<Key> + Send,
1588 K: Into<MultipleKeys> + Send,
1589 W: Into<MultipleWeights> + Send,
1590 {
1591 match self.segment().await? {
1592 Segment::Plain(segment) => {
1593 segment
1594 .zinterstore::<(), D, K, W>(dest, keys, weights, aggregate)
1595 .await
1596 }
1597 Segment::Atomic(segment) => {
1598 segment
1599 .zinterstore::<(), D, K, W>(dest, keys, weights, aggregate)
1600 .await
1601 }
1602 }
1603 }
1604
1605 pub async fn zlexcount<K, M, N>(&self, key: K, min: M, max: N) -> Result<(), Error>
1610 where
1611 K: Into<Key> + Send,
1612 M: TryInto<ZRange> + Send,
1613 M::Error: Into<Error> + Send,
1614 N: TryInto<ZRange> + Send,
1615 N::Error: Into<Error> + Send,
1616 {
1617 match self.segment().await? {
1618 Segment::Plain(segment) => segment.zlexcount::<(), K, M, N>(key, min, max).await,
1619 Segment::Atomic(segment) => segment.zlexcount::<(), K, M, N>(key, min, max).await,
1620 }
1621 }
1622
1623 pub async fn zpopmax<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
1628 where
1629 K: Into<Key> + Send,
1630 {
1631 match self.segment().await? {
1632 Segment::Plain(segment) => segment.zpopmax::<(), K>(key, count).await,
1633 Segment::Atomic(segment) => segment.zpopmax::<(), K>(key, count).await,
1634 }
1635 }
1636
1637 pub async fn zpopmin<K>(&self, key: K, count: Option<usize>) -> Result<(), Error>
1642 where
1643 K: Into<Key> + Send,
1644 {
1645 match self.segment().await? {
1646 Segment::Plain(segment) => segment.zpopmin::<(), K>(key, count).await,
1647 Segment::Atomic(segment) => segment.zpopmin::<(), K>(key, count).await,
1648 }
1649 }
1650
1651 pub async fn zmpop<K>(&self, keys: K, sort: ZCmp, count: Option<i64>) -> Result<(), Error>
1656 where
1657 K: Into<MultipleKeys> + Send,
1658 {
1659 match self.segment().await? {
1660 Segment::Plain(segment) => segment.zmpop::<(), K>(keys, sort, count).await,
1661 Segment::Atomic(segment) => segment.zmpop::<(), K>(keys, sort, count).await,
1662 }
1663 }
1664
1665 pub async fn zrandmember<K>(&self, key: K, count: Option<(i64, bool)>) -> Result<(), Error>
1670 where
1671 K: Into<Key> + Send,
1672 {
1673 match self.segment().await? {
1674 Segment::Plain(segment) => segment.zrandmember::<(), K>(key, count).await,
1675 Segment::Atomic(segment) => segment.zrandmember::<(), K>(key, count).await,
1676 }
1677 }
1678
1679 pub async fn zrangestore<D, S, M, N>(
1684 &self,
1685 dest: D,
1686 source: S,
1687 min: M,
1688 max: N,
1689 sort: Option<ZSort>,
1690 rev: bool,
1691 limit: Option<Limit>,
1692 ) -> Result<(), Error>
1693 where
1694 D: Into<Key> + Send,
1695 S: Into<Key> + Send,
1696 M: TryInto<ZRange> + Send,
1697 M::Error: Into<Error> + Send,
1698 N: TryInto<ZRange> + Send,
1699 N::Error: Into<Error> + Send,
1700 {
1701 match self.segment().await? {
1702 Segment::Plain(segment) => {
1703 segment
1704 .zrangestore::<(), D, S, M, N>(dest, source, min, max, sort, rev, limit)
1705 .await
1706 }
1707 Segment::Atomic(segment) => {
1708 segment
1709 .zrangestore::<(), D, S, M, N>(dest, source, min, max, sort, rev, limit)
1710 .await
1711 }
1712 }
1713 }
1714
1715 pub async fn zrange<K, M, N>(
1720 &self,
1721 key: K,
1722 min: M,
1723 max: N,
1724 sort: Option<ZSort>,
1725 rev: bool,
1726 limit: Option<Limit>,
1727 withscores: bool,
1728 ) -> Result<(), Error>
1729 where
1730 K: Into<Key> + Send,
1731 M: TryInto<ZRange> + Send,
1732 M::Error: Into<Error> + Send,
1733 N: TryInto<ZRange> + Send,
1734 N::Error: Into<Error> + Send,
1735 {
1736 match self.segment().await? {
1737 Segment::Plain(segment) => {
1738 segment
1739 .zrange::<(), K, M, N>(key, min, max, sort, rev, limit, withscores)
1740 .await
1741 }
1742 Segment::Atomic(segment) => {
1743 segment
1744 .zrange::<(), K, M, N>(key, min, max, sort, rev, limit, withscores)
1745 .await
1746 }
1747 }
1748 }
1749
1750 pub async fn zrangebylex<K, M, N>(
1755 &self,
1756 key: K,
1757 min: M,
1758 max: N,
1759 limit: Option<Limit>,
1760 ) -> Result<(), Error>
1761 where
1762 K: Into<Key> + Send,
1763 M: TryInto<ZRange> + Send,
1764 M::Error: Into<Error> + Send,
1765 N: TryInto<ZRange> + Send,
1766 N::Error: Into<Error> + Send,
1767 {
1768 match self.segment().await? {
1769 Segment::Plain(segment) => {
1770 segment
1771 .zrangebylex::<(), K, M, N>(key, min, max, limit)
1772 .await
1773 }
1774 Segment::Atomic(segment) => {
1775 segment
1776 .zrangebylex::<(), K, M, N>(key, min, max, limit)
1777 .await
1778 }
1779 }
1780 }
1781
1782 pub async fn zrevrangebylex<K, M, N>(
1787 &self,
1788 key: K,
1789 max: M,
1790 min: N,
1791 limit: Option<Limit>,
1792 ) -> Result<(), Error>
1793 where
1794 K: Into<Key> + Send,
1795 M: TryInto<ZRange> + Send,
1796 M::Error: Into<Error> + Send,
1797 N: TryInto<ZRange> + Send,
1798 N::Error: Into<Error> + Send,
1799 {
1800 match self.segment().await? {
1801 Segment::Plain(segment) => {
1802 segment
1803 .zrevrangebylex::<(), K, M, N>(key, max, min, limit)
1804 .await
1805 }
1806 Segment::Atomic(segment) => {
1807 segment
1808 .zrevrangebylex::<(), K, M, N>(key, max, min, limit)
1809 .await
1810 }
1811 }
1812 }
1813
1814 pub async fn zrangebyscore<K, M, N>(
1819 &self,
1820 key: K,
1821 min: M,
1822 max: N,
1823 withscores: bool,
1824 limit: Option<Limit>,
1825 ) -> Result<(), Error>
1826 where
1827 K: Into<Key> + Send,
1828 M: TryInto<ZRange> + Send,
1829 M::Error: Into<Error> + Send,
1830 N: TryInto<ZRange> + Send,
1831 N::Error: Into<Error> + Send,
1832 {
1833 match self.segment().await? {
1834 Segment::Plain(segment) => {
1835 segment
1836 .zrangebyscore::<(), K, M, N>(key, min, max, withscores, limit)
1837 .await
1838 }
1839 Segment::Atomic(segment) => {
1840 segment
1841 .zrangebyscore::<(), K, M, N>(key, min, max, withscores, limit)
1842 .await
1843 }
1844 }
1845 }
1846
1847 pub async fn zrevrangebyscore<K, M, N>(
1852 &self,
1853 key: K,
1854 max: M,
1855 min: N,
1856 withscores: bool,
1857 limit: Option<Limit>,
1858 ) -> Result<(), Error>
1859 where
1860 K: Into<Key> + Send,
1861 M: TryInto<ZRange> + Send,
1862 M::Error: Into<Error> + Send,
1863 N: TryInto<ZRange> + Send,
1864 N::Error: Into<Error> + Send,
1865 {
1866 match self.segment().await? {
1867 Segment::Plain(segment) => {
1868 segment
1869 .zrevrangebyscore::<(), K, M, N>(key, max, min, withscores, limit)
1870 .await
1871 }
1872 Segment::Atomic(segment) => {
1873 segment
1874 .zrevrangebyscore::<(), K, M, N>(key, max, min, withscores, limit)
1875 .await
1876 }
1877 }
1878 }
1879
1880 pub async fn zrank<K, V>(&self, key: K, member: V, withscore: bool) -> Result<(), Error>
1885 where
1886 K: Into<Key> + Send,
1887 V: TryInto<Value> + Send,
1888 V::Error: Into<Error> + Send,
1889 {
1890 match self.segment().await? {
1891 Segment::Plain(segment) => segment.zrank::<(), K, V>(key, member, withscore).await,
1892 Segment::Atomic(segment) => segment.zrank::<(), K, V>(key, member, withscore).await,
1893 }
1894 }
1895
1896 pub async fn zrem<K, V>(&self, key: K, members: V) -> Result<(), Error>
1901 where
1902 K: Into<Key> + Send,
1903 V: TryInto<MultipleValues> + Send,
1904 V::Error: Into<Error> + Send,
1905 {
1906 match self.segment().await? {
1907 Segment::Plain(segment) => segment.zrem::<(), K, V>(key, members).await,
1908 Segment::Atomic(segment) => segment.zrem::<(), K, V>(key, members).await,
1909 }
1910 }
1911
1912 pub async fn zremrangebylex<K, M, N>(&self, key: K, min: M, max: N) -> Result<(), Error>
1917 where
1918 K: Into<Key> + Send,
1919 M: TryInto<ZRange> + Send,
1920 M::Error: Into<Error> + Send,
1921 N: TryInto<ZRange> + Send,
1922 N::Error: Into<Error> + Send,
1923 {
1924 match self.segment().await? {
1925 Segment::Plain(segment) => segment.zremrangebylex::<(), K, M, N>(key, min, max).await,
1926 Segment::Atomic(segment) => segment.zremrangebylex::<(), K, M, N>(key, min, max).await,
1927 }
1928 }
1929
1930 pub async fn zremrangebyrank<K>(&self, key: K, start: i64, stop: i64) -> Result<(), Error>
1935 where
1936 K: Into<Key> + Send,
1937 {
1938 match self.segment().await? {
1939 Segment::Plain(segment) => segment.zremrangebyrank::<(), K>(key, start, stop).await,
1940 Segment::Atomic(segment) => segment.zremrangebyrank::<(), K>(key, start, stop).await,
1941 }
1942 }
1943
1944 pub async fn zremrangebyscore<K, M, N>(&self, key: K, min: M, max: N) -> Result<(), Error>
1949 where
1950 K: Into<Key> + Send,
1951 M: TryInto<ZRange> + Send,
1952 M::Error: Into<Error> + Send,
1953 N: TryInto<ZRange> + Send,
1954 N::Error: Into<Error> + Send,
1955 {
1956 match self.segment().await? {
1957 Segment::Plain(segment) => segment.zremrangebyscore::<(), K, M, N>(key, min, max).await,
1958 Segment::Atomic(segment) => {
1959 segment.zremrangebyscore::<(), K, M, N>(key, min, max).await
1960 }
1961 }
1962 }
1963
1964 pub async fn zrevrange<K>(
1969 &self,
1970 key: K,
1971 start: i64,
1972 stop: i64,
1973 withscores: bool,
1974 ) -> Result<(), Error>
1975 where
1976 K: Into<Key> + Send,
1977 {
1978 match self.segment().await? {
1979 Segment::Plain(segment) => {
1980 segment
1981 .zrevrange::<(), K>(key, start, stop, withscores)
1982 .await
1983 }
1984 Segment::Atomic(segment) => {
1985 segment
1986 .zrevrange::<(), K>(key, start, stop, withscores)
1987 .await
1988 }
1989 }
1990 }
1991
1992 pub async fn zrevrank<K, V>(&self, key: K, member: V, withscore: bool) -> Result<(), Error>
1997 where
1998 K: Into<Key> + Send,
1999 V: TryInto<Value> + Send,
2000 V::Error: Into<Error> + Send,
2001 {
2002 match self.segment().await? {
2003 Segment::Plain(segment) => segment.zrevrank::<(), K, V>(key, member, withscore).await,
2004 Segment::Atomic(segment) => segment.zrevrank::<(), K, V>(key, member, withscore).await,
2005 }
2006 }
2007
2008 pub async fn zscore<K, V>(&self, key: K, member: V) -> Result<(), Error>
2013 where
2014 K: Into<Key> + Send,
2015 V: TryInto<Value> + Send,
2016 V::Error: Into<Error> + Send,
2017 {
2018 match self.segment().await? {
2019 Segment::Plain(segment) => segment.zscore::<(), K, V>(key, member).await,
2020 Segment::Atomic(segment) => segment.zscore::<(), K, V>(key, member).await,
2021 }
2022 }
2023
2024 pub async fn zunion<K, W>(
2029 &self,
2030 keys: K,
2031 weights: W,
2032 aggregate: Option<AggregateOptions>,
2033 withscores: bool,
2034 ) -> Result<(), Error>
2035 where
2036 K: Into<MultipleKeys> + Send,
2037 W: Into<MultipleWeights> + Send,
2038 {
2039 match self.segment().await? {
2040 Segment::Plain(segment) => {
2041 segment
2042 .zunion::<(), K, W>(keys, weights, aggregate, withscores)
2043 .await
2044 }
2045 Segment::Atomic(segment) => {
2046 segment
2047 .zunion::<(), K, W>(keys, weights, aggregate, withscores)
2048 .await
2049 }
2050 }
2051 }
2052
2053 pub async fn zunionstore<D, K, W>(
2058 &self,
2059 dest: D,
2060 keys: K,
2061 weights: W,
2062 aggregate: Option<AggregateOptions>,
2063 ) -> Result<(), Error>
2064 where
2065 D: Into<Key> + Send,
2066 K: Into<MultipleKeys> + Send,
2067 W: Into<MultipleWeights> + Send,
2068 {
2069 match self.segment().await? {
2070 Segment::Plain(segment) => {
2071 segment
2072 .zunionstore::<(), D, K, W>(dest, keys, weights, aggregate)
2073 .await
2074 }
2075 Segment::Atomic(segment) => {
2076 segment
2077 .zunionstore::<(), D, K, W>(dest, keys, weights, aggregate)
2078 .await
2079 }
2080 }
2081 }
2082
2083 pub async fn zmscore<K, V>(&self, key: K, members: V) -> Result<(), Error>
2088 where
2089 K: Into<Key> + Send,
2090 V: TryInto<MultipleValues> + Send,
2091 V::Error: Into<Error> + Send,
2092 {
2093 match self.segment().await? {
2094 Segment::Plain(segment) => segment.zmscore::<(), K, V>(key, members).await,
2095 Segment::Atomic(segment) => segment.zmscore::<(), K, V>(key, members).await,
2096 }
2097 }
2098
2099 pub async fn xinfo_consumers<K, S>(&self, key: K, groupname: S) -> Result<(), Error>
2104 where
2105 K: Into<Key> + Send,
2106 S: Into<Str> + Send,
2107 {
2108 match self.segment().await? {
2109 Segment::Plain(segment) => segment.xinfo_consumers::<(), K, S>(key, groupname).await,
2110 Segment::Atomic(segment) => segment.xinfo_consumers::<(), K, S>(key, groupname).await,
2111 }
2112 }
2113
2114 pub async fn xinfo_groups<K>(&self, key: K) -> Result<(), Error>
2119 where
2120 K: Into<Key> + Send,
2121 {
2122 match self.segment().await? {
2123 Segment::Plain(segment) => segment.xinfo_groups::<(), K>(key).await,
2124 Segment::Atomic(segment) => segment.xinfo_groups::<(), K>(key).await,
2125 }
2126 }
2127
2128 pub async fn xinfo_stream<K>(&self, key: K, full: bool, count: Option<u64>) -> Result<(), Error>
2133 where
2134 K: Into<Key> + Send,
2135 {
2136 match self.segment().await? {
2137 Segment::Plain(segment) => segment.xinfo_stream::<(), K>(key, full, count).await,
2138 Segment::Atomic(segment) => segment.xinfo_stream::<(), K>(key, full, count).await,
2139 }
2140 }
2141
2142 pub async fn xadd<K, C, I, F>(
2147 &self,
2148 key: K,
2149 nomkstream: bool,
2150 cap: C,
2151 id: I,
2152 fields: F,
2153 ) -> Result<(), Error>
2154 where
2155 K: Into<Key> + Send,
2156 I: Into<XID> + Send,
2157 F: TryInto<MultipleOrderedPairs> + Send,
2158 F::Error: Into<Error> + Send,
2159 C: TryInto<XCap> + Send,
2160 C::Error: Into<Error> + Send,
2161 {
2162 match self.segment().await? {
2163 Segment::Plain(segment) => {
2164 segment
2165 .xadd::<(), K, C, I, F>(key, nomkstream, cap, id, fields)
2166 .await
2167 }
2168 Segment::Atomic(segment) => {
2169 segment
2170 .xadd::<(), K, C, I, F>(key, nomkstream, cap, id, fields)
2171 .await
2172 }
2173 }
2174 }
2175
2176 pub async fn xtrim<K, C>(&self, key: K, cap: C) -> Result<(), Error>
2181 where
2182 K: Into<Key> + Send,
2183 C: TryInto<XCap> + Send,
2184 C::Error: Into<Error> + Send,
2185 {
2186 match self.segment().await? {
2187 Segment::Plain(segment) => segment.xtrim::<(), K, C>(key, cap).await,
2188 Segment::Atomic(segment) => segment.xtrim::<(), K, C>(key, cap).await,
2189 }
2190 }
2191
2192 pub async fn xdel<K, S>(&self, key: K, ids: S) -> Result<(), Error>
2197 where
2198 K: Into<Key> + Send,
2199 S: Into<MultipleStrings> + Send,
2200 {
2201 match self.segment().await? {
2202 Segment::Plain(segment) => segment.xdel::<(), K, S>(key, ids).await,
2203 Segment::Atomic(segment) => segment.xdel::<(), K, S>(key, ids).await,
2204 }
2205 }
2206
2207 pub async fn xrange<K, S, E>(
2212 &self,
2213 key: K,
2214 start: S,
2215 end: E,
2216 count: Option<u64>,
2217 ) -> Result<(), Error>
2218 where
2219 K: Into<Key> + Send,
2220 S: TryInto<Value> + Send,
2221 S::Error: Into<Error> + Send,
2222 E: TryInto<Value> + Send,
2223 E::Error: Into<Error> + Send,
2224 {
2225 match self.segment().await? {
2226 Segment::Plain(segment) => segment.xrange::<(), K, S, E>(key, start, end, count).await,
2227 Segment::Atomic(segment) => segment.xrange::<(), K, S, E>(key, start, end, count).await,
2228 }
2229 }
2230
2231 pub async fn xrevrange<K, S, E>(
2236 &self,
2237 key: K,
2238 end: E,
2239 start: S,
2240 count: Option<u64>,
2241 ) -> Result<(), Error>
2242 where
2243 K: Into<Key> + Send,
2244 S: TryInto<Value> + Send,
2245 S::Error: Into<Error> + Send,
2246 E: TryInto<Value> + Send,
2247 E::Error: Into<Error> + Send,
2248 {
2249 match self.segment().await? {
2250 Segment::Plain(segment) => {
2251 segment
2252 .xrevrange::<(), K, S, E>(key, end, start, count)
2253 .await
2254 }
2255 Segment::Atomic(segment) => {
2256 segment
2257 .xrevrange::<(), K, S, E>(key, end, start, count)
2258 .await
2259 }
2260 }
2261 }
2262
2263 pub async fn xlen<K>(&self, key: K) -> Result<(), Error>
2268 where
2269 K: Into<Key> + Send,
2270 {
2271 match self.segment().await? {
2272 Segment::Plain(segment) => segment.xlen::<(), K>(key).await,
2273 Segment::Atomic(segment) => segment.xlen::<(), K>(key).await,
2274 }
2275 }
2276
2277 pub async fn xgroup_create<K, S, I>(
2282 &self,
2283 key: K,
2284 groupname: S,
2285 id: I,
2286 mkstream: bool,
2287 ) -> Result<(), Error>
2288 where
2289 K: Into<Key> + Send,
2290 S: Into<Str> + Send,
2291 I: Into<XID> + Send,
2292 {
2293 match self.segment().await? {
2294 Segment::Plain(segment) => {
2295 segment
2296 .xgroup_create::<(), K, S, I>(key, groupname, id, mkstream)
2297 .await
2298 }
2299 Segment::Atomic(segment) => {
2300 segment
2301 .xgroup_create::<(), K, S, I>(key, groupname, id, mkstream)
2302 .await
2303 }
2304 }
2305 }
2306
2307 pub async fn xgroup_createconsumer<K, G, C>(
2312 &self,
2313 key: K,
2314 groupname: G,
2315 consumername: C,
2316 ) -> Result<(), Error>
2317 where
2318 K: Into<Key> + Send,
2319 G: Into<Str> + Send,
2320 C: Into<Str> + Send,
2321 {
2322 match self.segment().await? {
2323 Segment::Plain(segment) => {
2324 segment
2325 .xgroup_createconsumer::<(), K, G, C>(key, groupname, consumername)
2326 .await
2327 }
2328 Segment::Atomic(segment) => {
2329 segment
2330 .xgroup_createconsumer::<(), K, G, C>(key, groupname, consumername)
2331 .await
2332 }
2333 }
2334 }
2335
2336 pub async fn xgroup_delconsumer<K, G, C>(
2341 &self,
2342 key: K,
2343 groupname: G,
2344 consumername: C,
2345 ) -> Result<(), Error>
2346 where
2347 K: Into<Key> + Send,
2348 G: Into<Str> + Send,
2349 C: Into<Str> + Send,
2350 {
2351 match self.segment().await? {
2352 Segment::Plain(segment) => {
2353 segment
2354 .xgroup_delconsumer::<(), K, G, C>(key, groupname, consumername)
2355 .await
2356 }
2357 Segment::Atomic(segment) => {
2358 segment
2359 .xgroup_delconsumer::<(), K, G, C>(key, groupname, consumername)
2360 .await
2361 }
2362 }
2363 }
2364
2365 pub async fn xgroup_destroy<K, S>(&self, key: K, groupname: S) -> Result<(), Error>
2370 where
2371 K: Into<Key> + Send,
2372 S: Into<Str> + Send,
2373 {
2374 match self.segment().await? {
2375 Segment::Plain(segment) => segment.xgroup_destroy::<(), K, S>(key, groupname).await,
2376 Segment::Atomic(segment) => segment.xgroup_destroy::<(), K, S>(key, groupname).await,
2377 }
2378 }
2379
2380 pub async fn xgroup_setid<K, S, I>(&self, key: K, groupname: S, id: I) -> Result<(), Error>
2385 where
2386 K: Into<Key> + Send,
2387 S: Into<Str> + Send,
2388 I: Into<XID> + Send,
2389 {
2390 match self.segment().await? {
2391 Segment::Plain(segment) => {
2392 segment
2393 .xgroup_setid::<(), K, S, I>(key, groupname, id)
2394 .await
2395 }
2396 Segment::Atomic(segment) => {
2397 segment
2398 .xgroup_setid::<(), K, S, I>(key, groupname, id)
2399 .await
2400 }
2401 }
2402 }
2403
2404 pub async fn xack<K, G, I>(&self, key: K, group: G, ids: I) -> Result<(), Error>
2409 where
2410 K: Into<Key> + Send,
2411 G: Into<Str> + Send,
2412 I: Into<MultipleIDs> + Send,
2413 {
2414 match self.segment().await? {
2415 Segment::Plain(segment) => segment.xack::<(), K, G, I>(key, group, ids).await,
2416 Segment::Atomic(segment) => segment.xack::<(), K, G, I>(key, group, ids).await,
2417 }
2418 }
2419
2420 pub async fn xclaim<K, G, C, I>(
2425 &self,
2426 key: K,
2427 group: G,
2428 consumer: C,
2429 min_idle_time: u64,
2430 ids: I,
2431 idle: Option<u64>,
2432 time: Option<u64>,
2433 retry_count: Option<u64>,
2434 force: bool,
2435 justid: bool,
2436 ) -> Result<(), Error>
2437 where
2438 K: Into<Key> + Send,
2439 G: Into<Str> + Send,
2440 C: Into<Str> + Send,
2441 I: Into<MultipleIDs> + Send,
2442 {
2443 match self.segment().await? {
2444 Segment::Plain(segment) => {
2445 segment
2446 .xclaim::<(), K, G, C, I>(
2447 key,
2448 group,
2449 consumer,
2450 min_idle_time,
2451 ids,
2452 idle,
2453 time,
2454 retry_count,
2455 force,
2456 justid,
2457 )
2458 .await
2459 }
2460 Segment::Atomic(segment) => {
2461 segment
2462 .xclaim::<(), K, G, C, I>(
2463 key,
2464 group,
2465 consumer,
2466 min_idle_time,
2467 ids,
2468 idle,
2469 time,
2470 retry_count,
2471 force,
2472 justid,
2473 )
2474 .await
2475 }
2476 }
2477 }
2478
2479 pub async fn xautoclaim<K, G, C, I>(
2484 &self,
2485 key: K,
2486 group: G,
2487 consumer: C,
2488 min_idle_time: u64,
2489 start: I,
2490 count: Option<u64>,
2491 justid: bool,
2492 ) -> Result<(), Error>
2493 where
2494 K: Into<Key> + Send,
2495 G: Into<Str> + Send,
2496 C: Into<Str> + Send,
2497 I: Into<XID> + Send,
2498 {
2499 match self.segment().await? {
2500 Segment::Plain(segment) => {
2501 segment
2502 .xautoclaim::<(), K, G, C, I>(
2503 key,
2504 group,
2505 consumer,
2506 min_idle_time,
2507 start,
2508 count,
2509 justid,
2510 )
2511 .await
2512 }
2513 Segment::Atomic(segment) => {
2514 segment
2515 .xautoclaim::<(), K, G, C, I>(
2516 key,
2517 group,
2518 consumer,
2519 min_idle_time,
2520 start,
2521 count,
2522 justid,
2523 )
2524 .await
2525 }
2526 }
2527 }
2528
2529 pub async fn xpending<K, G, A>(&self, key: K, group: G, args: A) -> Result<(), Error>
2534 where
2535 K: Into<Key> + Send,
2536 G: Into<Str> + Send,
2537 A: Into<XPendingArgs> + Send,
2538 {
2539 match self.segment().await? {
2540 Segment::Plain(segment) => segment.xpending::<(), K, G, A>(key, group, args).await,
2541 Segment::Atomic(segment) => segment.xpending::<(), K, G, A>(key, group, args).await,
2542 }
2543 }
2544
2545 pub async fn fcall<F, K, V>(&self, func: F, keys: K, args: V) -> Result<(), Error>
2550 where
2551 F: Into<Str> + Send,
2552 K: Into<MultipleKeys> + Send,
2553 V: TryInto<MultipleValues> + Send,
2554 V::Error: Into<Error> + Send,
2555 {
2556 match self.segment().await? {
2557 Segment::Plain(segment) => segment.fcall::<(), F, K, V>(func, keys, args).await,
2558 Segment::Atomic(segment) => segment.fcall::<(), F, K, V>(func, keys, args).await,
2559 }
2560 }
2561
2562 pub async fn fcall_ro<F, K, V>(&self, func: F, keys: K, args: V) -> Result<(), Error>
2567 where
2568 F: Into<Str> + Send,
2569 K: Into<MultipleKeys> + Send,
2570 V: TryInto<MultipleValues> + Send,
2571 V::Error: Into<Error> + Send,
2572 {
2573 match self.segment().await? {
2574 Segment::Plain(segment) => segment.fcall_ro::<(), F, K, V>(func, keys, args).await,
2575 Segment::Atomic(segment) => segment.fcall_ro::<(), F, K, V>(func, keys, args).await,
2576 }
2577 }
2578
2579 pub async fn function_delete<S>(&self, library_name: S) -> Result<(), Error>
2584 where
2585 S: Into<Str> + Send,
2586 {
2587 match self.segment().await? {
2588 Segment::Plain(segment) => segment.function_delete::<(), S>(library_name).await,
2589 Segment::Atomic(segment) => segment.function_delete::<(), S>(library_name).await,
2590 }
2591 }
2592
2593 pub async fn function_dump(&self) -> Result<(), Error> {
2598 match self.segment().await? {
2599 Segment::Plain(segment) => segment.function_dump::<()>().await,
2600 Segment::Atomic(segment) => segment.function_dump::<()>().await,
2601 }
2602 }
2603
2604 pub async fn function_flush(&self, r#async: bool) -> Result<(), Error> {
2609 match self.segment().await? {
2610 Segment::Plain(segment) => segment.function_flush::<()>(r#async).await,
2611 Segment::Atomic(segment) => segment.function_flush::<()>(r#async).await,
2612 }
2613 }
2614
2615 pub async fn function_list<S>(
2620 &self,
2621 library_name: Option<S>,
2622 withcode: bool,
2623 ) -> Result<(), Error>
2624 where
2625 S: Into<Str> + Send,
2626 {
2627 match self.segment().await? {
2628 Segment::Plain(segment) => segment.function_list::<(), S>(library_name, withcode).await,
2629 Segment::Atomic(segment) => {
2630 segment.function_list::<(), S>(library_name, withcode).await
2631 }
2632 }
2633 }
2634
2635 pub async fn function_load<S>(&self, replace: bool, code: S) -> Result<(), Error>
2640 where
2641 S: Into<Str> + Send,
2642 {
2643 match self.segment().await? {
2644 Segment::Plain(segment) => segment.function_load::<(), S>(replace, code).await,
2645 Segment::Atomic(segment) => segment.function_load::<(), S>(replace, code).await,
2646 }
2647 }
2648
2649 pub async fn function_restore<B, P>(&self, serialized: B, policy: P) -> Result<(), Error>
2654 where
2655 B: Into<Bytes> + Send,
2656 P: TryInto<FnPolicy> + Send,
2657 P::Error: Into<Error> + Send,
2658 {
2659 match self.segment().await? {
2660 Segment::Plain(segment) => {
2661 segment
2662 .function_restore::<(), B, P>(serialized, policy)
2663 .await
2664 }
2665 Segment::Atomic(segment) => {
2666 segment
2667 .function_restore::<(), B, P>(serialized, policy)
2668 .await
2669 }
2670 }
2671 }
2672
2673 pub async fn function_stats(&self) -> Result<(), Error> {
2678 match self.segment().await? {
2679 Segment::Plain(segment) => segment.function_stats::<()>().await,
2680 Segment::Atomic(segment) => segment.function_stats::<()>().await,
2681 }
2682 }
2683
2684 pub async fn publish<S, V>(&self, channel: S, message: V) -> Result<(), Error>
2689 where
2690 S: Into<Str> + Send,
2691 V: TryInto<Value> + Send,
2692 V::Error: Into<Error> + Send,
2693 {
2694 match self.segment().await? {
2695 Segment::Plain(segment) => segment.publish::<(), S, V>(channel, message).await,
2696 Segment::Atomic(segment) => segment.publish::<(), S, V>(channel, message).await,
2697 }
2698 }
2699
2700 pub async fn spublish<S, V>(&self, channel: S, message: V) -> Result<(), Error>
2705 where
2706 S: Into<Str> + Send,
2707 V: TryInto<Value> + Send,
2708 V::Error: Into<Error> + Send,
2709 {
2710 match self.segment().await? {
2711 Segment::Plain(segment) => segment.spublish::<(), S, V>(channel, message).await,
2712 Segment::Atomic(segment) => segment.spublish::<(), S, V>(channel, message).await,
2713 }
2714 }
2715
2716 pub async fn pubsub_channels<S>(&self, pattern: S) -> Result<(), Error>
2721 where
2722 S: Into<Str> + Send,
2723 {
2724 match self.segment().await? {
2725 Segment::Plain(segment) => segment.pubsub_channels::<(), S>(pattern).await,
2726 Segment::Atomic(segment) => segment.pubsub_channels::<(), S>(pattern).await,
2727 }
2728 }
2729
2730 pub async fn pubsub_numpat(&self) -> Result<(), Error> {
2735 match self.segment().await? {
2736 Segment::Plain(segment) => segment.pubsub_numpat::<()>().await,
2737 Segment::Atomic(segment) => segment.pubsub_numpat::<()>().await,
2738 }
2739 }
2740
2741 pub async fn pubsub_numsub<S>(&self, channels: S) -> Result<(), Error>
2746 where
2747 S: Into<MultipleStrings> + Send,
2748 {
2749 match self.segment().await? {
2750 Segment::Plain(segment) => segment.pubsub_numsub::<(), S>(channels).await,
2751 Segment::Atomic(segment) => segment.pubsub_numsub::<(), S>(channels).await,
2752 }
2753 }
2754
2755 pub async fn pubsub_shardchannels<S>(&self, pattern: S) -> Result<(), Error>
2760 where
2761 S: Into<Str> + Send,
2762 {
2763 match self.segment().await? {
2764 Segment::Plain(segment) => segment.pubsub_shardchannels::<(), S>(pattern).await,
2765 Segment::Atomic(segment) => segment.pubsub_shardchannels::<(), S>(pattern).await,
2766 }
2767 }
2768
2769 pub async fn pubsub_shardnumsub<S>(&self, channels: S) -> Result<(), Error>
2774 where
2775 S: Into<MultipleStrings> + Send,
2776 {
2777 match self.segment().await? {
2778 Segment::Plain(segment) => segment.pubsub_shardnumsub::<(), S>(channels).await,
2779 Segment::Atomic(segment) => segment.pubsub_shardnumsub::<(), S>(channels).await,
2780 }
2781 }
2782}