File tree Expand file tree Collapse file tree 4 files changed +42
-3
lines changed Expand file tree Collapse file tree 4 files changed +42
-3
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " springql-client-c"
3
- version = " 0.3.0 "
3
+ version = " 0.3.1 "
4
4
5
5
authors = [
" Sho Nakatani <[email protected] >" ]
6
6
license = " MIT OR Apache-2.0"
@@ -15,6 +15,6 @@ name = "springql_client"
15
15
cbindgen = " 0.21"
16
16
17
17
[dependencies ]
18
- springql-core = " 0.3"
18
+ springql-core = " 0.3.1 "
19
19
20
20
log = " 0.4"
Original file line number Diff line number Diff line change @@ -106,7 +106,9 @@ int main()
106
106
{
107
107
SpringErrno ret ;
108
108
109
- SpringConfig * config = spring_config_default ();
109
+ SpringConfig * config = spring_config_toml (
110
+ "[memory]\n"
111
+ "upper_limit_bytes = 1_000_000\n" );
110
112
assert_not_null (config );
111
113
112
114
SpringPipeline * pipeline = spring_open (config );
Original file line number Diff line number Diff line change @@ -44,9 +44,24 @@ typedef void *SpringRow;
44
44
45
45
/**
46
46
* See: springql_core::api::spring_config_default
47
+ *
48
+ * Returned value is not modifiable (it is just a void pointer).
49
+ * If you would like to change the default configuration, use `spring_config_toml()` instead.
47
50
*/
48
51
SpringConfig * spring_config_default (void );
49
52
53
+ /**
54
+ * See: springql_core::api::spring_config_default
55
+ *
56
+ * Returned value is not modifiable (it is just a void pointer).
57
+ * If you would like to change the default configuration, use `spring_config_toml()` instead.
58
+ *
59
+ * # Safety
60
+ *
61
+ * This function is unsafe because it uses raw pointer.
62
+ */
63
+ SpringConfig * spring_config_toml (const char * overwrite_config_toml );
64
+
50
65
/**
51
66
* # Returns
52
67
*
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ pub struct SpringPipeline(*mut c_void);
36
36
pub struct SpringRow ( * mut c_void ) ;
37
37
38
38
/// See: springql_core::api::spring_config_default
39
+ ///
40
+ /// Returned value is not modifiable (it is just a void pointer).
41
+ /// If you would like to change the default configuration, use `spring_config_toml()` instead.
39
42
#[ no_mangle]
40
43
pub extern "C" fn spring_config_default ( ) -> * mut SpringConfig {
41
44
let config = springql_core:: spring_config_default ( ) ;
@@ -44,6 +47,25 @@ pub extern "C" fn spring_config_default() -> *mut SpringConfig {
44
47
} ) ) )
45
48
}
46
49
50
+ /// See: springql_core::api::spring_config_default
51
+ ///
52
+ /// Returned value is not modifiable (it is just a void pointer).
53
+ /// If you would like to change the default configuration, use `spring_config_toml()` instead.
54
+ ///
55
+ /// # Safety
56
+ ///
57
+ /// This function is unsafe because it uses raw pointer.
58
+ #[ no_mangle]
59
+ pub unsafe extern "C" fn spring_config_toml (
60
+ overwrite_config_toml : * const c_char ,
61
+ ) -> * mut SpringConfig {
62
+ let s = { CStr :: from_ptr ( overwrite_config_toml) } ;
63
+ let s = s. to_str ( ) . expect ( "failed to parse TOML string into UTF-8" ) ;
64
+
65
+ let config = springql_core:: spring_config_toml ( s) . expect ( "failed to parse TOML config" ) ;
66
+ Box :: into_raw ( Box :: new ( SpringConfig ( mem:: transmute ( Box :: new ( config) ) ) ) )
67
+ }
68
+
47
69
/// # Returns
48
70
///
49
71
/// - `0`: if there are no recent errors.
You can’t perform that action at this time.
0 commit comments