sz_rust_sdk/core/
product.rs1use crate::{error::SzResult, traits::SzProduct, types::JsonString};
4
5pub struct SzProductCore;
7
8impl SzProductCore {
9 pub(crate) fn new() -> SzResult<Self> {
12 Ok(Self)
13 }
14}
15
16impl SzProduct for SzProductCore {
17 fn get_license(&self) -> SzResult<JsonString> {
18 let license_ptr = unsafe { crate::ffi::SzProduct_getLicense() };
19 if license_ptr.is_null() {
20 return Err(crate::error::SzError::unknown("Failed to get license"));
21 }
22 unsafe { crate::ffi::helpers::c_str_to_string_no_free(license_ptr) }
23 }
24
25 fn get_version(&self) -> SzResult<JsonString> {
26 let version_ptr = unsafe { crate::ffi::SzProduct_getVersion() };
27 if version_ptr.is_null() {
28 return Err(crate::error::SzError::unknown("Failed to get version"));
29 }
30 unsafe { crate::ffi::helpers::c_str_to_string_no_free(version_ptr) }
31 }
32}
33
34