diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-03 23:15:17 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | 6264254065bbae9d89f51cf3330379b7ace09592 (patch) | |
| tree | 9ece1d1739215c2faef2d808ef4fdc019ad527fa /rust/src/lib.rs | |
| parent | c3fdda9727f5507818e3f55576ad32215a22b0f9 (diff) | |
[Rust] Return `String` instead of `BnString` for cases where lossy conversion can be tolerated
Still need to go and audit all usage, but realistically the most important places to give the user control are with symbols, where the data can come from non utf8 sources
This is still incomplete, I just looked for usage of -> BnString so any other variant was omitted.
Diffstat (limited to 'rust/src/lib.rs')
| -rw-r--r-- | rust/src/lib.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index a3df0cd3..0446fe60 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -433,8 +433,8 @@ pub trait ObjectDestructor: 'static + Sync + Sized { } } -pub fn version() -> BnString { - unsafe { BnString::from_raw(BNGetVersionString()) } +pub fn version() -> String { + unsafe { BnString::into_string(BNGetVersionString()) } } pub fn build_id() -> u32 { @@ -512,16 +512,16 @@ pub fn version_info() -> VersionInfo { VersionInfo::from_owned_raw(info_raw) } -pub fn serial_number() -> BnString { - unsafe { BnString::from_raw(BNGetSerialNumber()) } +pub fn serial_number() -> String { + unsafe { BnString::into_string(BNGetSerialNumber()) } } pub fn is_license_validated() -> bool { unsafe { BNIsLicenseValidated() } } -pub fn licensed_user_email() -> BnString { - unsafe { BnString::from_raw(BNGetLicensedUserEmail()) } +pub fn licensed_user_email() -> String { + unsafe { BnString::into_string(BNGetLicensedUserEmail()) } } pub fn license_path() -> PathBuf { @@ -547,12 +547,12 @@ pub fn set_license<S: BnStrCompatible + Default>(license: Option<S>) { #[cfg(feature = "demo")] pub fn set_license<S: BnStrCompatible + Default>(_license: Option<S>) {} -pub fn product() -> BnString { - unsafe { BnString::from_raw(BNGetProduct()) } +pub fn product() -> String { + unsafe { BnString::into_string(BNGetProduct()) } } -pub fn product_type() -> BnString { - unsafe { BnString::from_raw(BNGetProductType()) } +pub fn product_type() -> String { + unsafe { BnString::into_string(BNGetProductType()) } } pub fn license_expiration_time() -> std::time::SystemTime { |
