reflect: desugar rpitit into tait to avoid incomplete feature warning

This commit is contained in:
chyyran 2022-11-21 18:19:43 -05:00
parent 1978350d97
commit 254875de29
6 changed files with 13 additions and 15 deletions

View file

@ -7,7 +7,7 @@ pub struct Image {
}
impl Image {
pub fn load(path: impl AsRef<Path>) -> Result<Self, image::ImageError> {
pub fn load(path: impl AsRef<Path>) -> Result<Self, ImageError> {
let image = image::open(path.as_ref())?.flipv().to_rgba8();
let height = image.height();
@ -21,4 +21,4 @@ impl Image {
}
}
pub use image::ImageError;
pub use image::ImageError as ImageError;

View file

@ -15,14 +15,12 @@ impl FromCompilation<GlslangCompilation> for GLSL {
type Target = GLSL;
type Options = GlVersion;
type Context = GlslangGlslContext;
type Output = impl CompileShader<Self::Target, Options = GlVersion, Context = GlslangGlslContext> + ReflectShader;
fn from_compilation(
compile: GlslangCompilation,
) -> Result<
CompilerBackend<
impl CompileShader<Self::Target, Options = Self::Options, Context = Self::Context>
+ ReflectShader,
>,
CompilerBackend<Self::Output>,
ShaderReflectError,
> {
Ok(CompilerBackend {
@ -35,14 +33,12 @@ impl FromCompilation<GlslangCompilation> for HLSL {
type Target = HLSL;
type Options = Option<()>;
type Context = ();
type Output = impl CompileShader<Self::Target, Options = Self::Options, Context = Self::Context> + ReflectShader;
fn from_compilation(
compile: GlslangCompilation,
) -> Result<
CompilerBackend<
impl CompileShader<Self::Target, Options = Self::Options, Context = Self::Context>
+ ReflectShader,
>,
CompilerBackend<Self::Output>,
ShaderReflectError,
> {
Ok(CompilerBackend {

View file

@ -45,10 +45,12 @@ pub trait FromCompilation<T> {
type Options;
type Context;
type Output: CompileShader<Self::Target, Context = Self::Context, Options=Self::Options> + ReflectShader;
fn from_compilation(
compile: T,
) -> Result<
CompilerBackend<impl CompileShader<Self::Target, Context = Self::Context> + ReflectShader>,
CompilerBackend<Self::Output>,
ShaderReflectError,
>;
}

View file

@ -1,4 +1,4 @@
#![feature(return_position_impl_trait_in_trait)]
#![feature(type_alias_impl_trait)]
pub mod back;
pub mod error;

View file

@ -1,5 +1,5 @@
use gl::types::GLenum;
use librashader_common::image;
use librashader_common::image::ImageError;
use librashader_preprocess::PreprocessError;
use librashader_presets::ParsePresetError;
use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
@ -20,7 +20,7 @@ pub enum FilterChainError {
#[error("shader reflect error")]
ShaderReflectError(#[from] ShaderReflectError),
#[error("lut loading error")]
LutLoadError(#[from] image::ImageError)
LutLoadError(#[from] ImageError)
}
pub type Result<T> = std::result::Result<T, FilterChainError>;

View file

@ -9,7 +9,7 @@ mod hello_triangle;
mod quad_render;
mod render_target;
mod util;
mod error;
pub mod error;
pub use filter_chain::FilterChain;
pub use framebuffer::Framebuffer;