Skip to content

Commit 43232b9

Browse files
committed
Add trait bound to ExternType::Kind
1 parent 61ca18d commit 43232b9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/extern_type.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use self::kind::Kind;
2+
13
/// A type for which the layout is determined by its C++ definition.
24
///
35
/// This trait serves the following two related purposes.
@@ -135,7 +137,7 @@ pub unsafe trait ExternType {
135137
/// by value, and include it in `struct`s that you have declared to
136138
/// `cxx::bridge`. Your claim about the triviality of the C++ type will be
137139
/// checked by a `static_assert` in the generated C++ side of the binding.
138-
type Kind;
140+
type Kind: Kind;
139141
}
140142

141143
/// Marker types identifying Rust's knowledge about an extern C++ type.
@@ -160,6 +162,10 @@ pub mod kind {
160162
/// therefore be owned and moved around in Rust code without requiring
161163
/// indirection.
162164
pub enum Trivial {}
165+
166+
pub trait Kind {}
167+
impl Kind for Opaque {}
168+
impl Kind for Trivial {}
163169
}
164170

165171
#[doc(hidden)]

0 commit comments

Comments
 (0)