Documentation
¶
Overview ¶
Package crates resolves Rust crate versions from the crates.io registry API.
Index ¶
- type Option
- type Provider
- func (p *Provider) Color(dark bool) color.Color
- func (p *Provider) Dated()
- func (p *Provider) Describe(r provider.Resource) string
- func (p *Provider) Discover(ctx context.Context, r provider.Resource) ([]model.Candidate, error)
- func (p *Provider) Identify(r provider.Resource) (string, string)
- func (p *Provider) Keys() []provider.Key
- func (p *Provider) Name() string
- func (p *Provider) Resource(d directive.Directive) (provider.Resource, error)
- func (p *Provider) URL(r provider.Resource, c model.Candidate) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures a Provider.
func WithTransport ¶
func WithTransport(rt http.RoundTripper) Option
WithTransport overrides the HTTP transport, for tests.
func WithVersion ¶
WithVersion sets the clover version woven into the User-Agent. The composition root passes the running binary's version; an empty value keeps the versionless fallback.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider resolves Rust crate versions from the crates.io registry API. One fetch returns a crate's whole version history, so the provider lists candidates and lets the framework own selection, tagging each with the publish time and .crate checksum the API returns for free.
func New ¶
New returns the crates provider. The registry API is public and unauthenticated, so the client is a plain cached one with no ratelimit wrapper or credentials.
func (*Provider) Color ¶
Color is the provider's brand color. See provider.Provider.Color.
func (*Provider) Dated ¶
func (p *Provider) Dated()
Dated marks the listing as date-bearing: every version carries its publish time, so cooldown applies.
func (*Provider) Discover ¶
Discover lists a crate's candidate versions, reading the registry API in one fetch. The API returns the whole version history in a single response, so there is no pagination and nothing is ever left unread - --deep has no work to do here. Candidates are sorted naturally for a deterministic listing.
func (*Provider) Resource ¶
Resource validates a directive into a crates.io resource: the crate name, kept exactly as written because the registry looks crates up by their published spelling.