mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-25 02:20:49 +00:00
Move Opaque and Trivial marker types under a ::kind module
In the interest of keeping the root module focused on the most widely used items only.
This commit is contained in:
parent
9f69230783
commit
38f5ad69da
@ -183,7 +183,7 @@ fn expand_cxx_type(namespace: &Namespace, ety: &ExternType) -> TokenStream {
|
||||
|
||||
unsafe impl ::cxx::ExternType for #ident {
|
||||
type Id = #type_id;
|
||||
type Kind = ::cxx::Opaque;
|
||||
type Kind = ::cxx::kind::Opaque;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -692,7 +692,7 @@ fn expand_type_alias_kind_trivial_verify(type_alias: &TypeAlias) -> TokenStream
|
||||
let end = quote_spanned!(end_span=> >);
|
||||
|
||||
quote! {
|
||||
const _: fn() = #begin #ident, ::cxx::Trivial #end;
|
||||
const _: fn() = #begin #ident, ::cxx::kind::Trivial #end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,11 +69,11 @@
|
||||
/// # pub struct StringPiece([usize; 2]);
|
||||
/// # }
|
||||
///
|
||||
/// use cxx::{type_id, ExternType, Opaque};
|
||||
/// use cxx::{type_id, ExternType};
|
||||
///
|
||||
/// unsafe impl ExternType for folly_sys::StringPiece {
|
||||
/// type Id = type_id!("folly::StringPiece");
|
||||
/// type Kind = Opaque;
|
||||
/// type Kind = cxx::kind::Opaque;
|
||||
/// }
|
||||
///
|
||||
/// #[cxx::bridge(namespace = folly)]
|
||||
@ -105,7 +105,7 @@
|
||||
/// # struct TypeName;
|
||||
/// # unsafe impl cxx::ExternType for TypeName {
|
||||
/// type Id = cxx::type_id!("name::space::of::TypeName");
|
||||
/// type Kind = cxx::Trivial;
|
||||
/// type Kind = cxx::kind::Trivial;
|
||||
/// # }
|
||||
/// ```
|
||||
/// which will enable you to pass it into C++ functions by value,
|
||||
@ -125,18 +125,17 @@ pub unsafe trait ExternType {
|
||||
/// # struct TypeName;
|
||||
/// # unsafe impl cxx::ExternType for TypeName {
|
||||
/// type Id = cxx::type_id!("name::space::of::TypeName");
|
||||
/// type Kind = cxx::Opaque;
|
||||
/// type Kind = cxx::kind::Opaque;
|
||||
/// # }
|
||||
/// ```
|
||||
type Id;
|
||||
|
||||
/// Either `cxx::Opaque` or `cxx::Trivial`. If in doubt, use
|
||||
/// `cxx::Opaque`.
|
||||
/// Either `cxx::kind::Opaque` or `cxx::kind::Trivial`. If in doubt, use
|
||||
/// `cxx::kind::Opaque`.
|
||||
type Kind;
|
||||
}
|
||||
|
||||
pub(crate) mod kind {
|
||||
|
||||
pub mod kind {
|
||||
/// An opaque type which can't be passed or held by value within Rust.
|
||||
/// For example, a C++ type with a destructor, or a non-trivial move
|
||||
/// constructor. Rust's strict move semantics mean that we can't own
|
||||
|
@ -395,9 +395,7 @@ mod unwind;
|
||||
pub use crate::cxx_string::CxxString;
|
||||
pub use crate::cxx_vector::CxxVector;
|
||||
pub use crate::exception::Exception;
|
||||
pub use crate::extern_type::kind::Opaque;
|
||||
pub use crate::extern_type::kind::Trivial;
|
||||
pub use crate::extern_type::ExternType;
|
||||
pub use crate::extern_type::{kind, ExternType};
|
||||
pub use crate::unique_ptr::UniquePtr;
|
||||
pub use cxxbridge_macro::bridge;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user