WebGPU Headers
The WebGPU C API
 
Loading...
Searching...
No Matches
WGPUStringView Struct Reference

Data Fields

char const * data
 
size_t length
 

Detailed Description

Nullable value defining a pointer+length view into a UTF-8 encoded string.

Values passed into the API may use the special length value WGPU_STRLEN to indicate a null-terminated string. Non-null values passed out of the API (for example as callback arguments) always provide an explicit length and may or may not be null-terminated.

Some inputs to the API accept null values. Those which do not accept null values "default" to the empty string when null values are passed.

Values are encoded as follows:

  • {NULL, WGPU_STRLEN}: the null value.
  • {non_null_pointer, WGPU_STRLEN}: a null-terminated string view.
  • {any, 0}: the empty string.
  • {NULL, non_zero_length}: not allowed (null dereference).
  • {non_null_pointer, non_zero_length}: an explictly-sized string view with size non_zero_length (in bytes).

For info on how this is used in various places, see Strings.

Definition at line 120 of file webgpu.h.

Field Documentation

◆ data

char const* WGPUStringView::data

Definition at line 121 of file webgpu.h.

◆ length

size_t WGPUStringView::length

Definition at line 122 of file webgpu.h.