|
43 | 43 | //! pub struct SettingsMap(NonZeroU64);
|
44 | 44 | //!
|
45 | 45 | //! #[repr(transparent)]
|
| 46 | +//! pub struct SettingsList(NonZeroU64); |
| 47 | +//! |
| 48 | +//! #[repr(transparent)] |
46 | 49 | //! pub struct SettingValue(NonZeroU64);
|
47 | 50 | //!
|
48 | 51 | //! #[repr(transparent)]
|
|
295 | 298 | //! key_ptr: *const u8,
|
296 | 299 | //! key_len: usize,
|
297 | 300 | //! ) -> Option<SettingValue>;
|
| 301 | +//! /// Gets the length of a settings map. |
| 302 | +//! pub fn settings_map_len(map: SettingsMap) -> u64; |
| 303 | +//! /// Gets the key of a setting value from the settings map based on the index |
| 304 | +//! /// by storing it into the buffer provided. Returns `false` if the buffer is |
| 305 | +//! /// too small. After this call, no matter whether it was successful or not, |
| 306 | +//! /// the `buf_len_ptr` will be set to the required buffer size. If `false` is |
| 307 | +//! /// returned and the `buf_len_ptr` got set to 0, the index is out of bounds. |
| 308 | +//! /// The key is guaranteed to be valid UTF-8 and is not nul-terminated. |
| 309 | +//! pub fn settings_map_get_key_by_index( |
| 310 | +//! map: SettingsMap, |
| 311 | +//! idx: u64, |
| 312 | +//! buf_ptr: *mut u8, |
| 313 | +//! buf_len_ptr: *mut usize, |
| 314 | +//! ) -> bool; |
| 315 | +//! /// Gets a copy of the setting value from the settings map based on the |
| 316 | +//! /// index. Returns `None` if the index is out of bounds. Any changes to it |
| 317 | +//! /// are only perceived if it's stored back. You own the setting value and |
| 318 | +//! /// are responsible for freeing it. |
| 319 | +//! pub fn settings_map_get_value_by_index(map: SettingsMap, idx: u64) -> Option<SettingValue>; |
| 320 | +//! |
| 321 | +//! /// Creates a new settings list. You own the settings list and are |
| 322 | +//! /// responsible for freeing it. |
| 323 | +//! pub fn settings_list_new() -> SettingsList; |
| 324 | +//! /// Frees a settings list. |
| 325 | +//! pub fn settings_list_free(list: SettingsList); |
| 326 | +//! /// Copies a settings list. No changes inside the copy affect the original |
| 327 | +//! /// settings list. You own the new settings list and are responsible for |
| 328 | +//! /// freeing it. |
| 329 | +//! pub fn settings_list_copy(list: SettingsList) -> SettingsList; |
| 330 | +//! /// Gets the length of a settings list. |
| 331 | +//! pub fn settings_list_len(list: SettingsList) -> u64; |
| 332 | +//! /// Gets a copy of the setting value from the settings list based on the |
| 333 | +//! /// index. Returns `None` if the index is out of bounds. Any changes to it |
| 334 | +//! /// are only perceived if it's stored back. You own the setting value and |
| 335 | +//! /// are responsible for freeing it. |
| 336 | +//! pub fn settings_list_get(list: SettingsList, idx: u64) -> Option<SettingValue>; |
| 337 | +//! /// Pushes a copy of the setting value to the end of the settings list. You |
| 338 | +//! /// still retain ownership of the setting value, which means you still need |
| 339 | +//! /// to free it. |
| 340 | +//! pub fn settings_list_push(list: SettingsList, value: SettingValue); |
| 341 | +//! /// Inserts a copy of the setting value into the settings list at the index |
| 342 | +//! /// given. If the index is out of bounds, the setting value is pushed to the |
| 343 | +//! /// end of the settings list. You still retain ownership of the setting |
| 344 | +//! /// value, which means you still need to free it. |
| 345 | +//! pub fn settings_list_insert(list: SettingsList, idx: u64, value: SettingValue); |
298 | 346 | //!
|
299 | 347 | //! /// Creates a new setting value from a settings map. The value is a copy of
|
300 | 348 | //! /// the settings map. Any changes to the original settings map afterwards
|
301 | 349 | //! /// are not going to be perceived by the setting value. You own the setting
|
302 | 350 | //! /// value and are responsible for freeing it. You also retain ownership of
|
303 | 351 | //! /// the settings map, which means you still need to free it.
|
304 | 352 | //! pub fn setting_value_new_map(value: SettingsMap) -> SettingValue;
|
| 353 | +//! /// Creates a new setting value from a settings list. The value is a copy of |
| 354 | +//! /// the settings list. Any changes to the original settings list afterwards |
| 355 | +//! /// are not going to be perceived by the setting value. You own the setting |
| 356 | +//! /// value and are responsible for freeing it. You also retain ownership of |
| 357 | +//! /// the settings list, which means you still need to free it. |
| 358 | +//! pub fn setting_value_new_list(value: SettingsList) -> SettingValue; |
305 | 359 | //! /// Creates a new boolean setting value. You own the setting value and are
|
306 | 360 | //! /// responsible for freeing it.
|
307 | 361 | //! pub fn setting_value_new_bool(value: bool) -> SettingValue;
|
|
317 | 371 | //! pub fn setting_value_new_string(value_ptr: *const u8, value_len: usize) -> SettingValue;
|
318 | 372 | //! /// Frees a setting value.
|
319 | 373 | //! pub fn setting_value_free(value: SettingValue);
|
| 374 | +//! /// Copies a setting value. No changes inside the copy affect the original |
| 375 | +//! /// setting value. You own the new setting value and are responsible for |
| 376 | +//! /// freeing it. |
| 377 | +//! pub fn setting_value_copy(value: SettingValue) -> SettingValue; |
320 | 378 | //! /// Gets the value of a setting value as a settings map by storing it into
|
321 | 379 | //! /// the pointer provided. Returns `false` if the setting value is not a
|
322 | 380 | //! /// settings map. No value is stored into the pointer in that case. No
|
323 | 381 | //! /// matter what happens, you still retain ownership of the setting value,
|
324 | 382 | //! /// which means you still need to free it. You own the settings map and are
|
325 | 383 | //! /// responsible for freeing it.
|
326 | 384 | //! pub fn setting_value_get_map(value: SettingValue, value_ptr: *mut SettingsMap) -> bool;
|
| 385 | +//! /// Gets the value of a setting value as a settings list by storing it into |
| 386 | +//! /// the pointer provided. Returns `false` if the setting value is not a |
| 387 | +//! /// settings list. No value is stored into the pointer in that case. No |
| 388 | +//! /// matter what happens, you still retain ownership of the setting value, |
| 389 | +//! /// which means you still need to free it. You own the settings list and are |
| 390 | +//! /// responsible for freeing it. |
| 391 | +//! pub fn setting_value_get_list(value: SettingValue, value_ptr: *mut SettingsList) -> bool; |
327 | 392 | //! /// Gets the value of a boolean setting value by storing it into the pointer
|
328 | 393 | //! /// provided. Returns `false` if the setting value is not a boolean. No
|
329 | 394 | //! /// value is stored into the pointer in that case. No matter what happens,
|
@@ -392,6 +457,6 @@ mod timer;
|
392 | 457 |
|
393 | 458 | pub use process::Process;
|
394 | 459 | pub use runtime::{Config, CreationError, InterruptHandle, Runtime, RuntimeGuard};
|
395 |
| -pub use settings::{SettingValue, SettingsMap, UserSetting, UserSettingKind}; |
| 460 | +pub use settings::{SettingValue, SettingsList, SettingsMap, UserSetting, UserSettingKind}; |
396 | 461 | pub use time;
|
397 | 462 | pub use timer::{Timer, TimerState};
|
0 commit comments