Debian Codegraph @

third_party/rust/zerocopy-derive/tests/paths_and_modules.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 use zerocopy::{AsBytes, FromBytes, FromZeroes, Unaligned};
12
13 // Ensure that types that are use'd and types that are referenced by path work.
14
15 mod foo {
16 use zerocopy::{AsBytes, FromBytes, FromZeroes, Unaligned};
17
18 #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
19 #[repr(C)]
20 pub struct Foo {
21 foo: u8,
22 }
23
24 #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
25 #[repr(C)]
26 pub struct Bar {
27 bar: u8,
28 }
29 }
30
31 use foo::Foo;
32
33 #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
34 #[repr(C)]
35 struct Baz {
36 foo: Foo,
37 bar: foo::Bar,
38 }