Skip to content

Commit e03f1cc

Browse files
authored
refactor(rust/ffi): make fields of FFI structs public (apache#3553)
Closes apache#3552.
1 parent 8f852e9 commit e03f1cc

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

rust/ffi/src/types.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ pub type FFI_AdbcDriverInitFunc =
3636
#[repr(C)]
3737
#[derive(Debug)]
3838
pub struct FFI_AdbcError {
39-
message: *mut c_char,
40-
vendor_code: i32,
41-
sqlstate: [c_char; 5],
42-
release: Option<unsafe extern "C" fn(*mut Self)>,
39+
pub message: *mut c_char,
40+
pub vendor_code: i32,
41+
pub sqlstate: [c_char; 5],
42+
pub release: Option<unsafe extern "C" fn(*mut Self)>,
4343
/// Added in ADBC 1.1.0.
44-
pub(crate) private_data: *mut c_void,
44+
pub private_data: *mut c_void,
4545
/// Added in ADBC 1.1.0.
4646
pub private_driver: *const FFI_AdbcDriver,
4747
}
@@ -50,21 +50,21 @@ pub struct FFI_AdbcError {
5050
#[derive(Debug)]
5151
pub struct FFI_AdbcErrorDetail {
5252
/// The metadata key.
53-
pub(crate) key: *const c_char,
53+
pub key: *const c_char,
5454
/// The binary metadata value.
55-
pub(crate) value: *const u8,
55+
pub value: *const u8,
5656
/// The length of the metadata value.
57-
pub(crate) value_length: usize,
57+
pub value_length: usize,
5858
}
5959

6060
#[repr(C)]
6161
#[derive(Debug)]
6262
pub struct FFI_AdbcDatabase {
6363
/// Opaque implementation-defined state.
6464
/// This field is NULLPTR iff the connection is uninitialized/freed.
65-
pub(crate) private_data: *mut c_void,
65+
pub private_data: *mut c_void,
6666
/// The associated driver (used by the driver manager to help track state).
67-
pub(crate) private_driver: *const FFI_AdbcDriver,
67+
pub private_driver: *const FFI_AdbcDriver,
6868
}
6969

7070
unsafe impl Send for FFI_AdbcDatabase {}
@@ -74,9 +74,9 @@ unsafe impl Send for FFI_AdbcDatabase {}
7474
pub struct FFI_AdbcConnection {
7575
/// Opaque implementation-defined state.
7676
/// This field is NULLPTR iff the connection is uninitialized/freed.
77-
pub(crate) private_data: *mut c_void,
77+
pub private_data: *mut c_void,
7878
/// The associated driver (used by the driver manager to help track state).
79-
pub(crate) private_driver: *const FFI_AdbcDriver,
79+
pub private_driver: *const FFI_AdbcDriver,
8080
}
8181

8282
unsafe impl Send for FFI_AdbcConnection {}
@@ -86,9 +86,9 @@ unsafe impl Send for FFI_AdbcConnection {}
8686
pub struct FFI_AdbcStatement {
8787
/// Opaque implementation-defined state.
8888
/// This field is NULLPTR iff the connection is uninitialized/freed.
89-
pub(crate) private_data: *mut c_void,
89+
pub private_data: *mut c_void,
9090
/// The associated driver (used by the driver manager to help track state).
91-
pub(crate) private_driver: *const FFI_AdbcDriver,
91+
pub private_driver: *const FFI_AdbcDriver,
9292
}
9393

9494
unsafe impl Send for FFI_AdbcStatement {}
@@ -97,28 +97,28 @@ unsafe impl Send for FFI_AdbcStatement {}
9797
#[derive(Debug)]
9898
pub struct FFI_AdbcPartitions {
9999
/// The number of partitions.
100-
num_partitions: usize,
100+
pub num_partitions: usize,
101101

102102
/// The partitions of the result set, where each entry (up to
103103
/// num_partitions entries) is an opaque identifier that can be
104104
/// passed to AdbcConnectionReadPartition.
105105
// It's defined as a const const pointer in C but we need to release it so it
106106
// probably needs to be mutable.
107-
partitions: *mut *mut u8,
107+
pub partitions: *mut *mut u8,
108108

109109
/// The length of each corresponding entry in partitions.
110110
// It's defined as a const pointer in C but we need to release it so it
111111
// probably needs to be mutable.
112-
partition_lengths: *mut usize,
112+
pub partition_lengths: *mut usize,
113113

114114
/// Opaque implementation-defined state.
115115
/// This field is NULLPTR iff the connection is uninitialized/freed.
116-
pub(crate) private_data: *mut c_void,
116+
pub private_data: *mut c_void,
117117

118118
/// Release the contained partitions.
119119
/// Unlike other structures, this is an embedded callback to make it
120120
/// easier for the driver manager and driver to cooperate.
121-
release: Option<unsafe extern "C" fn(*mut Self)>,
121+
pub release: Option<unsafe extern "C" fn(*mut Self)>,
122122
}
123123

124124
#[repr(C)]
@@ -127,12 +127,12 @@ pub struct FFI_AdbcDriver {
127127
/// Opaque driver-defined state.
128128
/// This field is NULL if the driver is uninitialized/freed (but
129129
/// it need not have a value even if the driver is initialized).
130-
pub(crate) private_data: *mut c_void,
130+
pub private_data: *mut c_void,
131131
/// Opaque driver manager-defined state.
132132
/// This field is NULL if the driver is uninitialized/freed (but
133133
/// it need not have a value even if the driver is initialized).
134-
pub(crate) private_manager: *const c_void,
135-
pub(crate) release: Option<
134+
pub private_manager: *const c_void,
135+
pub release: Option<
136136
unsafe extern "C" fn(driver: *mut Self, error: *mut FFI_AdbcError) -> AdbcStatusCode,
137137
>,
138138
pub DatabaseInit: Option<methods::FuncDatabaseInit>,

0 commit comments

Comments
 (0)