TargetSet
A canonical target set: deduplicated, sorted by string form, non-empty, at most one target per provider.
A canonical target set: deduplicated, sorted by string form, non-empty, at most one target per provider.
use sponsorkit::TargetSet;
pub struct TargetSet { /* private fields */ }Methods#
new#
pub fn new(targets: Vec<Target>) -> Result<TargetSet>Canonicalizes a list of targets.
| Parameter | Type |
|---|---|
targets | Vec<Target> (see Target) |
Returns: Result<TargetSet> (see Result, TargetSet)
parse#
pub fn parse(param: &str) -> Result<TargetSet>Parses a comma-separated target param.
| Parameter | Type |
|---|---|
param | &str |
Returns: Result<TargetSet> (see Result, TargetSet)
targets#
pub fn targets(&self) -> &[Target]The targets in canonical order.
Returns: &[Target] (see Target)
first#
pub fn first(&self) -> &TargetThe first target in canonical order.
Returns: &Target
get#
pub fn get(&self, provider: Provider) -> Option<&Target>The target for a provider, if configured.
| Parameter | Type |
|---|---|
provider | Provider |
Returns: Option<&Target> (see Target)
strings#
pub fn strings(&self) -> Vec<String>The canonical target strings, e.g. ["github:x", "open-collective:y"].
Returns: Vec<String>
param#
pub fn param(&self) -> StringThe target param: canonical strings joined with ,.
Returns: String
hash#
pub fn hash(&self) -> Stringtargets_hash: lowercase hex SHA-256 of the target param.
Returns: String
Trait implementations#
impl Clone for TargetSetimpl Debug for TargetSetimpl Display for TargetSetimpl Eq for TargetSetimpl PartialEq for TargetSet