How to get the infor of where exactly a trait restriction comes from?
⚓ Rust 📅 2026-01-17 👤 surdeus 👁️ 1With kube-rs v3.0.0 and gateway-api, I got an error in my code:
error[E0277]: the trait bound `gateway_api::gateways::Gateway: k8s_openapi::Metadata` is not satisfied
--> src/helpers.rs:114:34
|
114 | let gateways: Api<Gateway> = Api::namespaced(client, namespace);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `k8s_openapi::Metadata` is not implemented for `gateway_api::gateways::Gateway`
|
= help: the following other types implement trait `k8s_openapi::Metadata`:
APIService
Binding
CSIDriver
CSINode
CSIStorageCapacity
CertificateSigningRequest
ClusterRole
ClusterRoleBinding
and 77 others
= note: required for `gateway_api::gateways::Gateway` to implement `kube::Resource`
Seems like easy to understand, that the lib should impl Metadata for Gateway. But looking through Resource and Api::namespaced, I could not find the place where Metadata is required.
Api::namespaced does not require Metadata.
impl<K: Resource> Api<K>
where
<K as Resource>::DynamicType: Default,
{
fn namespaced(client: Client, ns: &str) -> Self
where
K: Resource<Scope = NamespaceResourceScope>
}
Resource and impl Resource for Gateway does not require Metadata, as far as I can see.
So is there a tool or anything to help me figuring this out?
3 posts - 2 participants
🏷️ Rust_feed