open_entry_bindings/
string.rs1use crate::virtual_thread::VThread;
2
3pub struct VMStr(*const u64, VThread);
4
5impl VMStr {
6 #[inline(always)] pub async fn from_str(value: String, thread: VThread) -> VMStr {
7 unsafe { crate::VMStr__from_str.unwrap_unchecked()(value, thread).await }
8 }
9
10 #[inline(always)] pub fn str_eq(a: &VMStr, b: &VMStr) -> bool {
11 unsafe { crate::VMStr__str_eq.unwrap_unchecked()(a, b) }
12 }
13
14 #[inline(always)] pub fn parse(&self) -> Option<f64> {
15 unsafe { crate::VMStr__parse.unwrap_unchecked()(self) }
16 }
17
18 #[inline(always)] pub fn from(value: u64, thread: VThread) -> VMStr {
19 unsafe { crate::VMStr__from.unwrap_unchecked()(value, thread) }
20 }
21
22 #[inline(always)] pub fn as_vm_value(&self) -> u64 {
23 unsafe { crate::VMStr__as_vm_value.unwrap_unchecked()(self) }
24 }
25
26 #[inline(always)] pub fn ptr(&self) -> *const u8 {
27 unsafe { crate::VMStr__ptr.unwrap_unchecked()(self) }
28 }
29
30 #[inline(always)] pub fn as_str(&self) -> &str {
31 unsafe { crate::VMStr__as_str.unwrap_unchecked()(self) }
32 }
33
34 #[inline(always)] pub fn len(&self) -> u64 {
35 unsafe { crate::VMStr__len.unwrap_unchecked()(self) }
36 }
37
38 #[inline(always)] pub async fn drop(&self) {
39 unsafe { crate::VMStr__drop.unwrap_unchecked()(self).await }
40 }
41
42 #[inline(always)] pub async fn push(&mut self, other: &VMStr) {
43 unsafe { crate::VMStr__push.unwrap_unchecked()(self, VMStr(other.0, other.1.clone())).await }
44 }
45
46 #[inline(always)] pub async fn cloned_push(&mut self, other: &VMStr) -> VMStr {
47 unsafe { crate::VMStr__cloned_push.unwrap_unchecked()(self, VMStr(other.0, other.1.clone())).await }
48 }
49}