erupt/utils/
mod.rs

1#![warn(missing_docs)]
2
3//! Utilities to aid your usage of this crate.
4
5#[cfg(feature = "bytemuck")]
6mod bytemuck;
7mod decode_spv;
8pub mod features;
9#[cfg(feature = "loading")]
10pub mod loading;
11#[cfg(feature = "surface")]
12pub mod surface;
13mod vulkan_result;
14
15pub use decode_spv::*;
16use std::iter;
17pub use vulkan_result::*;
18
19/// Returns an iterator over all nodes in the given pointer chain.
20///
21/// ## Safety
22/// Assumes all `p_next` pointers in the pointer chain are valid.
23pub unsafe fn iterate_ptr_chain(
24    mut node: *mut crate::vk1_0::BaseOutStructure,
25) -> impl Iterator<Item = *mut crate::vk1_0::BaseOutStructure> {
26    iter::from_fn(move || {
27        if node.is_null() {
28            None
29        } else {
30            let current_item = node;
31            node = (*node).p_next;
32            Some(current_item)
33        }
34    })
35}