TargetSet

A canonical target set: deduplicated, sorted by string form, non-empty, at most one target per provider.

On this page

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.

ParameterType
targetsVec<Target> (see Target)

Returns: Result<TargetSet> (see Result, TargetSet)

parse#

pub fn parse(param: &str) -> Result<TargetSet>

Parses a comma-separated target param.

ParameterType
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) -> &Target

The first target in canonical order.

Returns: &Target

get#

pub fn get(&self, provider: Provider) -> Option<&Target>

The target for a provider, if configured.

ParameterType
providerProvider

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) -> String

The target param: canonical strings joined with ,.

Returns: String

hash#

pub fn hash(&self) -> String

targets_hash: lowercase hex SHA-256 of the target param.

Returns: String

Trait implementations#

  • impl Clone for TargetSet
  • impl Debug for TargetSet
  • impl Display for TargetSet
  • impl Eq for TargetSet
  • impl PartialEq for TargetSet