File: derive-bounds.rs

package info (click to toggle)
rust-defmt 0.3.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 481 bytes parent folder | download
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
fn main() {
    let baz: Baz<Qux> = Default::default();
    defmt::info!("{}", baz);
}

trait Foo {
    type Bar;
}
#[derive(defmt::Format, Default)]
struct Baz<T: Foo> {
    field: T::Bar,
    field2: Quux<T>,
}
#[derive(defmt::Format, Default)]
struct Qux;
impl Foo for Qux {
    type Bar = Qux;
}
#[allow(dead_code)]
#[derive(defmt::Format, Default)]
enum Quux<T: Foo> {
    #[default]
    None,
    Variant1(T),
    Variant2 {
        f: T::Bar,
    },
    Variant3(T::Bar),
}