Skip to content

Commit b247712

Browse files
authored
Merge pull request #1298 from adamchalmers/achalmers/document-how-to-implement-vectorelement
Document how to implement VectorElement
2 parents f0fa65a + 08ce722 commit b247712

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cxx_vector.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ where
314314
/// `CxxVector<T>` in generic code.
315315
///
316316
/// This trait has no publicly callable or implementable methods. Implementing
317-
/// it outside of the CXX codebase is not supported.
317+
/// it outside of the CXX codebase requires using [explicit shim trait impls],
318+
/// adding the line `impl CxxVector<MyType> {}` in the same `cxx::bridge` that defines `MyType`.
318319
///
319320
/// # Example
320321
///
@@ -338,6 +339,8 @@ where
338339
///
339340
/// Writing the same generic function without a `VectorElement` trait bound
340341
/// would not compile.
342+
///
343+
/// [explicit shim trait impls]: https://cxx.rs/extern-c++.html#explicit-shim-trait-impls
341344
pub unsafe trait VectorElement: Sized {
342345
#[doc(hidden)]
343346
fn __typename(f: &mut fmt::Formatter) -> fmt::Result;

0 commit comments

Comments
 (0)