Skip to content

Commit

Permalink
Add Target trait for implementing new targets (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
AldaronLau authored Jan 27, 2024
1 parent e3da4c5 commit d7885e7
Show file tree
Hide file tree
Showing 15 changed files with 1,390 additions and 1,246 deletions.
138 changes: 135 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,56 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog], and this project adheres to
[Semantic Versioning].

## [1.5.0] - UNRELEASED

### Added

- Fallible functions
- `whoami::fallible::devicename()`
- `whoami::fallible::devicename_os()`
- `whoami::fallible::distro()`
- `whoami::fallible::hostname()`
- `whoami::fallible::realname()`
- `whoami::fallible::realname_os()`
- `whoami::fallible::username()`
- `whoami::fallible::username_os()`
- `whoami::langs()`
- `Language`
- `Country`

### Removed

- Generated device names that infer casing based on the hostname when the
device name is not available - now returns the hostname unchanged

### Changed

- Deprecated `whoami::distro_os()`
- Deprecated `whoami::hostname_os()`
- Deprecated `whoami::lang()`

### Fixed

- Removed some unnecessary allocations
- Rare and nearly impossible cases of undefined behavior
- Better handling of UTF-8 non-conformant strings

## [1.4.1] - 2023-06-25

### Fixed

- License files not being included in package on crates.io

## [1.4.0] - 2023-03-12

### Added

- Support for Illumos

## [1.3.0] - 2022-12-28

### Added

- `Arch` enum listing CPU architectures
- `Width` enum listing CPU architecture address widths
- `arch()` function which returns an `Arch` type representing a CPU
Expand All @@ -27,9 +67,11 @@ The format is based on [Keep a Changelog], and this project adheres to
- Convenience `Result` type alias.

### Changed

- Modernized and cleaned up code style

### Fixed

- Handling of `lang()` when `$LANG` environment variable on unix set to "C",
causing duplicated iterator elements `["C", "C"]`; now produces `["en-US"]`.
- WhoAmI reporting "Safari" when running in Chrome/Chromium browser
Expand All @@ -39,83 +81,112 @@ The format is based on [Keep a Changelog], and this project adheres to
"GNOME Web")

## [1.2.3] - 2022-09-12

### Fixed

- WebAssembly target requiring older versions of dependencies

## [1.2.2] - 2022-09-05

### Added
- More details to the method documentation

### Changed

- WhoAmI now has an official MSRV of Rust 1.40.0
- `whoami::hostname()` is now normalized to lowercase

## [1.2.1] - 2021-11-24

### Fixed
- The Windows GNU target support being broken

## [1.2.0] - 2021-11-06

### Added
- Derives for `Clone`, `PartialEq` and `Eq` on `DesktopEnv` and `Platform`

### Changed
- Lower MSRV for Windows

## [1.1.5] - 2021-09-28

### Fixed

- Segfault that occurs when passwd entry missing in docker

## [1.1.4] - 2021-09-26

### Changed

- There are no longer any known panics within the code, all possible panics
with whoami are now considered bugs.
- If any of the primary functions return an empty string, whoami should now
return "Unknown" or"unknown", or for `hostname()`, "localhost".

### Fixed

- Panicking in situations where certain files don't exist / OS functions fail.

## [1.1.3] - 2021-08-17

### Fixed

- Circumstance where whoami points to invalid memory on Linux.

## [1.1.2] - 2021-04-03

### Fixed

- Not parsing the gecos field properly on unix systems (affects the
`realname()` and `realname_os()` functions; they will no longer return
extraneous commas on some systems).

## [1.1.1] - 2021-03-13

### Fixed

- Not compiling on target `x86_64-pc-windows-gnu`.

## [1.1.0] - 2021-01-17

### Added

- `lang()` function which returns an iterator over user's preferred language(s)

## [1.0.3] - 2020-12-31

### Fixed

- Link to logo in documentation.

## [1.0.2] - 2020-12-31

### Changed

- `distro()` on Windows now returns more detailed version.

## [1.0.1] - 2020-12-16

### Added

- Official support for BSD and variants

### Fixed

- `platform()` will now return `Platform::Bsd` when running BSD.
- Misaligned address error on FreeBSD when calling `username()`.

## [1.0.0] - 2020-11-23

### Removed
- `Platform::Dive` and `DesktopEnv::Dive`, as that was an OS idea not a real OS
- Explicit support for `stdweb`, now built on `web-sys`/`wasm-bindgen`.

## [0.9.0] - 2020-06-24

### Added

- `stdweb` and `wasm-bindgen` support
- Versions of `-> String` functions that return `OsString`s:
- `devicename_os()`
Expand All @@ -125,6 +196,7 @@ The format is based on [Keep a Changelog], and this project adheres to
- `username_os()`

### Changed

- Renamed `DesktopEnv::Mac` to `DesktopEnv::Aqua`
- Renamed `DesktopEnv::Wasm` to `DesktopEnv::WebBrowser`
- Renamed `DesktopEnv::Redox` to `DesktopEnv::Orbital`
Expand All @@ -136,136 +208,196 @@ The format is based on [Keep a Changelog], and this project adheres to
- Renamed `user()` to `realname()`

### Fixed

- Inconsistencies on Windows
- MacOS running commands instead of using native APIs (this results in speed
improvements on MacOS)
- One of the Linux functions also using commands instead of native APIs (faster)

### Contributors

Thanks to everyone who contributed to make this version of whoami possible!

- [AldaronLau](https://github.com/AldaronLau)
- [Vlad-Shcherbina](https://github.com/Vlad-Shcherbina)

## [0.8.2] - 2020-06-11

### Changed

- Windows `host()` and `hostname()` now behave like they do on Linux and MacOS

### Fixed

- Windows FFI Undefined Behavior because of not checking for errors
- Cross-compiling from Linux to Windows not working

## [0.8.1] - 2020-02-22

### Fixed

- Remove unnecessary use of `to_mut()` on `Cow`s returned from
`String::from_utf8_lossy()`.

## [0.8.0] - 2020-02-21

### Added

- Detection for KDE desktop environment.

### Changed

- Unknown desktop environment may now contain lowercase characters.

### Fixed

- No longer unwraps in any place where bad data from the OS could cause
a panic.

## [0.7.0] - 2019-12-21

### Removed

- `stdweb` dependency when targetting web assembly.

### Changed

- All public enums now have the attribute `#[non_exhaustive]` and derive
`Debug`.

### Fixed

- Some out-of-date documentation

## [0.6.0] - 2019-10-25

### Added

- Web Assembly support.

### Removed

- `Platform::Web` variant of enum, use `env()` if you need to.

### Changed

- `platform()` is no longer a const fn (needed for wasm platform
detection).

## [0.5.3] - 2019-07-18

### Changed

- Now uses a more modern Rust coding style (replace `::std::` with `std::`).
- Now uses a more modern Rust coding style with `mem::MaybeUninit`.
- `impl Display` for desktop environment now uses proper capitalization.
- Don't depend on `libc` anymore.

### Fixed

- Fancy Names not working on Windows
- `user()` now uses Windows Display Name on Windows rather than the username.
- `host()` now uses Windows Name DNS Fully Qualified rather than the hostname.
- `host()` now uses Windows Name DNS Fully Qualified rather than the
hostname.

## [0.5.2] - 2019-05-12

### Fixed

- Fixed more broken links!

## [0.5.1] - 2019-05-12

### Fixed
- Clippy lint warning: change `expect(&format!("…"))` to `expect("…")` for optimization in 2 cases.

- Clippy lint warning: change `expect(&format!("…"))` to `expect("…")` for
optimization in 2 cases.
- Fixed broken links

## [0.5.0] - 2019-03-17

### Added

- `Platform` enum with corresponding `platform()` function.
- `Dive`, `Fuchsia`, and `Redox` to `DesktopEnv` enum.

### Changed

- Started using `const fn` for some functions.

## [0.4.1] - 2019-01-12

### Fixed

- Fixed README errors.

## [0.4.0] - 2019-01-12

### Added

- MacOS support.

### Changed
- `env` on Ubuntu now returns DesktopEnv::Ubuntu instead of DesktopEnv::Other("UBUNTU")

- `env` on Ubuntu now returns `DesktopEnv::Ubuntu` instead of
`DesktopEnv::Other("UBUNTU")`
- Split off the binary into `whome` (who me?) crate

## [0.3.0] - 2019-01-04

### Added

- Added more fallbacks.

### Changed

- Rename realname -> user
- Rename computer -> host

### Fixed

- Fix typo for uknown -> unknown.

## [0.2.4] - 2018-12-04

### Fixed

- Works now on platforms that use u8 instead of i8 for chars (like ARM).

## [0.2.3] - 2018-11-26

### Fixed

- Trailing newline on Windows.

## [0.2.2] - 2018-06-02

### Fixed

- Typo in markdown.

## [0.2.1] - 2018-06-02

### Fixed

- Undefined behavior on Linux.

## [0.2.0] - 2017-12-28

### Added

- Windows support.

## [0.1.1] - 2017-08-04

### Fixed

- Something in the markdown.

## [0.1.0] - 2017-08-04

### Added

- Published to crates.io.

[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ target Rust 1.65.0 and later to make use of the `let else` syntax.
Rust) that depends on this crate.

## License
Copyright © 2017-2023 The WhoAmI Contributors.
Copyright © 2017-2024 The WhoAmI Contributors.

Licensed under any of
- Apache License, Version 2.0, ([LICENSE_APACHE][7]
Expand Down
Loading

0 comments on commit d7885e7

Please sign in to comment.