emit 1.17.2

Developer-first diagnostics for Rust applications.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
/*!
The [`Level`] type.
*/

use emit_core::{
    event::ToEvent,
    filter::Filter,
    props::Props,
    runtime::InternalFilter,
    value::FromValue,
    well_known::{KEY_LVL, LVL_DEBUG, LVL_ERROR, LVL_INFO, LVL_WARN},
};

use crate::value::{ToValue, Value};
use core::{fmt, str::FromStr};

/**
A severity level for a diagnostic event.

If a [`crate::Event`] has a level associated with it, it can be pulled from its props:

```
# use emit::{Event, Props};
# fn with_event(evt: impl emit::event::ToEvent) {
# let evt = evt.to_event();
match evt.props().pull::<emit::Level, _>(emit::well_known::KEY_LVL).unwrap_or_default() {
    emit::Level::Debug => {
        // The event is at the debug level
    }
    emit::Level::Info => {
        // The event is at the info level
    }
    emit::Level::Warn => {
        // The event is at the warn level
    }
    emit::Level::Error => {
        // The event is at the error level
    }
}
# }
```

The default level is [`Level::Info`].

# Parsing

`Level` has a permissive parser that will match partial and incomplete contents, ignoring case. So long as the start of the text is a submatch of the full level, and any trailing unmatched characters are not ASCII control characters, the level will parse.

For example, the following will all be parsed as `Level::Info`:

- `info`
- `INFO`
- `i`
- `inf`
- `information`
- `INFO1`
- `inf(13)`

Note that any trailing data is lost when levels are parsed. That means, for example, that `INFO3` and `INFO4` will both parse to the same value, `Level::Info`, and will sort equivalently.
*/
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Level {
    /**
    The event is weakly informative.

    This variant is equal to [`LVL_DEBUG`].
    */
    Debug,
    /**
    The event is informative.

    This variant is equal to [`LVL_INFO`].
    */
    Info,
    /**
    The event is weakly erroneous.

    This variant is equal to [`LVL_WARN`].
    */
    Warn,
    /**
    The event is erroneous.

    This variant is equal to [`LVL_ERROR`].
    */
    Error,
}

impl Level {
    /**
    Try parse a level from a formatted representation.
    */
    pub fn try_from_str(s: &str) -> Result<Self, ParseLevelError> {
        s.parse()
    }

    /**
    Get the value of the level as a string.
    */
    pub fn as_str(&self) -> &'static str {
        match self {
            Level::Info => LVL_INFO,
            Level::Error => LVL_ERROR,
            Level::Warn => LVL_WARN,
            Level::Debug => LVL_DEBUG,
        }
    }
}

impl Default for Level {
    fn default() -> Self {
        Level::Info
    }
}

impl fmt::Debug for Level {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self)
    }
}

impl fmt::Display for Level {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(self.as_str())
    }
}

#[cfg(feature = "sval")]
impl sval::Value for Level {
    fn stream<'sval, S: sval::Stream<'sval> + ?Sized>(&'sval self, stream: &mut S) -> sval::Result {
        stream.value(self.as_str())
    }
}

#[cfg(feature = "serde")]
impl serde::Serialize for Level {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        self.as_str().serialize(serializer)
    }
}

impl FromStr for Level {
    type Err = ParseLevelError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let s = s.trim();

        let lvl = s.as_bytes();

        match lvl.get(0) {
            Some(b'I') | Some(b'i') => parse(lvl, b"INFORMATION", Level::Info),
            Some(b'D') | Some(b'd') => {
                parse(lvl, b"DEBUG", Level::Debug).or_else(|_| parse(lvl, b"DBG", Level::Debug))
            }
            Some(b'E') | Some(b'e') => parse(lvl, b"ERROR", Level::Error),
            Some(b'W') | Some(b'w') => {
                parse(lvl, b"WARNING", Level::Warn).or_else(|_| parse(lvl, b"WRN", Level::Warn))
            }
            Some(_) => Err(ParseLevelError {}),
            None => Err(ParseLevelError {}),
        }
    }
}

fn parse(
    mut input: &[u8],
    mut expected_uppercase: &[u8],
    ok: Level,
) -> Result<Level, ParseLevelError> {
    // Assume the first character has already been matched
    input = &input[1..];
    expected_uppercase = &expected_uppercase[1..];

    // Doesn't require a full match of the expected content
    // For example, `INF` will match `INFORMATION`
    while let Some(b) = input.get(0) {
        match b {
            // If the character is a letter then match against the expected value
            b if b.is_ascii_alphabetic() => {
                let Some(e) = expected_uppercase.get(0) else {
                    return Err(ParseLevelError {});
                };

                if b.to_ascii_uppercase() != *e {
                    return Err(ParseLevelError {});
                }

                expected_uppercase = &expected_uppercase[1..];
                input = &input[1..];
            }
            // If the character is not alphabetic then break
            // This lets us match more complex schemes like `info13` or `INFO(4)`
            b if b.is_ascii() && !b.is_ascii_control() => break,
            // Any other character is an error
            _ => {
                return Err(ParseLevelError {});
            }
        }
    }

    Ok(ok)
}

/**
An error attempting to parse a [`Level`] from text.
*/
#[derive(Debug)]
pub struct ParseLevelError {}

impl fmt::Display for ParseLevelError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "the input was not a valid level")
    }
}

#[cfg(feature = "std")]
impl std::error::Error for ParseLevelError {}

impl ToValue for Level {
    fn to_value(&self) -> Value<'_> {
        Value::capture_display(self)
    }
}

impl<'v> FromValue<'v> for Level {
    fn from_value(value: Value<'v>) -> Option<Self> {
        value
            .downcast_ref::<Level>()
            .copied()
            .or_else(|| value.parse())
    }
}

/**
Only match events that carry the given [`Level`].
*/
pub fn min_filter(min: Level) -> MinLevelFilter {
    MinLevelFilter::new(min)
}

/**
A [`Filter`] that matches events with a specific [`Level`].

The level to match is pulled from the [`KEY_LVL`] well-known property. Events that don't carry any specific level are treated as carrying a default one, as set by [`MinLevelFilter::treat_unleveled_as`].
*/
#[derive(Debug)]
pub struct MinLevelFilter<L = Level> {
    min: L,
    default: Option<L>,
}

impl From<Level> for MinLevelFilter {
    fn from(min: Level) -> Self {
        MinLevelFilter::new(min)
    }
}

impl<L> MinLevelFilter<L> {
    /**
    Construct a new [`MinLevelFilter`], treating unleveled events as [`Level::default`].
    */
    pub const fn new(min: L) -> MinLevelFilter<L> {
        MinLevelFilter { min, default: None }
    }

    /**
    Treat events without an explicit level as having `default` when evaluating against the filter.
    */
    pub fn treat_unleveled_as(mut self, default: L) -> Self {
        self.default = Some(default);
        self
    }
}

impl<L: for<'a> FromValue<'a> + Ord + Default> Filter for MinLevelFilter<L> {
    fn matches<E: ToEvent>(&self, evt: E) -> bool {
        evt.to_event()
            .props()
            .pull::<L, _>(KEY_LVL)
            .as_ref()
            .or_else(|| self.default.as_ref())
            .unwrap_or(&L::default())
            >= &self.min
    }
}

impl InternalFilter for MinLevelFilter {}

#[cfg(feature = "alloc")]
mod alloc_support {
    use super::*;

    use alloc::vec::Vec;
    use emit_core::path::Path;
    use emit_core::str::Str;

    /**
    Construct a set of [`MinLevelFilter`]s that are applied based on the module of an event.
    */
    pub fn min_by_path_filter<P: Into<Path<'static>>, L: Into<MinLevelFilter>>(
        levels: impl IntoIterator<Item = (P, L)>,
    ) -> MinLevelPathMap {
        MinLevelPathMap::from_iter(levels)
    }

    /**
    A filter that applies a [`MinLevelFilter`] based on the module of an event.

    This type allows different modules to apply different level filters. In particular, modules generating a lot of diagnostic noise can be silenced without affecting other modules.

    Event modules are matched based on [`Path::is_child_of`]. If an event's module is a child of one in the map then its [`MinLevelFilter`] will be checked against it. If an event's module doesn't match any in the map then it will pass the filter.
    */
    #[derive(Debug)]
    pub struct MinLevelPathMap<L = Level> {
        root: PathNode<L>,
    }

    #[derive(Debug)]
    struct PathNode<L> {
        min_level: Option<MinLevelFilter<L>>,
        children: Vec<(Str<'static>, PathNode<L>)>,
    }

    impl<L> MinLevelPathMap<L> {
        /**
        Create an empty map.
        */
        pub const fn new() -> Self {
            MinLevelPathMap {
                root: PathNode {
                    min_level: None,
                    children: Vec::new(),
                },
            }
        }

        /**
        Specify the minimum level for any modules that don't match any added by [`MinLevelPathMap::min_level`].
        */
        pub fn default_min_level(&mut self, min_level: impl Into<MinLevelFilter<L>>) -> &mut Self {
            self.root.min_level = Some(min_level.into());

            self
        }

        /**
        Specify the minimum level for a module and its children.
        */
        pub fn min_level(
            &mut self,
            path: impl Into<Path<'static>>,
            min_level: impl Into<MinLevelFilter<L>>,
        ) -> &mut Self {
            let path = path.into();

            let mut node = &mut self.root;
            for segment in path.segments() {
                node = match node
                    .children
                    .binary_search_by_key(&segment, |(key, _)| key.by_ref())
                {
                    Ok(idx) => &mut node.children[idx].1,
                    Err(idx) => {
                        node.children.insert(
                            idx,
                            (
                                segment.to_owned(),
                                PathNode {
                                    min_level: None,
                                    children: Vec::new(),
                                },
                            ),
                        );

                        &mut node.children[idx].1
                    }
                };
            }

            node.min_level = Some(min_level.into());

            self
        }
    }

    impl<L: for<'a> FromValue<'a> + Ord + Default> Filter for MinLevelPathMap<L> {
        fn matches<E: ToEvent>(&self, evt: E) -> bool {
            let evt = evt.to_event();

            let path = evt.mdl();

            // Find the most specific path to the given node
            let mut node = &self.root;
            let mut filter = self.root.min_level.as_ref();
            for segment in path.segments() {
                let Ok(idx) = node
                    .children
                    .binary_search_by_key(&segment, |(key, _)| key.by_ref())
                else {
                    break;
                };

                node = &node.children[idx].1;
                filter = node.min_level.as_ref().or(filter);
            }

            filter.matches(evt)
        }
    }

    impl InternalFilter for MinLevelPathMap {}

    impl<L, P: Into<Path<'static>>, T: Into<MinLevelFilter<L>>> FromIterator<(P, T)>
        for MinLevelPathMap<L>
    {
        fn from_iter<I: IntoIterator<Item = (P, T)>>(iter: I) -> Self {
            let mut map = MinLevelPathMap::new();

            for (path, min_level) in iter {
                map.min_level(path, min_level);
            }

            map
        }
    }

    #[cfg(test)]
    mod tests {
        use super::*;

        #[test]
        fn min_level() {
            let mut filter = MinLevelPathMap::new();

            filter.min_level(Path::new_raw("a"), Level::Error);

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));

            assert!(filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Error),
            )));
        }

        #[test]
        fn min_level_default() {
            let mut filter = MinLevelPathMap::new();

            filter.default_min_level(Level::Error);

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));

            assert!(filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Error),
            )));
        }

        #[test]
        fn min_level_child() {
            let mut filter = MinLevelPathMap::new();

            filter
                .min_level(Path::new_raw("a"), Level::Error)
                .min_level(Path::new_raw("a::b::c"), Level::Warn);

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("a::b"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));

            assert!(filter.matches(crate::Event::new(
                Path::new_raw("a::b::c"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));
        }

        #[test]
        fn min_level_unmatched() {
            let mut filter = MinLevelPathMap::new();

            filter.min_level(Path::new_raw("a"), Level::Error);

            assert!(filter.matches(crate::Event::new(
                Path::new_raw("b"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));
        }

        #[test]
        fn min_level_default_unmatched() {
            let mut filter = MinLevelPathMap::new();

            filter
                .default_min_level(Level::Error)
                .min_level(Path::new_raw("a"), Level::Error);

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("b"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, Level::Warn),
            )));
        }

        #[test]
        fn min_level_integer() {
            let mut filter = MinLevelPathMap::<u8>::new();

            filter
                .default_min_level(MinLevelFilter::new(3))
                .min_level(Path::new_raw("a"), MinLevelFilter::new(1));

            assert!(filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, 2),
            )));

            assert!(filter.matches(crate::Event::new(
                Path::new_raw("b"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, 6),
            )));

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("a"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, 0),
            )));

            assert!(!filter.matches(crate::Event::new(
                Path::new_raw("b"),
                crate::Template::literal("test"),
                crate::Empty,
                (KEY_LVL, 2),
            )));
        }
    }
}

#[cfg(feature = "alloc")]
pub use self::alloc_support::*;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn parse() {
        for (case, expected) in [
            ("d", Ok(Level::Debug)),
            ("dbg", Ok(Level::Debug)),
            ("debug", Ok::<Level, ParseLevelError>(Level::Debug)),
            ("i", Ok(Level::Info)),
            ("inf", Ok(Level::Info)),
            ("info", Ok(Level::Info)),
            ("information", Ok(Level::Info)),
            ("w", Ok(Level::Warn)),
            ("wrn", Ok(Level::Warn)),
            ("warn", Ok(Level::Warn)),
            ("warning", Ok(Level::Warn)),
            ("e", Ok(Level::Error)),
            ("err", Ok(Level::Error)),
            ("error", Ok(Level::Error)),
            ("INFO3", Ok(Level::Info)),
            ("WRN(x)", Ok(Level::Warn)),
            ("info warn", Ok(Level::Info)),
            ("", Err(ParseLevelError {})),
            ("ifo", Err(ParseLevelError {})),
            ("trace", Err(ParseLevelError {})),
            ("erroneous", Err(ParseLevelError {})),
            ("infoℹ️", Err(ParseLevelError {})),
        ] {
            match expected {
                Ok(expected) => {
                    assert_eq!(expected, Level::from_str(case).unwrap());
                    assert_eq!(expected, Level::from_str(&case.to_uppercase()).unwrap());
                    assert_eq!(expected, Level::from_str(&format!(" {case} ")).unwrap());
                }
                Err(expected) => assert_eq!(
                    expected.to_string(),
                    Level::from_str(case).unwrap_err().to_string()
                ),
            }
        }
    }

    #[test]
    fn roundtrip() {
        for lvl in [Level::Info, Level::Debug, Level::Warn, Level::Error] {
            for fmt in [lvl.to_string(), format!("{:?}", lvl)] {
                let parsed: Level = fmt.parse().unwrap();

                assert_eq!(lvl, parsed, "{}", fmt);
            }
        }
    }

    #[cfg(feature = "sval")]
    #[test]
    fn level_stream() {
        sval_test::assert_tokens(
            &Level::Warn,
            &[
                sval_test::Token::TextBegin(Some(4)),
                sval_test::Token::TextFragment("warn"),
                sval_test::Token::TextEnd,
            ],
        );
    }

    #[cfg(feature = "serde")]
    #[test]
    fn level_serialize() {
        serde_test::assert_ser_tokens(&Level::Warn, &[serde_test::Token::Str("warn")]);
    }

    #[test]
    fn to_from_value() {
        for case in [Level::Debug, Level::Info, Level::Warn, Level::Error] {
            let value = case.to_value();

            assert_eq!(case, value.cast::<Level>().unwrap());

            let formatted = case.to_string();
            let value = Value::from(&*formatted);

            assert_eq!(case, value.cast::<Level>().unwrap());
        }
    }

    #[test]
    fn min_level_filter() {
        let filter = MinLevelFilter::new(Level::Warn);

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_ERROR),
        )));

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_WARN),
        )));

        assert!(!filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            crate::Empty,
        )));

        assert!(!filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_DEBUG),
        )));

        assert!(!filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_INFO),
        )));
    }

    #[test]
    fn min_level_filter_with_default() {
        let filter = MinLevelFilter::new(Level::Info).treat_unleveled_as(Level::Info);

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_ERROR),
        )));

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_WARN),
        )));

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_INFO),
        )));

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            crate::Empty,
        )));

        assert!(!filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, LVL_DEBUG),
        )));
    }

    #[test]
    fn min_level_filter_integer() {
        let filter = MinLevelFilter::new(3).treat_unleveled_as(1);

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, 3),
        )));

        assert!(filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, 4),
        )));

        assert!(!filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            (KEY_LVL, 2),
        )));

        assert!(!filter.matches(crate::Event::new(
            crate::Path::new_raw("test"),
            crate::Template::literal("test"),
            crate::Empty,
            crate::Empty,
        )));
    }
}