File: raw_ident_namespace.rs

package info (click to toggle)
rust-cxx 1.0.141-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,632 kB
  • sloc: cpp: 1,573; javascript: 124; sh: 11; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (9)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use cxx::{type_id, ExternType};

#[repr(transparent)]
pub struct QuotedRaw(usize);

unsafe impl ExternType for QuotedRaw {
    type Id = type_id!("org::r#box::implementation::QuotedRaw");
    type Kind = cxx::kind::Trivial;
}

#[repr(transparent)]
pub struct QuotedKeyword(usize);

unsafe impl ExternType for QuotedKeyword {
    type Id = type_id!("org::box::implementation::QuotedKeyword");
    type Kind = cxx::kind::Trivial;
}

#[repr(transparent)]
pub struct UnquotedRaw(usize);

unsafe impl ExternType for UnquotedRaw {
    type Id = type_id!(org::r#box::implementation::UnquotedRaw);
    type Kind = cxx::kind::Trivial;
}

#[repr(transparent)]
pub struct UnquotedKeyword(usize);

unsafe impl ExternType for UnquotedKeyword {
    type Id = type_id!(org::box::implementation::UnquotedKeyword);
    type Kind = cxx::kind::Trivial;
}

#[cxx::bridge]
pub mod ffi {
    extern "C++" {
        #[namespace = "org::r#box::implementation"]
        type QuotedRaw = crate::QuotedRaw;

        #[namespace = "org::box::implementation"]
        type QuotedKeyword = crate::QuotedKeyword;

        #[namespace = org::r#box::implementation]
        type UnquotedRaw = crate::UnquotedRaw;

        // Not allowed by rustc (independent of cxx):
        // #[namespace = org::box::implementation]
        // type UnquotedKeyword = crate::UnquotedKeyword;
    }
}

fn main() {}