| 1 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#; |
| 2 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#; |
| 3 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/; |
| 4 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/; |
| 5 | |
| 6 | use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/; |
| 7 | pub type VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<T> = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Resultrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/Result#>; |
| 8 | |
| 9 | impl vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Resultrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/Result# { |
| 10 | #[inline] |
| 11 | pub fn resultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result().(self) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<()> { |
| 12 | self.result_with_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result_with_success().(()) |
| 13 | } |
| 14 | |
| 15 | #[inline] |
| 16 | pub fn result_with_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result_with_success().<T>(self, v: T) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<T> { |
| 17 | match self { |
| 18 | Selfrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]::SUCCESSrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/impl#[Result]SUCCESS. => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(v), |
| 19 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self), |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | #[inline] |
| 24 | pub unsafe fn assume_init_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]assume_init_on_success().<T>(self, v: memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#<T>) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<T> { |
| 25 | self.resultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(move |()| v.assume_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]assume_init().()) |
| 26 | } |
| 27 | |
| 28 | #[inline] |
| 29 | pub unsafe fn set_vec_len_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]set_vec_len_on_success().<T>(self, mut v: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>, len: usize) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>> { |
| 30 | self.resultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(move |()| { |
| 31 | v.set_lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]set_len().(len); |
| 32 | v |
| 33 | }) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, ensuring all |
| 38 | /// available data has been read into the vector. |
| 39 | /// |
| 40 | /// See for example [`vkEnumerateInstanceExtensionProperties`]: the number of available items may |
| 41 | /// change between calls; [`vk::Result::INCOMPLETE`] is returned when the count increased (and the |
| 42 | /// vector is not large enough after querying the initial size), requiring Ash to try again. |
| 43 | /// |
| 44 | /// [`vkEnumerateInstanceExtensionProperties`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html |
| 45 | pub(craterust-analyzer cargo ash 0.38.0+1.3.281 crate/) unsafe fn read_into_uninitialized_vectorrust-analyzer cargo ash 0.38.0+1.3.281 prelude/read_into_uninitialized_vector().<N: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#<usize>, T>( |
| 46 | f: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut N, *mut T) -> vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Resultrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/Result#, |
| 47 | ) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>> |
| 48 | where |
| 49 | <N as TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#<usize>>::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#Error#: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 50 | { |
| 51 | loop { |
| 52 | let mut count = N::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().(); |
| 53 | f(&mut count, ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().()).resultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 54 | let mut data = |
| 55 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(count.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("`N` failed to convert to `usize`")); |
| 56 | |
| 57 | let err_code = f(&mut count, data.as_mut_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_mut_ptr().()); |
| 58 | if err_code rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Resultrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/Result#::INCOMPLETErust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/impl#[Result]INCOMPLETE. { |
| 59 | break err_code.set_vec_len_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]set_vec_len_on_success().( |
| 60 | data, |
| 61 | count.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("`N` failed to convert to `usize`"), |
| 62 | ); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, ensuring all |
| 68 | /// available data has been read into the vector. |
| 69 | /// |
| 70 | /// Items in the target vector are [`default()`][Default::default()]-initialized which is required |
| 71 | /// for [`vk::BaseOutStructure`]-like structs where [`vk::BaseOutStructure::s_type`] needs to be a |
| 72 | /// valid type and [`vk::BaseOutStructure::p_next`] a valid or [`null`][ptr::null_mut()] |
| 73 | /// pointer. |
| 74 | /// |
| 75 | /// See for example [`vkEnumerateInstanceExtensionProperties`]: the number of available items may |
| 76 | /// change between calls; [`vk::Result::INCOMPLETE`] is returned when the count increased (and the |
| 77 | /// vector is not large enough after querying the initial size), requiring Ash to try again. |
| 78 | /// |
| 79 | /// [`vkEnumerateInstanceExtensionProperties`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html |
| 80 | pub(craterust-analyzer cargo ash 0.38.0+1.3.281 crate/) unsafe fn read_into_defaulted_vectorrust-analyzer cargo ash 0.38.0+1.3.281 prelude/read_into_defaulted_vector().< |
| 81 | N: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#<usize>, |
| 82 | T: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 83 | >( |
| 84 | f: impl Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut N, *mut T) -> vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Resultrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/Result#, |
| 85 | ) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T>> |
| 86 | where |
| 87 | <N as TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#<usize>>::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#Error#: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 88 | { |
| 89 | loop { |
| 90 | let mut count = N::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().(); |
| 91 | f(&mut count, ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().()).resultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]result().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 92 | let mut data = allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().(); count.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("`N` failed to convert to `usize`")]; |
| 93 | |
| 94 | let err_code = f(&mut count, data.as_mut_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_mut_ptr().()); |
| 95 | if err_code rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Resultrust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/Result#::INCOMPLETErust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/impl#[Result]INCOMPLETE. { |
| 96 | break err_code.set_vec_len_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]set_vec_len_on_success().( |
| 97 | data, |
| 98 | count.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("`N` failed to convert to `usize`"), |
| 99 | ); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | #[cfg(feature = "debug")] |
| 105 | pub(craterust-analyzer cargo ash 0.38.0+1.3.281 crate/) fn debug_flagsrust-analyzer cargo ash 0.38.0+1.3.281 prelude/debug_flags().<Value: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<u64> + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>( |
| 106 | f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>, |
| 107 | known: &[(Value, &'static str)], |
| 108 | value: Value, |
| 109 | ) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 110 | let mut first = true; |
| 111 | let mut accum = value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 112 | for &(bit, name) in known { |
| 113 | let bit = bit.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 114 | if bit rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]ne().0 && accum rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().bit rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().bit { |
| 115 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().first { |
| 116 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(" | ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 117 | } |
| 118 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 119 | first = false; |
| 120 | accum rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAndAssign<Self>`]bitand_assign().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][Not]not().bit; |
| 121 | } |
| 122 | } |
| 123 | if accum rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]ne().0 { |
| 124 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().first { |
| 125 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(" | ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 126 | } |
| 127 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{accum:b}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 128 | } |
| 129 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 130 | } |