Type Alias BSFixedStringW

Source
pub type BSFixedStringW = BSFixedStringInternal<U16>;
Expand description

Fixed length wide C string.

§Encoding

Since this is an FFI type, the encoding is not guaranteed. It may be UTF-16LE, UTF-32LE, or platform-specific wide encoding, as it uses wchar_t internally.

Therefore, when using this string, it is recommended to convert it to &str to handle it safely.

Aliased Type§

struct BSFixedStringW { /* private fields */ }

Implementations§

Source§

impl BSFixedStringW

Source

pub const EMPTY: &'static [u16]

A constant pointer to an empty string.

Source

pub const unsafe fn new_unchecked(data: *const u16) -> Self

§Safety

data must be a pointer to a null-terminated UTF-16LE string.

Source

pub fn as_wide(&self) -> &[u16]

Convert as [u16]

Source

pub fn to_string_lossy(&self) -> String

Decode a UTF-16–encoded slice v into a String

Source

pub fn to_string(&self) -> Result<String, FromUtf16Error>

Decode a UTF-16–encoded vector v into a String.

§Errors

Invalid UTF-16 encoding

Trait Implementations§

Source§

impl Debug for BSFixedStringW

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BSFixedStringW

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for BSFixedStringW

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BSFixedStringW

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.