You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran into an issue on a function that has a where clause on it. For some reason the where clause doesn't get copied over to the no_cache function but the primed_cache function and the replaced function has the where clause. I'm on version v0.53.1 using the features tokio and async.
error[E0599]: no method named `as_ref` found for type parameter `T` in the current scope
--> src/vault.rs:84:21
|
75 | async fn get_secret_internal<T, U>(
| - method `as_ref` not found for this type parameter
...
84 | let path = path.as_ref();
| ^^^^^^ method not found in `T`
|
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `as_ref`, perhaps you need to restrict type parameter `T` with it:
|
75 | async fn get_secret_internal<T: AsRef, U>(
| +++++++
error[E0599]: no method named `as_ref` found for type parameter `U` in the current scope
--> src/vault.rs:85:29
|
75 | async fn get_secret_internal<T, U>(
| - method `as_ref` not found for this type parameter
...
85 | let path_key = path_key.as_ref();
| ^^^^^^ method not found in `U`
|
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `as_ref`, perhaps you need to restrict type parameter `U` with it:
|
75 | async fn get_secret_internal<T, U: AsRef>(
| +++++++
For more information about this error, try `rustc --explain E0599`.
Here's the expanded rust using cargo expand:
///Cached static for the [`get_secret_internal`] function.staticGET_SECRET_INTERNAL:::cached::once_cell::sync::Lazy<::cached::async_sync::Mutex<cached::UnboundCache<String,Zeroizing<String>>>,> = ::cached::once_cell::sync::Lazy::new(|| ::cached::async_sync::Mutex::new(
cached::UnboundCache::new(),));///Origin of the cached function [`get_secret_internal`].asyncfnget_secret_internal_no_cache<T,U>(client:&VaultClient,path:T,path_key:U,) -> Result<Zeroizing<String>>{let path = path.as_ref();let path_key = path_key.as_ref();// ...}///This is a cached function that uses the [`GET_SECRET_INTERNAL`] cached static.asyncfnget_secret_internal<T,U>(client:&VaultClient,path:T,path_key:U,) -> Result<Zeroizing<String>>whereT:AsRef<str> + Send + Sync,U:AsRef<str> + Send + Sync,{use cached::Cached;use cached::CloneCached;let key = {{let res = ::alloc::fmt::format(format_args!("{0}:{1}", path.as_ref(), path_key.as_ref()),);
res
}};letmut cache = GET_SECRET_INTERNAL.lock().await;ifletSome(result) = cache.cache_get(&key){returnOk(result.to_owned());}let result = get_secret_internal_no_cache(client, path, path_key).await;ifletOk(result) = &result {
cache.cache_set(key, result.clone());}
result
}///Primes the cached function [`get_secret_internal`].#[allow(dead_code)]///This is a cached function that uses the [`GET_SECRET_INTERNAL`] cached static.asyncfnget_secret_internal_prime_cache<T,U>(client:&VaultClient,path:T,path_key:U,) -> Result<Zeroizing<String>>whereT:AsRef<str> + Send + Sync,U:AsRef<str> + Send + Sync,{use cached::Cached;let key = {{let res = ::alloc::fmt::format(format_args!("{0}:{1}", path.as_ref(), path_key.as_ref()),);
res
}};letmut cache = GET_SECRET_INTERNAL.lock().await;let result = get_secret_internal_no_cache(client, path, path_key).await;ifletOk(result) = &result {
cache.cache_set(key, result.clone());}
result
}
The text was updated successfully, but these errors were encountered:
Ran into an issue on a function that has a
where
clause on it. For some reason the where clause doesn't get copied over to theno_cache
function but theprimed_cache
function and the replaced function has thewhere
clause. I'm on versionv0.53.1
using the featurestokio
andasync
.Here's the function:
Here's the error:
Here's the expanded rust using
cargo expand
:The text was updated successfully, but these errors were encountered: