mirror of
https://github.com/TECHNOFAB11/aerosol.git
synced 2025-12-11 23:50:07 +01:00
Add FromRef implementation for generic Aero types
This commit is contained in:
parent
1f885d066b
commit
7cd323a0fa
2 changed files with 9 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "aerosol"
|
||||
version = "1.0.0-alpha.6"
|
||||
version = "1.0.0-alpha.7"
|
||||
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
||||
edition = "2018"
|
||||
description = "Simple dependency injection for Rust"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ use axum::{
|
|||
http::{request::Parts, StatusCode},
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use frunk::HCons;
|
||||
|
||||
use crate::{Aero, AsyncConstructibleResource, ConstructibleResource, Resource};
|
||||
use crate::{Aero, AsyncConstructibleResource, ConstructibleResource, Resource, ResourceList};
|
||||
|
||||
/// Type of axum Rejection returned when a resource cannot be acquired
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
|
@ -96,3 +97,9 @@ where
|
|||
.map_err(DependencyError::failed_to_construct::<T>)
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: Resource, T: ResourceList> FromRef<Aero<HCons<H, T>>> for Aero {
|
||||
fn from_ref(input: &Aero<HCons<H, T>>) -> Self {
|
||||
input.clone().into()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue