Debian Codegraph @

src/util.rs

raw symbols SCIP
1 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/;
2 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#;
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#;
4 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#;
5 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/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().;
6 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/;
7 #[cfg(feature = "std")]
8 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
9
10 /// [`Align`] handles dynamic alignment. The is useful for dynamic uniform buffers where
11 /// the alignment might be different. For example a 4x4 f32 matrix has a size of 64 bytes
12 /// but the min alignment for a dynamic uniform buffer might be 256 bytes. A slice of `&[Mat4x4<f32>]`
13 /// has a memory layout of `[[64 bytes], [64 bytes], [64 bytes]]`, but it might need to have a memory
14 /// layout of `[[256 bytes], [256 bytes], [256 bytes]]`.
15 /// [`Align::copy_from_slice`] will copy a slice of `&[T]` directly into the host memory without
16 /// an additional allocation and with the correct alignment.
17 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
18 pub struct Alignrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#<T> {
19 ptrrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#ptr.: *mut c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#,
20 elem_sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#elem_size.: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#,
21 sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#size.: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#,
22 _mrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#_m.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<T>,
23 }
24
25 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
26 pub struct AlignIterrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#<'a, T> {
27 alignrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#align.: &'a mut Alignrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#<T>,
28 currentrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#current.: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#,
29 }
30
31 impl<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#> Alignrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#<T> {
32 pub fn copy_from_slicerust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`Align<T>`]copy_from_slice().(&mut self, slice: &[T]) {
33 if self.elem_sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#elem_size. 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().size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() as u64 {
34 unsafe {
35 let mapped_slice = slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/::from_raw_parts_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts_mut().(self.ptrrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#ptr..castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().(), slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
36 mapped_slice.copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(slice);
37 }
38 } else {
39 for (i, val) in self.iter_mutrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`Align<T>`]iter_mut().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) {
40 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().val = slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
41 }
42 }
43 }
44 }
45
46 fn calc_paddingrust-analyzer cargo ash 0.38.0+1.3.281 util/calc_padding().(adr: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#, align: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#) -> vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize# {
47 (align rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().adr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem().align) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem().align
48 }
49
50 impl<T> Alignrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#<T> {
51 pub unsafe fn newrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`Align<T>`]new().(ptr: *mut c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#, alignment: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#, size: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`Align<T>`] {
52 let padding = calc_paddingrust-analyzer cargo ash 0.38.0+1.3.281 util/calc_padding().(size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() as vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize#, alignment);
53 let elem_size = size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() as vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::DeviceSizerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/DeviceSize# rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().padding;
54 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(calc_paddingrust-analyzer cargo ash 0.38.0+1.3.281 util/calc_padding().(size, alignment) == 0, "size must be aligned");
55 Selfrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`Align<T>`] {
56 ptrrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#ptr.,
57 elem_sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#elem_size.,
58 sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#size.,
59 _mrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#_m.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
60 }
61 }
62
63 pub fn iter_mutrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`Align<T>`]iter_mut().(&mut self) -> AlignIterrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#<'_, T> {
64 AlignIterrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter# {
65 currentrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#current.: 0,
66 alignrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#align.: self,
67 }
68 }
69 }
70
71 impl<'a, T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + 'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for AlignIterrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#<'a, T> {
72 type Itemrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`AlignIter<'a, T>`][Iterator]Item# = &'a mut T;
73 fn nextrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`AlignIter<'a, T>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo ash 0.38.0+1.3.281 util/impl#[`AlignIter<'a, T>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
74 if self.currentrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#current. 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().self.alignrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#align..sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#size. {
75 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
76 }
77 unsafe {
78 // Need to cast to *mut u8 because () has size 0
79 let ptr = (self.alignrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#align..ptrrust-analyzer cargo ash 0.38.0+1.3.281 util/Align#ptr..castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().::<u8>())
80 .offsetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]offset().(self.currentrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#current. as isize)
81 .castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().();
82 self.currentrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#current. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().self.alignrust-analyzer cargo ash 0.38.0+1.3.281 util/AlignIter#align..elem_sizerust-analyzer cargo ash 0.38.0+1.3.281 util/Align#elem_size.;
83 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().ptr)
84 }
85 }
86 }
87
88 /// Decode SPIR-V from bytes.
89 ///
90 /// This function handles SPIR-V of arbitrary endianness gracefully, and returns correctly aligned
91 /// storage.
92 ///
93 /// # Examples
94 /// ```no_run
95 /// // Decode SPIR-V from a file
96 /// let mut file = std::fs::File::open("/path/to/shader.spv").unwrap();
97 /// let words = ash::util::read_spv(&mut file).unwrap();
98 /// ```
99 /// ```
100 /// // Decode SPIR-V from memory
101 /// const SPIRV: &[u8] = &[
102 /// // ...
103 /// # 0x03, 0x02, 0x23, 0x07,
104 /// ];
105 /// let words = ash::util::read_spv(&mut std::io::Cursor::new(&SPIRV[..])).unwrap();
106 /// ```
107 #[cfg(feature = "std")]
108 pub fn read_spvrust-analyzer cargo ash 0.38.0+1.3.281 util/read_spv().<R: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# + iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#>(x: &mut R) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u32>> {
109 // TODO use stream_len() once it is stabilized and remove the subsequent rewind() call
110 let size = x.seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#seek().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Endrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#End#(0))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
111 x.rewindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#rewind().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
112 if size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Rem<Self>`]rem().4 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 {
113 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(
114 iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#,
115 "input length not divisible by 4",
116 ));
117 }
118 if size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX. as u64 {
119 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, "input too long"));
120 }
121 let words = (size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Div<Self>`]div().4) as usize;
122 // https://github.com/ash-rs/ash/issues/354:
123 // Zero-initialize the result to prevent read_exact from possibly
124 // reading uninitialized memory.
125 let mut result = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0u32; words];
126 x.read_exactrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#read_exact().(unsafe {
127 slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/::from_raw_parts_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts_mut().(result.as_mut_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_mut_ptr().().castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().::<u8>(), words rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().4)
128 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
129 const MAGIC_NUMBERrust-analyzer cargo ash 0.38.0+1.3.281 util/MAGIC_NUMBER.: u32 = 0x0723_0203;
130 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().result.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() && result[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().MAGIC_NUMBERrust-analyzer cargo ash 0.38.0+1.3.281 util/MAGIC_NUMBER..swap_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]swap_bytes().() {
131 for word in &mut result {
132 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().word = word.swap_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]swap_bytes().();
133 }
134 }
135 if result.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() || result[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().MAGIC_NUMBERrust-analyzer cargo ash 0.38.0+1.3.281 util/MAGIC_NUMBER. {
136 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(
137 iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#,
138 "input missing SPIR-V magic number",
139 ));
140 }
141 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
142 }