diff options
author | David Tolnay <dtolnay@gmail.com> | 2024-01-02 17:38:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-02 17:38:21 -0800 |
commit | b2477123a1205c4313dce5b027e7855a97e4cc53 (patch) | |
tree | f42b3fbdc93cce2810dce7d017ed87f39ee7f66c | |
parent | f0fa65a7de93241326d1006ecfef0486075deaeb (diff) | |
parent | 08ce722e29ffecb04d9b265f5f2a5fa484b7c820 (diff) | |
download | cxx-b2477123a1205c4313dce5b027e7855a97e4cc53.tar.gz |
Merge pull request #1298 from adamchalmers/achalmers/document-how-to-implement-vectorelement
Document how to implement VectorElement
-rw-r--r-- | src/cxx_vector.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cxx_vector.rs b/src/cxx_vector.rs index 242e30ed..c18871fa 100644 --- a/src/cxx_vector.rs +++ b/src/cxx_vector.rs @@ -314,7 +314,8 @@ where /// `CxxVector<T>` in generic code. /// /// This trait has no publicly callable or implementable methods. Implementing -/// it outside of the CXX codebase is not supported. +/// it outside of the CXX codebase requires using [explicit shim trait impls], +/// adding the line `impl CxxVector<MyType> {}` in the same `cxx::bridge` that defines `MyType`. /// /// # Example /// @@ -338,6 +339,8 @@ where /// /// Writing the same generic function without a `VectorElement` trait bound /// would not compile. +/// +/// [explicit shim trait impls]: https://cxx.rs/extern-c++.html#explicit-shim-trait-impls pub unsafe trait VectorElement: Sized { #[doc(hidden)] fn __typename(f: &mut fmt::Formatter) -> fmt::Result; |