Skip to main content

Module crates_io

Module crates_io 

Source
Expand description

crates.io search-crates operation.

Split by responsibility:

  • types — agent-facing wire payloads and request echo
  • urls — URL builders and pagination bounds
  • parse — JSON body parsing and hostile-field capping
  • fetch — HTTP execution against an allowlisted origin

Structs§

CrateSearchHit
One hit from crates.io search.
SearchCratesData
Full search-crates data payload.
SearchEcho
Echo fields for search-crates taken from the effective request URL (single source of truth after URL planning, including --page-token).
SearchMeta
Pagination meta from crates.io (may contain page= or seek= tokens).

Functions§

clamp_search_pagination
Clamp crates.io pagination to product bounds (per_page 1..=100, page >= 1).
echo_params_from_url
Derive echo params from the planned URL query string.
parse_search_body
Parse crates.io JSON body into product types (offline-testable).
planned_url
Build the planned crates.io search URL (production origin).
planned_url_on_host
Build the crates.io search URL for an allowlisted origin (page pagination).
planned_url_with_page_token
Build search URL using an opaque next_page / prev_page token from crates.io meta.
search_crates
Execute search-crates against crates.io (production origin).
search_crates_at
Execute search against a pre-built URL (mock hosts in tests).
search_crates_on_origin
Execute search-crates against an allowlisted origin (offline mocks).
validate_search_pagination
Validate explicit CLI pagination flags (fail-closed).