objc2_system_configuration/generated/
SCPreferencesSetSpecific.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8/// Updates the computer name preference.
9///
10/// Note: To commit these changes to permanent storage you must
11/// call the SCPreferencesCommitChanges function.
12/// In addition, you must call the SCPreferencesApplyChanges
13/// function for the new name to become active.
14///
15/// Parameter `prefs`: The preferences session.
16///
17/// Parameter `name`: The computer name to be set.
18///
19/// Parameter `nameEncoding`: The encoding associated with the computer name.
20///
21/// Returns: Returns TRUE if successful; FALSE otherwise.
22#[cfg(feature = "SCPreferences")]
23#[inline]
24pub unsafe extern "C-unwind" fn SCPreferencesSetComputerName(
25    prefs: &SCPreferences,
26    name: Option<&CFString>,
27    name_encoding: CFStringEncoding,
28) -> bool {
29    extern "C-unwind" {
30        fn SCPreferencesSetComputerName(
31            prefs: &SCPreferences,
32            name: Option<&CFString>,
33            name_encoding: CFStringEncoding,
34        ) -> Boolean;
35    }
36    let ret = unsafe { SCPreferencesSetComputerName(prefs, name, name_encoding) };
37    ret != 0
38}
39
40/// Updates the local host name.
41///
42/// Note: To commit these changes to permanent storage you must
43/// call the SCPreferencesCommitChanges function.
44/// In addition, you must call the SCPreferencesApplyChanges
45/// function for the new name to become active.
46///
47/// Parameter `prefs`: The preferences session.
48///
49/// Parameter `name`: The local host name to be set.
50///
51/// Note: this string must conform to the naming conventions of a DNS host
52/// name as specified in RFC 1034 (section 3.5).
53///
54/// Returns: Returns TRUE if successful; FALSE otherwise.
55#[cfg(feature = "SCPreferences")]
56#[inline]
57pub unsafe extern "C-unwind" fn SCPreferencesSetLocalHostName(
58    prefs: &SCPreferences,
59    name: Option<&CFString>,
60) -> bool {
61    extern "C-unwind" {
62        fn SCPreferencesSetLocalHostName(prefs: &SCPreferences, name: Option<&CFString>)
63            -> Boolean;
64    }
65    let ret = unsafe { SCPreferencesSetLocalHostName(prefs, name) };
66    ret != 0
67}