Type Alias vulkanalia::vk::ExtensionName

source ·
pub type ExtensionName = StringArray<vulkanalia_sys::::extensions::ExtensionName::{constant#0}>;
Expand description

A Vulkan extension name.

Aliased Type§

struct ExtensionName(/* private fields */);

Implementations§

source§

impl<const N: usize> StringArray<N>

source

pub fn new(array: [i8; N]) -> StringArray<N>

Constructs a string array from a character array.

Panics
  • characters does not contain a null-terminator
source

pub const fn from_bytes(bytes: &[u8]) -> StringArray<N>

Constructs a string array from a byte string.

If the byte string is longer than N - 1, then the byte string will be truncated to fit inside of the constructed string array (the last character is reserved for a null terminator). The constructed string array will always be null-terminated regardless if the byte string is or is not null-terminated.

source

pub fn from_cstr(cstr: &CStr) -> StringArray<N>

Constructs a string array from a borrowed C string.

If the borrowed C string is longer than N - 1, then the borrowed C string will be truncated to fit inside of the constructed string array (the last character is reserved for a null terminator).

source

pub unsafe fn from_ptr(ptr: *const i8) -> StringArray<N>

Constructs a string array from a pointer to a null-terminated string.

If the null-terminated string is longer than N - 1, then the null-terminated string will be truncated to fit inside of the constructed string array (the last character is reserved for a null terminator).

Safety
  • ptr must be a pointer to a null-terminated string
source

pub fn as_array(&self) -> &[i8; N]

Gets the underlying character array for this string array.

source

pub fn as_bytes(&self) -> &[u8]

Gets this string array as a slice of bytes.

source

pub fn as_cstr(&self) -> &CStr

Gets this string array as a borrowed C string.

source

pub fn to_string_lossy(&self) -> Cow<'_, str>

Converts this string array to a UTF-8 string (lossily).

Methods from Deref<Target = [i8; N]>§

source

pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into a array of ASCII characters, or returns None if any of the characters is non-ASCII.

Examples
#![feature(ascii_char)]
#![feature(const_option)]

const HEX_DIGITS: [std::ascii::Char; 16] =
    *b"0123456789abcdef".as_ascii().unwrap();

assert_eq!(HEX_DIGITS[1].as_str(), "1");
assert_eq!(HEX_DIGITS[10].as_str(), "a");
source

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into a array of ASCII characters, without checking whether they’re valid.

Safety

Every byte in the array must be in 0..=127, or else this is UB.

1.57.0 · source

pub fn as_slice(&self) -> &[T]

Returns a slice containing the entire array. Equivalent to &s[..].

source

pub fn each_ref(&self) -> [&T; N]

🔬This is a nightly-only experimental API. (array_methods)

Borrows each element and returns an array of references with the same size as self.

Example
#![feature(array_methods)]

let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

#![feature(array_methods)]

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);
source

pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index.

The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

Panics

Panics if M > N.

Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.split_array_ref::<0>();
   assert_eq!(left, &[]);
   assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<2>();
    assert_eq!(left, &[1, 2]);
    assert_eq!(right, &[3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<6>();
    assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
    assert_eq!(right, &[]);
}
source

pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index from the end.

The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).

Panics

Panics if M > N.

Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.rsplit_array_ref::<0>();
   assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
   assert_eq!(right, &[]);
}

{
    let (left, right) = v.rsplit_array_ref::<2>();
    assert_eq!(left, &[1, 2, 3, 4]);
    assert_eq!(right, &[5, 6]);
}

{
    let (left, right) = v.rsplit_array_ref::<6>();
    assert_eq!(left, &[]);
    assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
source

pub fn as_array(&self) -> &[i8; N]

Gets the underlying character array for this string array.

source

pub fn as_bytes(&self) -> &[u8]

Gets this string array as a slice of bytes.

source

pub fn as_cstr(&self) -> &CStr

Gets this string array as a borrowed C string.

source

pub fn to_string_lossy(&self) -> Cow<'_, str>

Converts this string array to a UTF-8 string (lossily).

Trait Implementations§

source§

impl<const N: usize> Clone for StringArray<N>

source§

fn clone(&self) -> StringArray<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const N: usize> Debug for StringArray<N>

source§

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

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

impl<const N: usize> Default for StringArray<N>

source§

fn default() -> StringArray<N>

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

impl<const N: usize> Deref for StringArray<N>

§

type Target = [i8; N]

The resulting type after dereferencing.
source§

fn deref(&self) -> &<StringArray<N> as Deref>::Target

Dereferences the value.
source§

impl<const N: usize> Display for StringArray<N>

source§

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

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

impl<const N: usize> From<[i8; N]> for StringArray<N>

source§

fn from(array: [i8; N]) -> StringArray<N>

Converts to this type from the input type.
source§

impl<const N: usize> Hash for StringArray<N>

source§

fn hash<H>(&self, hasher: &mut H)where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<const N: usize> PartialEq<StringArray<N>> for StringArray<N>

source§

fn eq(&self, other: &StringArray<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize> Copy for StringArray<N>

source§

impl<const N: usize> Eq for StringArray<N>