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 { 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 image = image::open(path.as_ref())?.flipv().to_rgba8();
let height = image.height(); 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 Target = GLSL;
type Options = GlVersion; type Options = GlVersion;
type Context = GlslangGlslContext; type Context = GlslangGlslContext;
type Output = impl CompileShader<Self::Target, Options = GlVersion, Context = GlslangGlslContext> + ReflectShader;
fn from_compilation( fn from_compilation(
compile: GlslangCompilation, compile: GlslangCompilation,
) -> Result< ) -> Result<
CompilerBackend< CompilerBackend<Self::Output>,
impl CompileShader<Self::Target, Options = Self::Options, Context = Self::Context>
+ ReflectShader,
>,
ShaderReflectError, ShaderReflectError,
> { > {
Ok(CompilerBackend { Ok(CompilerBackend {
@ -35,14 +33,12 @@ impl FromCompilation<GlslangCompilation> for HLSL {
type Target = HLSL; type Target = HLSL;
type Options = Option<()>; type Options = Option<()>;
type Context = (); type Context = ();
type Output = impl CompileShader<Self::Target, Options = Self::Options, Context = Self::Context> + ReflectShader;
fn from_compilation( fn from_compilation(
compile: GlslangCompilation, compile: GlslangCompilation,
) -> Result< ) -> Result<
CompilerBackend< CompilerBackend<Self::Output>,
impl CompileShader<Self::Target, Options = Self::Options, Context = Self::Context>
+ ReflectShader,
>,
ShaderReflectError, ShaderReflectError,
> { > {
Ok(CompilerBackend { Ok(CompilerBackend {

View file

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

View file

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

View file

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

View file

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