Skip to content

Commit

Permalink
Release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
svartalf committed Apr 1, 2024
1 parent e96d1fd commit 0e311b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2024-04-01

### Added

- CI setup now covers almost all supported Tier 1 and Tier 2 platform targets

### Changed

- Minimum Supported Rust version set to `1.67.0`
- Rust edition set to "2021"

### Fixed

- Handle edge cases for POSIX systems (#14)
- docs.rs documentation build

## [0.3.1] - 2020-02-28

### Fixed
Expand Down
21 changes: 5 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ Set and get the host name:
```rust,no_run
# use std::io;
# use std::ffi::OsStr;
# fn try_main() -> io::Result<()> {
# fn main() -> io::Result<()> {
hostname::set("potato")?;
let new_name = hostname::get()?;
assert_eq!(new_name, OsStr::new("potato"));
# Ok(())
# }
# fn main() {
# try_main().unwrap();
# }
```
"#
)]
Expand All @@ -27,14 +24,11 @@ Get the host name:
```rust,no_run
# use std::io;
# use std::ffi::OsStr;
# fn try_main() -> io::Result<()> {
# fn main() -> io::Result<()> {
let name = hostname::get()?;
println!("{:?}", name);
# Ok(())
# }
# fn main() {
# try_main().unwrap();
# }
```
"#
)]
Expand All @@ -54,6 +48,7 @@ println!("{:?}", name);
unused_import_braces,
unused_results
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

use cfg_if::cfg_if;

Expand All @@ -80,13 +75,10 @@ cfg_if! {
///
/// ```rust
/// # use std::io;
/// # fn try_main() -> io::Result<()> {
/// # fn main() -> io::Result<()> {
/// let name = hostname::get()?;
/// # Ok(())
/// # }
/// # fn main() {
/// # try_main().unwrap();
/// # }
/// ```
///
/// ## Errors
Expand All @@ -108,13 +100,10 @@ pub fn get() -> io::Result<OsString> {
```rust,no_run
# use std::io;
# fn try_main() -> io::Result<()> {
# fn main() -> io::Result<()> {
hostname::set("potato")?;
# Ok(())
# }
# fn main() {
# try_main().unwrap();
# }
```
"#
)]
Expand Down
8 changes: 4 additions & 4 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use std::io;
use std::os::windows::ffi::OsStrExt;
use std::os::windows::ffi::OsStringExt;

use windows::Win32::System::SystemInformation::ComputerNamePhysicalDnsHostname;
use windows::core::PWSTR;
use windows::Win32::System::SystemInformation::{
ComputerNamePhysicalDnsHostname, GetComputerNameExW,
};

pub fn get() -> io::Result<OsString> {
use windows::core::PWSTR;
use windows::Win32::System::SystemInformation::GetComputerNameExW;

let mut size = 0;
unsafe {
// Don't care much about the result here,
Expand Down

0 comments on commit 0e311b9

Please sign in to comment.