Add #[from_ref(skip)] (#1537)

For skipping individual fields.
This commit is contained in:
David Pedersen
2022-11-18 12:05:10 +01:00
committed by GitHub
parent 64960bb19c
commit 7d58d49817
5 changed files with 84 additions and 2 deletions
+4
View File
@@ -589,6 +589,9 @@ pub fn derive_typed_path(input: TokenStream) -> TokenStream {
/// struct AppState {
/// auth_token: AuthToken,
/// database_pool: DatabasePool,
/// // fields can also be skipped
/// #[from_ref(skip)]
/// api_token: String,
/// }
///
/// // So those types can be extracted via `State`
@@ -601,6 +604,7 @@ pub fn derive_typed_path(input: TokenStream) -> TokenStream {
/// let state = AppState {
/// auth_token,
/// database_pool,
/// api_token: "secret".to_owned(),
/// };
///
/// let app = Router::new()