pub trait SvidPicker:
Debug
+ Send
+ Sync {
// Required method
fn pick_svid<'a>(&self, svids: &'a [X509Svid]) -> Option<&'a X509Svid>;
}
Expand description
SvidPicker
is a trait defining the behavior for selecting an X509Svid
.
Implementors of this trait must provide a concrete implementation of the pick_svid
method, which
takes a reference to a slice of X509Svid
and returns an Option<&X509Svid>
.
The trait requires that implementing types are both Send
and Sync
, ensuring that they can be
sent between threads and accessed concurrently.
§Example
use spiffe::workload_api::x509_source::SvidPicker;
use spiffe::X509Svid;
#[derive(Debug)]
struct SecondSvidPicker;
impl SvidPicker for SecondSvidPicker {
fn pick_svid<'a>(&self, svids: &'a [X509Svid]) -> Option<&'a X509Svid> {
svids.get(1) // return second svid
}
}