Browse Source

cargo fmt

master
Alison Watson 1 year ago
parent
commit
2195993cbb
26 changed files with 230 additions and 173 deletions
  1. +1
    -1
      rustfmt.toml
  2. +1
    -1
      source/hal.rs
  3. +3
    -1
      source/hal/context.rs
  4. +1
    -2
      source/hal/err.rs
  5. +8
    -2
      source/hal/window.rs
  6. +32
    -38
      source/main.rs
  7. +2
    -2
      source/render.rs
  8. +18
    -12
      source/render/cmd.rs
  9. +19
    -12
      source/render/device.rs
  10. +7
    -3
      source/render/fence.rs
  11. +7
    -3
      source/render/framebuffer.rs
  12. +7
    -3
      source/render/image.rs
  13. +7
    -3
      source/render/imageview.rs
  14. +13
    -5
      source/render/instance.rs
  15. +25
    -16
      source/render/pipeline.rs
  16. +3
    -1
      source/render/properties.rs
  17. +7
    -2
      source/render/queue.rs
  18. +7
    -3
      source/render/semaphore.rs
  19. +10
    -3
      source/render/shader.rs
  20. +1
    -4
      source/render/spir.rs
  21. +7
    -3
      source/render/surface.rs
  22. +38
    -46
      source/render/swapchain.rs
  23. +1
    -4
      source/util/ffi.rs
  24. +1
    -1
      source/util/log/color.rs
  25. +3
    -1
      source/util/log/conf.rs
  26. +1
    -1
      source/util/log/standard.rs

+ 1
- 1
rustfmt.toml View File

@@ -3,4 +3,4 @@ max_width = 80
newline_style = "Unix"
tab_spaces = 3
use_field_init_shorthand = true
use_small_heuristics = "Off"
use_small_heuristics = "Max"

+ 1
- 1
source/hal.rs View File

@@ -7,7 +7,7 @@ pub use self::{
context::Context,
err::ErrSdl,
event::{Event, EventIterator},
window::Window
window::Window,
};

// EOF

+ 3
- 1
source/hal/context.rs View File

@@ -6,7 +6,9 @@ pub struct Context;
impl Context {
pub fn new() -> Result<Self, ErrSdl> {
let init_flags = sdl::SDL_INIT_VIDEO;
unsafe { sdl::SDL_SetMainReady(); }
unsafe {
sdl::SDL_SetMainReady();
}
if unsafe { sdl::SDL_Init(init_flags) } == 0 {
Ok(Self)
} else {


+ 1
- 2
source/hal/err.rs View File

@@ -16,8 +16,7 @@ impl std::fmt::Display for ErrSdl {
impl ErrSdl {
pub unsafe fn new() -> Self {
let contents =
std::ffi::CStr::from_ptr(sdl::SDL_GetError())
.to_string_lossy();
std::ffi::CStr::from_ptr(sdl::SDL_GetError()).to_string_lossy();
Self { contents }
}
}


+ 8
- 2
source/hal/window.rs View File

@@ -1,7 +1,13 @@
use ash::{version::InstanceV1_0, vk::{self, Handle}};
use crate::hal::{Context, ErrSdl};
use std::{marker::PhantomData, os::raw::{c_char, c_int}};
use ash::{
version::InstanceV1_0,
vk::{self, Handle},
};
use sdl2_sys as sdl;
use std::{
marker::PhantomData,
os::raw::{c_char, c_int},
};

pub struct Window<'a> {
hal: PhantomData<&'a Context>,


+ 32
- 38
source/main.rs View File

@@ -5,8 +5,11 @@ mod conf;
mod hal;
mod render;

use crate::{
render::*,
util::{log, meta},
};
use ash::{version::DeviceV1_0, vk};
use crate::{render::*, util::{log, meta}};

const MAIN_VERT: &'static [u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/main.vert.o"));
@@ -17,18 +20,14 @@ fn create_semaphores<'a, 'b>(
device: &'a Device<'b>,
num: usize,
) -> Result<Vec<Semaphore<'a, 'b>>, vk::Result> {
(0..num)
.map(|_| Semaphore::create(&device))
.collect()
(0..num).map(|_| Semaphore::create(&device)).collect()
}

fn create_fences<'a, 'b>(
device: &'a Device<'b>,
num: usize,
) -> Result<Vec<Fence<'a, 'b>>, vk::Result> {
(0..num)
.map(|_| Fence::create(&device))
.collect()
(0..num).map(|_| Fence::create(&device)).collect()
}

fn draw_frame<'a, 'b, 'c>(
@@ -49,12 +48,15 @@ fn draw_frame<'a, 'b, 'c>(
}

let image_index = unsafe {
device.swapchain_ext.acquire_next_image(
**swapchain,
u64::max_value(),
**image_available_s,
vk::Fence::null(),
)?.0 as usize
device
.swapchain_ext
.acquire_next_image(
**swapchain,
u64::max_value(),
**image_available_s,
vk::Fence::null(),
)?
.0 as usize
};

if let Some(fence) = image_f[image_index] {
@@ -145,11 +147,10 @@ fn fallback_main(

let images = swapchain.get_images()?;

let image_views =
images
.iter()
.map(|image| ImageView::create(&device, image, swapchain.format))
.collect::<Result<Vec<_>, _>>()?;
let image_views = images
.iter()
.map(|image| ImageView::create(&device, image, swapchain.format))
.collect::<Result<Vec<_>, _>>()?;

let spir_vert = Spir::read(MAIN_VERT);
let spir_frag = Spir::read(MAIN_FRAG);
@@ -168,18 +169,17 @@ fn fallback_main(
swapchain.extent,
)?;

let framebuffers =
image_views
.iter()
.map(|image_view| {
Framebuffer::create(
&device,
&render_pass,
image_view,
swapchain.extent,
)
})
.collect::<Result<Vec<_>, _>>()?;
let framebuffers = image_views
.iter()
.map(|image_view| {
Framebuffer::create(
&device,
&render_pass,
image_view,
swapchain.extent,
)
})
.collect::<Result<Vec<_>, _>>()?;

let cmd_pool = CommandPool::create(&device, qf_info.gfx_index)?;
let cmd_buffers = cmd_pool.allocate_buffers(&framebuffers)?;
@@ -242,16 +242,10 @@ fn fallback_main(
}

fn main() {
let lg =
log::Log::new()
.insert_mode("Std", log::Std);
let lg = log::Log::new().insert_mode("Std", log::Std);

#[cfg(feature = "color-log")]
let lg =
lg
.insert_mode("Color", log::Color)
.set_mode("Color")
.unwrap();
let lg = lg.insert_mode("Color", log::Color).set_mode("Color").unwrap();

let conf = conf::Conf::read("blonkus.yaml").unwrap_or_else(|err| {
let level = match err {


+ 2
- 2
source/render.rs View File

@@ -24,8 +24,8 @@ pub use self::{
image::Image,
imageview::ImageView,
instance::Instance,
pipeline::{PipelineLayout, Pipeline, RenderPass},
properties::{ErrNoProperty, ensure_properties},
pipeline::{Pipeline, PipelineLayout, RenderPass},
properties::{ensure_properties, ErrNoProperty},
queue::{ErrQueueFamilyCollect, Queue, QueueFamilyInfo},
semaphore::Semaphore,
shader::ShaderModule,


+ 18
- 12
source/render/cmd.rs View File

@@ -1,5 +1,5 @@
use ash::{version::DeviceV1_0, vk};
use crate::render::{Device, Framebuffer, Pipeline, RenderPass};
use ash::{version::DeviceV1_0, vk};

pub struct CommandPool<'a, 'b> {
device: &'a Device<'b>,
@@ -45,13 +45,11 @@ impl<'a, 'b> CommandPool<'a, 'b> {
.device
.allocate_command_buffers(&alloc_info)?
.iter()
.map(|&handle|
CommandBuffer {
handle,
pool: self,
device: self.device,
}
)
.map(|&handle| CommandBuffer {
handle,
pool: self,
device: self.device,
})
.collect()
};

@@ -119,24 +117,32 @@ impl CommandBuffer<'_, '_, '_> {

impl Drop for CommandPool<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_command_pool(self.handle, None); }
unsafe {
self.device.destroy_command_pool(self.handle, None);
}
}
}

impl Drop for CommandBuffer<'_, '_, '_> {
fn drop(&mut self) {
unsafe { self.device.free_command_buffers(**self.pool, &[self.handle]); }
unsafe {
self.device.free_command_buffers(**self.pool, &[self.handle]);
}
}
}

impl std::ops::Deref for CommandPool<'_, '_> {
type Target = vk::CommandPool;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

impl std::ops::Deref for CommandBuffer<'_, '_, '_> {
type Target = vk::CommandBuffer;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 19
- 12
source/render/device.rs View File

@@ -1,10 +1,10 @@
use ash::{extensions::khr, version::{DeviceV1_0, InstanceV1_0}, vk};
use crate::render::{
Conf,
ErrNoProperty,
Instance,
ensure_properties,
QueueFamilyInfo
ensure_properties, Conf, ErrNoProperty, Instance, QueueFamilyInfo,
};
use ash::{
extensions::khr,
version::{DeviceV1_0, InstanceV1_0},
vk,
};
use std::{marker::PhantomData, os::raw::c_char};

@@ -86,9 +86,8 @@ impl<'a> Device<'a> {
..enable_device_extensions(instance, phys_device, &extensions)?
};

let handle = unsafe {
instance.create_device(**phys_device, &create_info, None)?
};
let handle =
unsafe { instance.create_device(**phys_device, &create_info, None)? };

let swapchain_ext = khr::Swapchain::new(&**instance, &handle);

@@ -113,17 +112,25 @@ impl<'a> PhysicalDevice<'a> {
}

impl Drop for Device<'_> {
fn drop(&mut self) { unsafe { self.handle.destroy_device(None); } }
fn drop(&mut self) {
unsafe {
self.handle.destroy_device(None);
}
}
}

impl std::ops::Deref for Device<'_> {
type Target = ash::Device;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

impl std::ops::Deref for PhysicalDevice<'_> {
type Target = vk::PhysicalDevice;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

impl std::fmt::Display for ErrDeviceCreate {


+ 7
- 3
source/render/fence.rs View File

@@ -1,5 +1,5 @@
use ash::{version::DeviceV1_0, vk};
use crate::render::Device;
use ash::{version::DeviceV1_0, vk};

pub struct Fence<'a, 'b> {
device: &'a Device<'b>,
@@ -19,13 +19,17 @@ impl<'a, 'b> Fence<'a, 'b> {

impl Drop for Fence<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_fence(self.handle, None); }
unsafe {
self.device.destroy_fence(self.handle, None);
}
}
}

impl std::ops::Deref for Fence<'_, '_> {
type Target = vk::Fence;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 7
- 3
source/render/framebuffer.rs View File

@@ -1,5 +1,5 @@
use ash::{version::DeviceV1_0, vk};
use crate::render::{Device, ImageView, RenderPass};
use ash::{version::DeviceV1_0, vk};

pub struct Framebuffer<'a, 'b> {
device: &'a Device<'b>,
@@ -32,13 +32,17 @@ impl<'a, 'b> Framebuffer<'a, 'b> {

impl Drop for Framebuffer<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_framebuffer(self.handle, None); }
unsafe {
self.device.destroy_framebuffer(self.handle, None);
}
}
}

impl std::ops::Deref for Framebuffer<'_, '_> {
type Target = vk::Framebuffer;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 7
- 3
source/render/image.rs View File

@@ -1,5 +1,5 @@
use ash::{version::DeviceV1_0, vk};
use crate::render::{Device, Swapchain};
use ash::{version::DeviceV1_0, vk};
use std::marker::PhantomData;

pub struct Image<'a, 'b, 'c> {
@@ -21,14 +21,18 @@ impl<'a, 'b, 'c> Image<'a, 'b, 'c> {
impl Drop for Image<'_, '_, '_> {
fn drop(&mut self) {
if self.owner.is_none() {
unsafe { self.device.destroy_image(self.handle, None); }
unsafe {
self.device.destroy_image(self.handle, None);
}
}
}
}

impl std::ops::Deref for Image<'_, '_, '_> {
type Target = vk::Image;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 7
- 3
source/render/imageview.rs View File

@@ -1,5 +1,5 @@
use ash::{version::DeviceV1_0, vk};
use crate::render::{Device, Image};
use ash::{version::DeviceV1_0, vk};

pub struct ImageView<'a, 'b> {
device: &'a Device<'b>,
@@ -38,13 +38,17 @@ impl<'a, 'b> ImageView<'a, 'b> {

impl Drop for ImageView<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_image_view(self.handle, None); }
unsafe {
self.device.destroy_image_view(self.handle, None);
}
}
}

impl std::ops::Deref for ImageView<'_, '_> {
type Target = vk::ImageView;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 13
- 5
source/render/instance.rs View File

@@ -1,10 +1,12 @@
use crate::{
render::{ensure_properties, Conf},
util::{err, meta},
};
use ash::{
extensions::khr,
version::{EntryV1_0, InstanceV1_0},
vk,
vk_make_version
vk, vk_make_version,
};
use crate::{render::{Conf, ensure_properties}, util::{err, meta}};
use std::os::raw::c_char;

pub struct Instance {
@@ -63,12 +65,18 @@ impl Instance {
}

impl Drop for Instance {
fn drop(&mut self) { unsafe { self.handle.destroy_instance(None); } }
fn drop(&mut self) {
unsafe {
self.handle.destroy_instance(None);
}
}
}

impl std::ops::Deref for Instance {
type Target = ash::Instance;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 25
- 16
source/render/pipeline.rs View File

@@ -1,5 +1,8 @@
use crate::{
render::{Device, ShaderModule},
util::err,
};
use ash::{version::DeviceV1_0, vk};
use crate::{render::{Device, ShaderModule}, util::err};

pub struct PipelineLayout<'a, 'b> {
device: &'a Device<'b>,
@@ -20,9 +23,8 @@ impl<'a, 'b> PipelineLayout<'a, 'b> {
pub fn create(device: &'a Device<'b>) -> err::Result<Self> {
let create_info = vk::PipelineLayoutCreateInfo::default();

let handle = unsafe {
device.create_pipeline_layout(&create_info, None)?
};
let handle =
unsafe { device.create_pipeline_layout(&create_info, None)? };
Ok(Self { device, handle })
}
}
@@ -135,12 +137,7 @@ impl<'a, 'b> Pipeline<'a, 'b> {
}
];

let scissors = [
vk::Rect2D {
extent,
offset: vk::Offset2D::default(),
}
];
let scissors = [vk::Rect2D { extent, offset: vk::Offset2D::default() }];

let viewport_state = vk::PipelineViewportStateCreateInfo {
viewport_count: viewports.len() as u32,
@@ -216,35 +213,47 @@ impl<'a, 'b> Pipeline<'a, 'b> {

impl Drop for PipelineLayout<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_pipeline_layout(self.handle, None); }
unsafe {
self.device.destroy_pipeline_layout(self.handle, None);
}
}
}

impl Drop for RenderPass<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_render_pass(self.handle, None); }
unsafe {
self.device.destroy_render_pass(self.handle, None);
}
}
}

impl Drop for Pipeline<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_pipeline(self.handle, None); }
unsafe {
self.device.destroy_pipeline(self.handle, None);
}
}
}

impl std::ops::Deref for PipelineLayout<'_, '_> {
type Target = vk::PipelineLayout;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

impl std::ops::Deref for RenderPass<'_, '_> {
type Target = vk::RenderPass;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

impl std::ops::Deref for Pipeline<'_, '_> {
type Target = vk::Pipeline;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 3
- 1
source/render/properties.rs View File

@@ -25,7 +25,9 @@ where
let name = unsafe { CStr::from_ptr(*name) };

if !props.iter().any(|x| unsafe { CStr::from_ptr(func(x)) == name }) {
return Err(ErrNoProperty { name: name.to_string_lossy().to_string() });
return Err(ErrNoProperty {
name: name.to_string_lossy().to_string(),
});
}
}



+ 7
- 2
source/render/queue.rs View File

@@ -1,5 +1,8 @@
use ash::{version::{DeviceV1_0, InstanceV1_0}, vk};
use crate::render::{Device, Instance, PhysicalDevice, Surface};
use ash::{
version::{DeviceV1_0, InstanceV1_0},
vk,
};
use std::marker::PhantomData;

#[derive(Debug)]
@@ -67,7 +70,9 @@ impl<'a, 'b> Queue<'a, 'b> {

impl std::ops::Deref for Queue<'_, '_> {
type Target = vk::Queue;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

impl std::fmt::Display for ErrQueueFamilyCollect {


+ 7
- 3
source/render/semaphore.rs View File

@@ -1,5 +1,5 @@
use ash::{version::DeviceV1_0, vk};
use crate::render::Device;
use ash::{version::DeviceV1_0, vk};

pub struct Semaphore<'a, 'b> {
device: &'a Device<'b>,
@@ -16,13 +16,17 @@ impl<'a, 'b> Semaphore<'a, 'b> {

impl Drop for Semaphore<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_semaphore(self.handle, None); }
unsafe {
self.device.destroy_semaphore(self.handle, None);
}
}
}

impl std::ops::Deref for Semaphore<'_, '_> {
type Target = vk::Semaphore;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 10
- 3
source/render/shader.rs View File

@@ -1,5 +1,8 @@
use crate::{
render::{Device, Spir},
util::err,
};
use ash::{version::DeviceV1_0, vk};
use crate::{render::{Device, Spir}, util::err};

pub struct ShaderModule<'a, 'b> {
device: &'a Device<'b>,
@@ -21,13 +24,17 @@ impl<'a, 'b> ShaderModule<'a, 'b> {

impl Drop for ShaderModule<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.destroy_shader_module(self.handle, None); }
unsafe {
self.device.destroy_shader_module(self.handle, None);
}
}
}

impl std::ops::Deref for ShaderModule<'_, '_> {
type Target = vk::ShaderModule;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 1
- 4
source/render/spir.rs View File

@@ -12,10 +12,7 @@ impl Spir {
}

let size = code.len() * 4;
Spir {
code,
size,
}
Spir { code, size }
}
}



+ 7
- 3
source/render/surface.rs View File

@@ -1,5 +1,5 @@
use ash::vk;
use crate::{render::Instance, util::err};
use ash::vk;

pub struct Surface<'a> {
instance: &'a Instance,
@@ -18,13 +18,17 @@ impl<'a> Surface<'a> {

impl Drop for Surface<'_> {
fn drop(&mut self) {
unsafe { self.instance.surface_ext.destroy_surface(self.handle, None); }
unsafe {
self.instance.surface_ext.destroy_surface(self.handle, None);
}
}
}

impl std::ops::Deref for Surface<'_> {
type Target = vk::SurfaceKHR;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 38
- 46
source/render/swapchain.rs View File

@@ -1,13 +1,7 @@
use ash::vk;
use crate::render::{
Conf,
Device,
Image,
Instance,
PhysicalDevice,
QueueFamilyInfo,
Surface
Conf, Device, Image, Instance, PhysicalDevice, QueueFamilyInfo, Surface,
};
use ash::vk;

pub struct Swapchain<'a, 'b> {
device: &'a Device<'b>,
@@ -27,9 +21,10 @@ impl<'a, 'b> Swapchain<'a, 'b> {
qf_info: &QueueFamilyInfo,
) -> Result<Self, vk::Result> {
let capabilities = unsafe {
instance
.surface_ext
.get_physical_device_surface_capabilities(**phys_device, **surface)?
instance.surface_ext.get_physical_device_surface_capabilities(
**phys_device,
**surface,
)?
};

let formats = unsafe {
@@ -39,12 +34,10 @@ impl<'a, 'b> Swapchain<'a, 'b> {
};

let modes = unsafe {
instance
.surface_ext
.get_physical_device_surface_present_modes(
**phys_device,
**surface,
)?
instance.surface_ext.get_physical_device_surface_present_modes(
**phys_device,
**surface,
)?
};

let extent =
@@ -52,33 +45,29 @@ impl<'a, 'b> Swapchain<'a, 'b> {
capabilities.current_extent
} else {
vk::Extent2D {
width:
capabilities
.min_image_extent
.width
.max(capabilities.max_image_extent.width),
height:
capabilities
.min_image_extent
.height
.max(capabilities.max_image_extent.height),
width: capabilities
.min_image_extent
.width
.max(capabilities.max_image_extent.width),
height: capabilities
.min_image_extent
.height
.max(capabilities.max_image_extent.height),
}
};

let format =
*formats
.iter()
.find(|format| {
format.format == vk::Format::B8G8R8A8_UNORM &&
format.color_space == vk::ColorSpaceKHR::SRGB_NONLINEAR
})
.unwrap_or_else(|| &formats[0]);

let mode =
*modes
.iter()
.find(|&&mode| mode == conf.swap_mode.into())
.unwrap_or_else(|| &vk::PresentModeKHR::FIFO);
let format = *formats
.iter()
.find(|format| {
format.format == vk::Format::B8G8R8A8_UNORM &&
format.color_space == vk::ColorSpaceKHR::SRGB_NONLINEAR
})
.unwrap_or_else(|| &formats[0]);

let mode = *modes
.iter()
.find(|&&mode| mode == conf.swap_mode.into())
.unwrap_or_else(|| &vk::PresentModeKHR::FIFO);

let min_image_count = capabilities.min_image_count + 1;

@@ -115,9 +104,8 @@ impl<'a, 'b> Swapchain<'a, 'b> {
..Default::default()
};

let handle = unsafe {
device.swapchain_ext.create_swapchain(&create_info, None)?
};
let handle =
unsafe { device.swapchain_ext.create_swapchain(&create_info, None)? };

Ok(Self { device, handle, format: format.format, extent })
}
@@ -135,13 +123,17 @@ impl<'a, 'b> Swapchain<'a, 'b> {

impl Drop for Swapchain<'_, '_> {
fn drop(&mut self) {
unsafe { self.device.swapchain_ext.destroy_swapchain(self.handle, None); }
unsafe {
self.device.swapchain_ext.destroy_swapchain(self.handle, None);
}
}
}

impl std::ops::Deref for Swapchain<'_, '_> {
type Target = vk::SwapchainKHR;
fn deref(&self) -> &Self::Target { &self.handle }
fn deref(&self) -> &Self::Target {
&self.handle
}
}

// EOF

+ 1
- 4
source/util/ffi.rs View File

@@ -19,10 +19,7 @@ impl Default for CStringVec {
/// Creates a new empty CStringVec.
#[inline]
fn default() -> Self {
Self {
sv: Vec::new(),
cv: vec![null()],
}
Self { sv: Vec::new(), cv: vec![null()] }
}
}



+ 1
- 1
source/util/log/color.rs View File

@@ -1,6 +1,6 @@
#![cfg(feature = "color-log")]

use crate::util::log::{Level, LogMode, Log, Record};
use crate::util::log::{Level, Log, LogMode, Record};
use termcolor::WriteColor;

pub struct Color;


+ 3
- 1
source/util/log/conf.rs View File

@@ -8,7 +8,9 @@ serialize! {
}

impl Default for Conf {
fn default() -> Self { Self { level: Level::default() } }
fn default() -> Self {
Self { level: Level::default() }
}
}

// EOF

+ 1
- 1
source/util/log/standard.rs View File

@@ -1,4 +1,4 @@
use crate::util::log::{Level, LogMode, Log, Record};
use crate::util::log::{Level, Log, LogMode, Record};
use std::io::Write;

pub struct Std;


Loading…
Cancel
Save