Trait CStr

Source
pub trait CStr {
    // Required method
    fn to_vec(&self) -> Vec<u8>;
}
Expand description

A helper trait to convert Rust strings into null-terminated C strings.

This trait is implemented for &str to simplify the creation of CStr values for use with Windows APIs.

Required Methods§

Source

fn to_vec(&self) -> Vec<u8>

Converts a Rust string slice into a null-terminated C string.

§Returns
  • A vector of bytes containing the C-style string (null-terminated).

Implementations on Foreign Types§

Source§

impl CStr for &str

Source§

fn to_vec(&self) -> Vec<u8>

Implementors§