Skip to content

Latest commit

 

History

History
166 lines (133 loc) · 3.86 KB

README.md

File metadata and controls

166 lines (133 loc) · 3.86 KB

nick-name

rustc >= 1.68.0 MIT/Apache 2 ci run

What?

Nickname is Cross-Platform Rust user defined device-name(nick-name) get set library.

use

cargo add nick-name
let nickname = nick_name::NickName::new().unwrap();
let device_name = nickname.get().unwrap();
println!("{device_name}");

#[cfg(not(any(target_os = "ios", target_os = "android")))]
{
  let set = nickname.set("oligami-pc");
  println!("{:?}", set);

  let device_name = nickname.get().unwrap();
  println!("{device_name}");
}

Look at examples

Support platforms

  • linux systems (Linux, FreeBSD, OpenBSD, NetBSD, Solaris, Redox, and so on)
  • Windows
  • Android
  • iPhone

Verify

https://doc.rust-lang.org/nightly/rustc/platform-support.html

O success
X failed
- non verify

Target build test run clippy fmt miri doc
Tier1 O O O O O O linux(get)
O Windows
X others
-
Android O O O cargo-apk
X cargo-dinghy
O O X -
iPhone O O O cargo-bundle
O cargo-dinghy
O O X -
Tier2 O - - O O X -

cannot support platform yet

next support platform yet

  • watchOS
  • visionOS
  • WearOS
  • BlueOS

function

Android

  • get

iPhone

  • get

Windows, Linux, macOS

  • get
  • set

! Windows don't set %username% yet ! Windows set user cmd

! macOS is not stable because not using native api yet

build

look README.md on example https://github.com/nziq53/nickname/tree/main/examples/common

next

all

  • add test ※ zero tests(now)

  • Match structure functions

macOS

  • use native api
  • be able to miri

Android

  • be able to miri
  • check permission func by using ndk
  • add require permission func

iPhone

  • be able to miri

linux

  • be able to miri on set func

apply rust new features ≧MSVC(1.68.0)

1.74

Add promoting tier2 target
  • add loongarch64-unknown-none
Use no-fail-test
  • cargo test --tests --no-fail-fast
Raise minimum supported Apple OS versions
  • macOS: 10.12 Sierra
  • iOS: 10

1.72

Add promoting tier2 target
  • add loongarch64-unknown-linux-gnu

extension function

Android

  • finish
    call finishAndRemoveTask()
  • get_device_api_level
    get api_level
    call VERSION.SDK_INT
  • check_permission_old
    check permission
  • check_permission_new
    check permission

github actions test on mobile

android

  • api-level 24: error: "API level 25 or higher is required"
  • api-level 30: Android SDK built for x86_64
  • api-level 33: sdk_gphone_x86_64

Platform information

Android

Switch functions depending on API level

lowest API level 5 min API level < 25

  • Android Emulator don't has bluetooth feature and cannot get nickname
  • Require BLUETOOTH permission
  • Update is required reboot

25 <= min API level

  • Update is not required reboot
  • Not require permission

Restriction

This library use native api by Android JavaVM.
So, cargo dinghy and ffi binding must failed.

If you ffi binding, you call init func.

JavaVM

If you call using JavaVM func first, have JavaVM attach. To attach JavaVM is heavy. You drop NickName and free JavaVM attach.

License

Licensed under either of