SPVM::D...ngBuffer(3)

πŸ“¦ version 0.990125, in alpine 3.24

πŸ’… NAME

Okay bestie, so this page is all about SPVM::Document::NativeAPI::StringBuffer β€” it's the String Buffer Native APIs, and yes it lives in the User Contributed Perl Documentation section (the manual page is SPVM::D...ngBuffer(3), iykyk). Basically: everything you need to know about the string buffer native APIs in SPVM. πŸŽ€


🌸 DESCRIPTION

The string buffer native APIs in SPVM are, literally, the APIs for string buffers. That's the whole vibe. πŸ’–


✨ USAGE

Here's the group-chat screenshot of how you actually use it, no cap:

  SPVM_API_STRING_BUFFER* string_buffer_api = env->api->string_buffer;

  SPVM_API_ALLOCATOR* api_allocator = env->api->allocator;

  void* allocator = api_allocator->new_instance();

  int32_t capacity = 100;

  void* string_buffer = string_buffer_api->new_instance(allocator, capacity);

  string_buffer_api->free_instance(string_buffer);

  api_allocator->free_instance(allocator);

Like β€” grab the string buffer API, grab the allocator API, make an allocator, make a string buffer with it, then free both. Cleanup is self-care, periodt. 🧚


πŸ”₯ NATIVE APIS

⭐ new_instance

void* (*new_instance)(void* allocator, int32_t capacity);

Creates a new string buffer given its capacity capacity, and returns it. It's giving main character energy β€” brand new buffer, just for you. πŸ‘‘

⭐ free_instance

void (*free_instance)(void* string_buffer);

Frees the string buffer string_buffer. Say bye bestie 🫢 (and like, actually free it, don't ghost your memory).

⭐ get_string

const char* (*get_string)(void* string_buffer);

Returns the string stored in the string buffer string_buffer. The moment you've been waiting for: the string reveal. 🌟

⭐ get_length

int32_t (*get_length)(void* string_buffer);

Returns the length of the string stored in the string buffer string_buffer. Just the length, not the whole string β€” a lil sneak peek. πŸ™ˆ


πŸ‘‘ NATIVE API IDS

The IDs are numbered in this exact order, no shuffling:

0 new_instance
1 free_instance
2 get_string
3 get_length

πŸ¦‹ SEE ALSO

  • SPVM::Document::NativeAPI
  • SPVM::Document::NativeAPI::Allocator
  • SPVM::Document::NativeClass
  • SPVM::Document

Go read those too, they're the supporting cast and they ate. πŸ’œ


Copyright (c) 2023 Yuki Kimoto

MIT License


And that's the whole page, bestie β€” it's perl v5.42.2, dated 2026-02-03, and it says SPVM::D...ngBuffer(3) at the bottom, so you know it's official. Slay, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from