Debian Codegraph @

third_party/rust/zerocopy-derive/tests/enum_from_zeroes.rs

raw
1 // Copyright 2019 The Fuchsia Authors
2 //
3 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
4 // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
5 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
6 // This file may not be copied, modified, or distributed except according to
7 // those terms.
8
9 #![allow(warnings)]
10
11 mod util;
12
13 use {static_assertions::assert_impl_all, zerocopy::FromZeroes};
14
15 #[derive(FromZeroes)]
16 enum Foo {
17 A,
18 }
19
20 assert_impl_all!(Foo: FromZeroes);
21
22 #[derive(FromZeroes)]
23 enum Bar {
24 A = 0,
25 }
26
27 assert_impl_all!(Bar: FromZeroes);
28
29 #[derive(FromZeroes)]
30 enum Baz {
31 A = 1,
32 B = 0,
33 }
34
35 assert_impl_all!(Baz: FromZeroes);