@@ -11,7 +11,6 @@ unsafe extern "C" {
1111 fn crdtp__FrontendChannel__BASE__CONSTRUCT (
1212 buf : * mut MaybeUninit < RawFrontendChannel > ,
1313 ) ;
14- fn crdtp__FrontendChannel__BASE__SIZE ( ) -> usize ;
1514
1615 fn crdtp__Serializable__DELETE ( this : * mut RawSerializable ) ;
1716 fn crdtp__Serializable__AppendSerialized (
@@ -98,7 +97,6 @@ unsafe extern "C" {
9897 fn crdtp__vec_u8__new ( ) -> * mut CppVecU8 ;
9998 fn crdtp__vec_u8__DELETE ( this : * mut CppVecU8 ) ;
10099 fn crdtp__vec_u8__size ( this : * const CppVecU8 ) -> usize ;
101- fn crdtp__vec_u8__data ( this : * const CppVecU8 ) -> * const u8 ;
102100 fn crdtp__vec_u8__copy ( this : * const CppVecU8 , out : * mut u8 ) ;
103101
104102 fn crdtp__json__ConvertJSONToCBOR (
@@ -184,7 +182,7 @@ impl Serializable {
184182 }
185183 }
186184
187- pub fn into_raw ( self ) -> * mut RawSerializable {
185+ pub ( crate ) fn into_raw ( self ) -> * mut RawSerializable {
188186 let ptr = self . ptr ;
189187 std:: mem:: forget ( self ) ;
190188 ptr
@@ -363,7 +361,7 @@ impl DispatchResponse {
363361 }
364362 }
365363
366- pub fn into_raw ( self ) -> * mut DispatchResponseWrapper {
364+ pub ( crate ) fn into_raw ( self ) -> * mut DispatchResponseWrapper {
367365 let ptr = self . ptr ;
368366 std:: mem:: forget ( self ) ;
369367 ptr
@@ -404,11 +402,6 @@ pub struct FrontendChannel {
404402impl FrontendChannel {
405403 /// Create a new FrontendChannel wrapping the given implementation.
406404 pub fn new ( imp : Box < dyn FrontendChannelImpl > ) -> Pin < Box < Self > > {
407- // Ensure our RawFrontendChannel is large enough for the C++ object.
408- assert ! (
409- std:: mem:: size_of:: <RawFrontendChannel >( )
410- >= unsafe { crdtp__FrontendChannel__BASE__SIZE( ) }
411- ) ;
412405 let mut channel = Box :: new ( Self {
413406 raw : UnsafeCell :: new ( unsafe { MaybeUninit :: zeroed ( ) . assume_init ( ) } ) ,
414407 imp,
@@ -426,10 +419,12 @@ impl FrontendChannel {
426419 }
427420
428421 unsafe fn from_raw < ' a > ( ptr : * mut RawFrontendChannel ) -> & ' a mut Self {
429- let channel_ptr = ptr as * mut u8 ;
430- let offset = std:: mem:: offset_of!( FrontendChannel , raw) ;
431- let self_ptr = channel_ptr. sub ( offset) as * mut Self ;
432- & mut * self_ptr
422+ unsafe {
423+ let channel_ptr = ptr as * mut u8 ;
424+ let offset = std:: mem:: offset_of!( FrontendChannel , raw) ;
425+ let self_ptr = channel_ptr. sub ( offset) as * mut Self ;
426+ & mut * self_ptr
427+ }
433428 }
434429}
435430
@@ -522,8 +517,8 @@ impl UberDispatcher {
522517 }
523518 }
524519
525- /// Get the frontend channel.
526- pub fn channel ( & mut self ) -> * mut RawFrontendChannel {
520+ /// Get the frontend channel (internal use only) .
521+ fn channel ( & mut self ) -> * mut RawFrontendChannel {
527522 unsafe { crdtp__UberDispatcher__channel ( self ) }
528523 }
529524
0 commit comments