mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Add #[derive(FromRef)] (#1430)
* add `#[derive(FromRef)]` * tests * don't support skipping fields probably wouldn't work at all since the whole state likely needs `Clone` * UI tests * changelog * changelog link * revert hello-world example, used for testing * Re-export `#[derive(FromRef)]` * Don't need to return `Result` * use `collect` instead of quoting the iterator * Mention it in axum's changelog
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
///
|
||||
/// See [`State`] for more details on how library authors should use this trait.
|
||||
///
|
||||
/// This trait can be derived using `#[derive(axum_macros::FromRef)]`.
|
||||
///
|
||||
/// [`State`]: https://docs.rs/axum/0.6/axum/extract/struct.State.html
|
||||
/// [`#[derive(axum_macros::FromRef)]`]: https://docs.rs/axum-macros/latest/axum_macros/derive.FromRef.html
|
||||
// NOTE: This trait is defined in axum-core, even though it is mainly used with `State` which is
|
||||
// defined in axum. That allows crate authors to use it when implementing extractors.
|
||||
pub trait FromRef<T> {
|
||||
|
||||
Reference in New Issue
Block a user