Skip to main content

AuthStrategyBounds

Trait AuthStrategyBounds 

Source
pub trait AuthStrategyBounds:
    Send
    + Sync
    + 'static { }
Expand description

Marker trait alias for the bounds an owned AuthStrategy-providing credential type C must satisfy when held inside a long-lived client (e.g. cipherstash_client::ZeroKMS<C> shared across requests).

  • On native targets C must be Send + Sync + 'static so the client can be carried across tokio task / reqwest worker boundaries.
  • On wasm32 the runtime is single-threaded and the typical credential backing (a JS callable held by a JsValue) cannot cross threads even in principle, so the Send + Sync requirement is dropped and only 'static remains.

Implemented via a blanket impl — any type satisfying the per-target bounds automatically implements AuthStrategyBounds. Callers don’t implement it directly.

Mirrors the cfg-split already in place on AuthStrategy itself, one layer up. Wasm consumers (e.g. @cipherstash/protect-ffi on wasm32-unknown-unknown) can hold a !Send + !Sync credential type without declaring unsafe impl Send / Sync.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Send + Sync + 'static> AuthStrategyBounds for T

Available on non-WebAssembly only.