MCPcopy Create free account
hub / github.com/digama0/lean-sys / lean_alloc_string

Function lean_alloc_string

src/string.rs:5–13  ·  view source on GitHub ↗
(size: usize, capacity: usize, len: usize)

Source from the content-addressed store, hash-verified

3
4#[inline(always)]
5pub unsafe fn lean_alloc_string(size: usize, capacity: usize, len: usize) -> lean_obj_res {
6 let o = lean_alloc_object(core::mem::size_of::<lean_string_object>() + capacity)
7 as *mut lean_string_object;
8 lean_set_st_header(o as *mut _, LeanString as u32, 0);
9 (raw_field!(o, lean_string_object, m_size) as *mut usize).write(size);
10 (raw_field!(o, lean_string_object, m_capacity) as *mut usize).write(capacity);
11 (raw_field!(o, lean_string_object, m_length) as *mut usize).write(len);
12 o as *mut _
13}
14
15#[inline(always)]
16pub unsafe fn lean_string_capacity(o: *mut lean_object) -> usize {

Callers

nothing calls this directly

Calls 1

lean_set_st_headerFunction · 0.85

Tested by

no test coverage detected