use std::ffi::c_char;
use ohos_web_sys::{OH_ArkWeb_ReleaseByteArray, OH_ArkWeb_ReleaseString};
pub struct CommonString {
pub(crate) raw: *mut c_char,
}
impl Drop for CommonString {
fn drop(&mut self) {
unsafe {
OH_ArkWeb_ReleaseString(self.raw);
}
}
}
impl Into<String> for CommonString {
fn into(self) -> String {
unsafe {
let s = std::ffi::CStr::from_ptr(self.raw);
s.to_string_lossy().to_string()
}
}
}
pub struct CommonBytes {
pub(crate) raw: *mut u8,
}
impl Drop for CommonBytes {
fn drop(&mut self) {
unsafe {
OH_ArkWeb_ReleaseByteArray(self.raw);
}
}
}
pub type ResponseCharset = CommonString;
pub type ResponseHeaderKey = CommonString;
pub type ResponseHeaderValue = CommonString;
pub type ResponseMimeType = CommonString;
pub type ResponseStatusText = CommonString;
pub type Url = CommonString;
pub type Method = CommonString;
pub type Referrer = CommonString;