NexusConfig is a plain Rust struct holding every value required to construct a client. Pass it by value to NexusClient::create.
Field reference
API key types
Where to keep the API key
The conventional Rust pattern is environment variables:Choosing the TTL
The TTL is a trade-off between staleness window and redundant network traffic. With SSE enabled (client.run_stream()), changes propagate within milliseconds regardless of the TTL - the TTL is only a safety net if the stream falls back to polling.
When SSE is connected, the effective TTL is clamped to at least 60 s internally - there is no benefit to polling more aggressively when the stream already pushes events the moment they happen.
WifConfig
WifConfig configures Workload Identity Federation. The wif field is None by default; WIF is active only when it is Some.
WifConfig field reference
See Workload identity for the full WIF setup guide.
Clone behaviour
NexusClient implements Clone. Cloning is cheap - it increments an Arc reference count and shares the same internal cache state. All clones read from and write to the same snapshot.
NexusClient across actix-web extractors, axum State, or a thread pool - just clone once per handler and move the clone in.
The
Drop implementation only runs cleanup (temp file removal for file-type secrets) when the last clone is dropped. Dropping individual clones does not clean up shared resources.