Debian Codegraph @

src/vk/prelude.rs

raw symbols SCIP
1 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_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#;
2 use 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/;
3
4 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/;
5
6 /// Holds 24 bits in the least significant bits of memory,
7 /// and 8 bytes in the most significant bits of that memory,
8 /// occupying a single [`u32`] in total. This is commonly used in
9 /// [acceleration structure instances] such as
10 /// [`vk::AccelerationStructureInstanceKHR`],
11 /// [`vk::AccelerationStructureSRTMotionInstanceNV`] and
12 /// [`vk::AccelerationStructureMatrixMotionInstanceNV`].
13 ///
14 /// [acceleration structure instances]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkAccelerationStructureInstanceKHR.html#_description
15 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
16 #[repr(transparent)]
17 pub struct Packed24_8rust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/Packed24_8#(u32);
18
19 impl Packed24_8rust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/Packed24_8# {
20 pub fn newrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[Packed24_8]new().(low_24: u32, high_8: u8) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[Packed24_8] {
21 Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[Packed24_8]((low_24 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x00ff_ffff) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().(u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(high_8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().24))
22 }
23
24 /// Extracts the least-significant 24 bits (3 bytes) of this integer
25 pub fn low_24rust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[Packed24_8]low_24().(&self) -> u32 {
26 self.0rust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/Packed24_8#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0xffffff
27 }
28
29 /// Extracts the most significant 8 bits (single byte) of this integer
30 pub fn high_8rust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[Packed24_8]high_8().(&self) -> u8 {
31 (self.0rust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/Packed24_8#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().24) as u8
32 }
33 }
34
35 impl vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::ColorComponentFlagsrust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/ColorComponentFlags# {
36 /// Contraction of [`R`][Self::R] | [`G`][Self::G] | [`B`][Self::B] | [`A`][Self::A]
37 pub const RGBArust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`]RGBA.: Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`] = Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`](Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`]::Rrust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/impl#[ColorComponentFlags]R..0rust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/ColorComponentFlags#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`]::Grust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/impl#[ColorComponentFlags]G..0rust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/ColorComponentFlags#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`]::Brust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/impl#[ColorComponentFlags]B..0rust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/ColorComponentFlags#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::ColorComponentFlags`]::Arust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/impl#[ColorComponentFlags]A..0rust-analyzer cargo ash 0.38.0+1.3.281 vk/bitflags/ColorComponentFlags#0.);
38 }
39
40 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Extent2Drust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent2D#> for vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Extent3Drust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent3D# {
41 fn fromrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::Extent3D`][`From<vk::Extent2D>`]from().(value: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Extent2Drust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent2D#) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::Extent3D`][`From<vk::Extent2D>`] {
42 Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::Extent3D`][`From<vk::Extent2D>`] {
43 widthrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent3D#width.: value.widthrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent2D#width.,
44 heightrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent3D#height.: value.heightrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent2D#height.,
45 depthrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent3D#depth.: 1,
46 }
47 }
48 }
49
50 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Extent2Drust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent2D#> for vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Rect2Drust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Rect2D# {
51 fn fromrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::Rect2D`][`From<vk::Extent2D>`]from().(extent: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Extent2Drust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Extent2D#) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::Rect2D`][`From<vk::Extent2D>`] {
52 Selfrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[`vk::Rect2D`][`From<vk::Extent2D>`] {
53 offsetrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Rect2D#offset.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/impl#[Offset2D][Default]default().(),
54 extentrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Rect2D#extent.,
55 }
56 }
57 }
58
59 /// Structures implementing this trait are layout-compatible with [`vk::BaseInStructure`] and
60 /// [`vk::BaseOutStructure`]. Such structures have an `s_type` field indicating its type, which
61 /// must always match the value of [`TaggedStructure::STRUCTURE_TYPE`].
62 pub unsafe trait TaggedStructurerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/TaggedStructure# {
63 const STRUCTURE_TYPErust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/TaggedStructure#STRUCTURE_TYPE.: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::StructureTyperust-analyzer cargo ash 0.38.0+1.3.281 vk/enums/StructureType#;
64 }
65
66 #[inline]
67 pub(craterust-analyzer cargo ash 0.38.0+1.3.281 crate/) fn wrap_c_str_slice_until_nulrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/wrap_c_str_slice_until_nul().(
68 str: &[c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#],
69 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&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/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#, 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/::FromBytesUntilNulErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/FromBytesUntilNulError#> {
70 // SAFETY: The cast from c_char to u8 is ok because a c_char is always one byte.
71 let bytes = unsafe { 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/::from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts().(str.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().().castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().(), str.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) };
72 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/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_bytes_until_nulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_bytes_until_nul().(bytes)
73 }
74
75 #[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:)]
76 pub struct CStrTooLargeForStaticArrayrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray# {
77 pub static_array_sizerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#static_array_size.: usize,
78 pub c_str_sizerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#c_str_size.: usize,
79 }
80 #[cfg(feature = "std")]
81 impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for CStrTooLargeForStaticArrayrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray# {}
82 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for CStrTooLargeForStaticArrayrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray# {
83 fn fmtrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/impl#[CStrTooLargeForStaticArray][Display]fmt().(&self, f: &mut 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#<'_>) -> 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# {
84 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(
85 f,
86 "static `c_char` target array of length `{}` is too small to write a `CStr` (with `NUL`-terminator) of length `{}`",
87 self.static_array_sizerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#static_array_size., self.c_str_sizerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#c_str_size.
88 )
89 }
90 }
91
92 #[inline]
93 pub(craterust-analyzer cargo ash 0.38.0+1.3.281 crate/) fn write_c_str_slice_with_nulrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/write_c_str_slice_with_nul().(
94 target: &mut [c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#],
95 str: &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/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#,
96 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), CStrTooLargeForStaticArrayrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#> {
97 let bytes = str.to_bytes_with_nulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]to_bytes_with_nul().();
98 // SAFETY: The cast from c_char to u8 is ok because a c_char is always one byte.
99 let bytes = unsafe { 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/::from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts().(bytes.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().().castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().(), bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) };
100 let static_array_size = target.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
101 target
102 .get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().())
103 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(CStrTooLargeForStaticArrayrust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray# {
104 static_array_sizerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#static_array_size.,
105 c_str_sizerust-analyzer cargo ash 0.38.0+1.3.281 vk/prelude/CStrTooLargeForStaticArray#c_str_size.: bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(),
106 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
107 .copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(bytes);
108 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
109 }