[][src]Function hostname::set

pub fn set<T>(hostname: T) -> Result<()> where
    T: AsRef<OsStr>, 

Set the system hostname.

This function is available only with set feature enabled (disabled by default).




In order to set new hostname, caller might need to have the corresponding privilege (CAP_SYS_ADMIN capability for Linux, administrator privileges for Windows, and so on).
An error variant will be returned if this function will encounter a permission error or any other form of error.


  • Will fail with a linkage error for Android API < 23 (see #9)