Debian Codegraph @

debian/missing-sources/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 // See comment in `include.rs` for why we disable the prelude.
10 #![no_implicit_prelude]
11 #![allow(warnings)]
12
13 include!("include.rs");
14
15 // Ensure that types that are use'd and types that are referenced by path work.
16
17 mod foo {
18 use super::*;
19
20 #[derive(imp::FromBytes, imp::IntoBytes, imp::Unaligned)]
21 #[zerocopy(crate = "zerocopy_renamed")]
22 #[repr(C)]
23 pub struct Foo {
24 foo: u8,
25 }
26
27 #[derive(imp::FromBytes, imp::IntoBytes, imp::Unaligned)]
28 #[zerocopy(crate = "zerocopy_renamed")]
29 #[repr(C)]
30 pub struct Bar {
31 bar: u8,
32 }
33 }
34
35 use foo::Foo;
36
37 #[derive(imp::FromBytes, imp::IntoBytes, imp::Unaligned)]
38 #[zerocopy(crate = "zerocopy_renamed")]
39 #[repr(C)]
40 struct Baz {
41 foo: Foo,
42 bar: foo::Bar,
43 }