rust : use repr(transparent) when we should
Change-Id: Iaf8334aa8d83c170454dffc8438395a395246938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198557 Reviewed-by: Arnaud Versini <arnaud.versini@pm.me> Tested-by: Jenkins
This commit is contained in:
committed by
Arnaud Versini
parent
5fdf0a21d5
commit
fc76052495
@@ -613,6 +613,7 @@ void RustProducer::generateInterfaceWrapper(
|
||||
.endLine()
|
||||
.beginLine()
|
||||
.append("#[allow(non_camel_case_types)]")
|
||||
.append("#[repr(transparent)]")
|
||||
.endLine()
|
||||
.beginLine()
|
||||
.append("pub struct ")
|
||||
|
||||
@@ -34,6 +34,7 @@ use crate::ffi::uno_any::*;
|
||||
///
|
||||
/// Any provides a safe, memory-managed interface to LibreOffice's native
|
||||
/// any type. It automatically handles reference counting and memory cleanup.
|
||||
#[repr(transparent)]
|
||||
pub struct Any {
|
||||
inner: uno_Any,
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ use crate::ffi::sal_types::*;
|
||||
/// OUString provides a safe, memory-managed interface to LibreOffice's native
|
||||
/// string type. It automatically handles reference counting and memory cleanup,
|
||||
/// and provides conversions to/from standard Rust string types.
|
||||
#[repr(transparent)]
|
||||
pub struct OUString {
|
||||
inner: NonNull<rtl_uString>,
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ use std::ptr::NonNull;
|
||||
///
|
||||
/// Sequence provides a safe, memory-managed interface to LibreOffice's native
|
||||
/// Sequence type. It automatically handles reference counting and memory cleanup.
|
||||
#[repr(transparent)]
|
||||
pub struct Sequence {
|
||||
inner: NonNull<uno_Sequence>,
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ use std::ptr;
|
||||
/// ));
|
||||
/// ```
|
||||
#[allow(non_snake_case)] // _pType follows FFI naming conventions
|
||||
#[repr(transparent)]
|
||||
pub struct Type {
|
||||
/// C typelib reference pointer
|
||||
_pType: *mut typelib_TypeDescriptionReference,
|
||||
|
||||
Reference in New Issue
Block a user