ZyanStringView

Type Alias ZyanStringView 

Source
pub type ZyanStringView = ZyanStringView_;
Expand description

Defines the ZyanStringView struct.

The ZyanStringView type provides a view inside a string (ZyanString instances, null- terminated C-style strings, or even not-null-terminated custom strings). A view is immutable by design and can’t be directly converted to a C-style string.

Views might become invalid (e.g. pointing to invalid memory), if the underlying string gets destroyed or resized.

The ZYAN_STRING_TO_VIEW macro can be used to cast a ZyanString to a ZyanStringView pointer without any runtime overhead. Casting a view to a normal string is not supported and will lead to unexpected behavior (use ZyanStringDuplicate to create a deep-copy instead).

All fields in this struct should be considered as “private”. Any changes may lead to unexpected behavior.

Aliased Type§

#[repr(C)]
pub struct ZyanStringView { pub string: ZyanString_, }

Fields§

§string: ZyanString_

The string data.

The view internally re-uses the normal string struct to allow casts without any runtime overhead.