[][src]Function hostname::set

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

Set the system hostname.

Example

hostname::set("potato")?;

Errors

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.