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:
Arnaud VERSINI
2026-04-28 08:13:34 +02:00
committed by Arnaud Versini
parent 5fdf0a21d5
commit fc76052495
5 changed files with 5 additions and 0 deletions
@@ -613,6 +613,7 @@ void RustProducer::generateInterfaceWrapper(
.endLine()
.beginLine()
.append("#[allow(non_camel_case_types)]")
.append("#[repr(transparent)]")
.endLine()
.beginLine()
.append("pub struct ")
+1
View File
@@ -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,
}
+1
View File
@@ -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>,
}
+1
View File
@@ -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>,
}
+1
View File
@@ -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,