• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2024 Google LLC.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 // Macro to create structs that will act as opaque pointees. These structs are
9 // never intended to be dereferenced in Rust.
10 // This is a workaround until stabilization of [`extern type`].
11 // TODO: convert to extern type once stabilized.
12 // [`extern type`]: https://github.com/rust-lang/rust/issues/43467
13 macro_rules! opaque_pointee {
14     ($name: ident) => {
15         #[repr(C)]
16         pub struct $name {
17             _data: [u8; 0],
18             _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
19         }
20     };
21 }
22 
23 pub(crate) use opaque_pointee;
24