#![no_std]
#![doc = include_str!("../README.md")]
#![expect(non_upper_case_globals)]
mod raw {
#![expect(dead_code)]
#![expect(non_camel_case_types)]
#![expect(non_snake_case)]
include!("../generated/bindings.rs");
include!("../generated/bitmasks.rs");
}
include!("../generated/lib.rs");
pub const WGPU_TRUE: WGPUBool = 1;
pub const WGPU_FALSE: WGPUBool = 0;
pub const WGPU_ARRAY_LAYER_COUNT_UNDEFINED: u32 = u32::MAX;
pub const WGPU_COPY_STRIDE_UNDEFINED: u32 = u32::MAX;
pub const WGPU_DEPTH_CLEAR_VALUE_UNDEFINED: f32 = f32::NAN;
pub const WGPU_DEPTH_SLICE_UNDEFINED: u32 = u32::MAX;
pub const WGPU_LIMIT_U32_UNDEFINED: u32 = u32::MAX;
pub const WGPU_LIMIT_U64_UNDEFINED: u64 = u64::MAX;
pub const WGPU_MIP_LEVEL_COUNT_UNDEFINED: u32 = u32::MAX;
pub const WGPU_QUERY_SET_INDEX_UNDEFINED: u32 = u32::MAX;
pub const WGPU_STRLEN: usize = usize::MAX;
pub const WGPU_WHOLE_MAP_SIZE: usize = usize::MAX;
pub const WGPU_WHOLE_SIZE: u64 = u64::MAX;
impl WGPUStringView {
pub fn null() -> Self {
Self {
data: core::ptr::null(),
length: WGPU_STRLEN,
}
}
pub fn empty() -> Self {
Self {
data: core::ptr::null(),
length: 0,
}
}
pub fn is_null(&self) -> bool {
self == &Self::null()
}
pub fn is_empty(&self) -> bool {
self.length == 0
}
}
impl From<&str> for WGPUStringView {
fn from(s: &str) -> Self {
Self {
data: s.as_ptr().cast(),
length: s.len(),
}
}
}
impl From<Option<&str>> for WGPUStringView {
fn from(s: Option<&str>) -> Self {
s.map_or(Self::null(), Self::from)
}
}