Skip to content

Commit

Permalink
Add android to supported unix-like os target list (#35)
Browse files Browse the repository at this point in the history
add android to supported unix-like oses
  • Loading branch information
topongo authored Nov 14, 2023
1 parent c56ae81 commit 7044d5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["mac", "address", "network", "interface"]
[dependencies]
serde = { version = "1.0.117", features = ["derive"], optional = true }

[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "android"))'.dependencies]
nix = "0.23.1"

[target.'cfg(windows)'.dependencies]
Expand Down
3 changes: 3 additions & 0 deletions examples/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ fn main() {
#[cfg(target_os = "windows")]
let name = "Ethernet";

#[cfg(target_os = "android")]
let name = "wlan0";

match mac_address_by_name(name) {
Ok(Some(ma)) => {
println!("MAC addr of {} = {}", name, ma);
Expand Down
3 changes: 2 additions & 1 deletion src/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ mod internal;
target_os = "linux",
target_os = "macos",
target_os = "freebsd",
target_os = "openbsd"
target_os = "openbsd",
target_os = "android",
))]
#[path = "linux.rs"]
mod internal;
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ mod os;
target_os = "linux",
target_os = "macos",
target_os = "freebsd",
target_os = "openbsd"
target_os = "openbsd",
target_os = "android",
))]
#[path = "linux.rs"]
mod os;
Expand All @@ -31,11 +32,13 @@ pub enum MacAddressError {
InternalError,
}


#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "freebsd",
target_os = "openbsd"
target_os = "openbsd",
target_os = "android",
))]
impl From<nix::Error> for MacAddressError {
fn from(_: nix::Error) -> MacAddressError {
Expand Down

0 comments on commit 7044d5d

Please sign in to comment.