Rename std::vector binding to CxxVector
diff --git a/src/vector.rs b/src/cxx_vector.rs
similarity index 83%
rename from src/vector.rs
rename to src/cxx_vector.rs
index 1436165..feb2e29 100644
--- a/src/vector.rs
+++ b/src/cxx_vector.rs
@@ -1,16 +1,16 @@
pub trait VectorTarget<T> {
- fn get_unchecked(v: &RealVector<T>, pos: usize) -> &T
+ fn get_unchecked(v: &CxxVector<T>, pos: usize) -> &T
where
Self: Sized;
- fn vector_length(v: &RealVector<T>) -> usize
+ fn vector_length(v: &CxxVector<T>) -> usize
where
Self: Sized;
- fn push_back(v: &RealVector<T>, item: &T)
+ fn push_back(v: &CxxVector<T>, item: &T)
where
Self: Sized;
}
-/// Binding to C++ `std::vector`.
+/// Binding to C++ `std::vector<T>`.
///
/// # Invariants
///
@@ -21,11 +21,11 @@
/// look at a Vector through a reference or smart pointer, as in `&Vector`
/// or `UniquePtr<Vector>`.
#[repr(C)]
-pub struct RealVector<T> {
+pub struct CxxVector<T> {
_private: [T; 0],
}
-impl<T: VectorTarget<T>> RealVector<T> {
+impl<T: VectorTarget<T>> CxxVector<T> {
/// Returns the length of the vector in bytes.
pub fn size(&self) -> usize {
T::vector_length(self)
@@ -53,14 +53,14 @@
}
}
-unsafe impl<T> Send for RealVector<T> where T: Send + VectorTarget<T> {}
+unsafe impl<T> Send for CxxVector<T> where T: Send + VectorTarget<T> {}
pub struct VectorIntoIterator<'a, T> {
- v: &'a RealVector<T>,
+ v: &'a CxxVector<T>,
index: usize,
}
-impl<'a, T: VectorTarget<T>> IntoIterator for &'a RealVector<T> {
+impl<'a, T: VectorTarget<T>> IntoIterator for &'a CxxVector<T> {
type Item = &'a T;
type IntoIter = VectorIntoIterator<'a, T>;
diff --git a/src/lib.rs b/src/lib.rs
index a8ce904..a25f83d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -360,6 +360,7 @@
mod assert;
mod cxx_string;
+mod cxx_vector;
mod error;
mod exception;
mod function;
@@ -374,18 +375,17 @@
mod syntax;
mod unique_ptr;
mod unwind;
-mod vector;
pub use crate::cxx_string::CxxString;
+pub use crate::cxx_vector::CxxVector;
pub use crate::exception::Exception;
pub use crate::unique_ptr::UniquePtr;
-pub use crate::vector::RealVector;
-pub use crate::vector::VectorIntoIterator;
pub use cxxbridge_macro::bridge;
// Not public API.
#[doc(hidden)]
pub mod private {
+ pub use crate::cxx_vector::VectorTarget;
pub use crate::function::FatFunction;
pub use crate::opaque::Opaque;
pub use crate::result::{r#try, Result};
@@ -395,7 +395,6 @@
pub use crate::rust_vec::RustVec;
pub use crate::unique_ptr::UniquePtrTarget;
pub use crate::unwind::catch_unwind;
- pub use crate::vector::VectorTarget;
}
use crate::error::Result;
diff --git a/src/rust_vec.rs b/src/rust_vec.rs
index b4eed3b..671d8f7 100644
--- a/src/rust_vec.rs
+++ b/src/rust_vec.rs
@@ -1,4 +1,4 @@
-use crate::vector::VectorTarget;
+use crate::cxx_vector::VectorTarget;
#[repr(C)]
pub struct RustVec<T: VectorTarget<T>> {