vulkanalia 0.35.0

Vulkan bindings for Rust.
Documentation
// SPDX-License-Identifier: Apache-2.0

// DO NOT EDIT.
//
// This file has been generated by the Kotlin project in the `generator`
// directory from a Vulkan API registry.

#![allow(
    non_camel_case_types,
    non_snake_case,
    clippy::bad_bit_mask,
    clippy::let_unit_value,
    clippy::missing_safety_doc,
    clippy::missing_transmute_annotations,
    clippy::needless_lifetimes,
    clippy::too_many_arguments,
    clippy::type_complexity,
    clippy::unnecessary_cast,
    clippy::upper_case_acronyms,
    clippy::useless_transmute
)]

use core::fmt;

#[cfg(all(feature = "no_std_error", not(feature = "std")))]
use core::error;
#[cfg(feature = "std")]
use std::error;

use super::Result;

/// Result codes that indicate successes.
#[repr(transparent)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct SuccessCode(i32);

impl SuccessCode {
    pub const SUCCESS: Self = Self(0);
    pub const NOT_READY: Self = Self(1);
    pub const TIMEOUT: Self = Self(2);
    pub const EVENT_SET: Self = Self(3);
    pub const EVENT_RESET: Self = Self(4);
    pub const INCOMPLETE: Self = Self(5);
    pub const PIPELINE_COMPILE_REQUIRED: Self = Self(1000297000);
    pub const SUBOPTIMAL_KHR: Self = Self(1000001003);
    pub const THREAD_IDLE_KHR: Self = Self(1000268000);
    pub const THREAD_DONE_KHR: Self = Self(1000268001);
    pub const OPERATION_DEFERRED_KHR: Self = Self(1000268002);
    pub const OPERATION_NOT_DEFERRED_KHR: Self = Self(1000268003);
    pub const INCOMPATIBLE_SHADER_BINARY_EXT: Self = Self(1000482000);
    pub const PIPELINE_BINARY_MISSING_KHR: Self = Self(1000483000);

    /// Constructs an instance of this enum with the supplied underlying value.
    #[inline]
    pub const fn from_raw(value: i32) -> Self {
        Self(value)
    }

    /// Gets the underlying value for this enum instance.
    #[inline]
    pub const fn as_raw(self) -> i32 {
        self.0
    }
}

impl fmt::Debug for SuccessCode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        Result::from_raw(self.as_raw()).fmt(f)
    }
}

impl fmt::Display for SuccessCode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        Result::from_raw(self.as_raw()).fmt(f)
    }
}

impl From<Result> for SuccessCode {
    #[inline]
    fn from(result: Result) -> Self {
        Self::from_raw(result.as_raw())
    }
}

impl From<SuccessCode> for Result {
    #[inline]
    fn from(code: SuccessCode) -> Self {
        Result::from_raw(code.as_raw())
    }
}

/// Result codes that indicate errors.
#[repr(transparent)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct ErrorCode(i32);

impl ErrorCode {
    pub const OUT_OF_HOST_MEMORY: Self = Self(-1);
    pub const OUT_OF_DEVICE_MEMORY: Self = Self(-2);
    pub const INITIALIZATION_FAILED: Self = Self(-3);
    pub const DEVICE_LOST: Self = Self(-4);
    pub const MEMORY_MAP_FAILED: Self = Self(-5);
    pub const LAYER_NOT_PRESENT: Self = Self(-6);
    pub const EXTENSION_NOT_PRESENT: Self = Self(-7);
    pub const FEATURE_NOT_PRESENT: Self = Self(-8);
    pub const INCOMPATIBLE_DRIVER: Self = Self(-9);
    pub const TOO_MANY_OBJECTS: Self = Self(-10);
    pub const FORMAT_NOT_SUPPORTED: Self = Self(-11);
    pub const FRAGMENTED_POOL: Self = Self(-12);
    pub const UNKNOWN: Self = Self(-13);
    pub const VALIDATION_FAILED: Self = Self(-1000011001);
    pub const OUT_OF_POOL_MEMORY: Self = Self(-1000069000);
    pub const INVALID_EXTERNAL_HANDLE: Self = Self(-1000072003);
    pub const INVALID_OPAQUE_CAPTURE_ADDRESS: Self = Self(-1000257000);
    pub const FRAGMENTATION: Self = Self(-1000161000);
    pub const NOT_PERMITTED: Self = Self(-1000174001);
    pub const SURFACE_LOST_KHR: Self = Self(-1000000000);
    pub const NATIVE_WINDOW_IN_USE_KHR: Self = Self(-1000000001);
    pub const OUT_OF_DATE_KHR: Self = Self(-1000001004);
    pub const INCOMPATIBLE_DISPLAY_KHR: Self = Self(-1000003001);
    pub const INVALID_SHADER_NV: Self = Self(-1000012000);
    pub const IMAGE_USAGE_NOT_SUPPORTED_KHR: Self = Self(-1000023000);
    pub const VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR: Self = Self(-1000023001);
    pub const VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR: Self = Self(-1000023002);
    pub const VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR: Self = Self(-1000023003);
    pub const VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR: Self = Self(-1000023004);
    pub const VIDEO_STD_VERSION_NOT_SUPPORTED_KHR: Self = Self(-1000023005);
    pub const INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT: Self = Self(-1000158000);
    pub const PRESENT_TIMING_QUEUE_FULL_EXT: Self = Self(-1000208000);
    pub const FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: Self = Self(-1000255000);
    pub const INVALID_VIDEO_STD_PARAMETERS_KHR: Self = Self(-1000299000);
    pub const COMPRESSION_EXHAUSTED_EXT: Self = Self(-1000338000);
    pub const NOT_ENOUGH_SPACE_KHR: Self = Self(-1000483000);

    /// Constructs an instance of this enum with the supplied underlying value.
    #[inline]
    pub const fn from_raw(value: i32) -> Self {
        Self(value)
    }

    /// Gets the underlying value for this enum instance.
    #[inline]
    pub const fn as_raw(self) -> i32 {
        self.0
    }
}

impl fmt::Debug for ErrorCode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        Result::from_raw(self.as_raw()).fmt(f)
    }
}

impl fmt::Display for ErrorCode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        Result::from_raw(self.as_raw()).fmt(f)
    }
}

#[cfg(any(feature = "std", feature = "no_std_error"))]
impl error::Error for ErrorCode {}

impl From<Result> for ErrorCode {
    #[inline]
    fn from(result: Result) -> Self {
        Self::from_raw(result.as_raw())
    }
}

impl From<ErrorCode> for Result {
    #[inline]
    fn from(code: ErrorCode) -> Self {
        Result::from_raw(code.as_raw())
    }
}