Skip to main content

rtb_vcs/
lib.rs

1//! Release-provider abstractions for the Rust Tool Base.
2//!
3//! # What this crate is
4//!
5//! A narrow, read-only abstraction over release-source APIs. Tool
6//! authors pick one of six backends — GitHub, GitLab, Bitbucket, Gitea,
7//! Codeberg, or Direct (bare HTTPS URL) — and `rtb-update` consumes the
8//! trait to list, fetch, and download release artefacts.
9//!
10//! # What this crate is not
11//!
12//! - **Not Git.** Repository operations (`Repo`, clone, fetch, commit
13//!   walk) land as `rtb-vcs` v0.2 at the v0.5 roadmap milestone.
14//! - **Not writeable.** `ReleaseProvider` has four methods, all of them
15//!   read-only. Creating releases, uploading assets, and editing tags
16//!   are deliberately out of scope.
17//! - **Not a caching layer.** Every call hits the wire. Downstream
18//!   tools add HTTP caching via `reqwest::ClientBuilder::middleware`
19//!   if they need it.
20//!
21//! # Foundation
22//!
23//! The v0.1.1 release ships the foundation only — trait, value types,
24//! error enum, config structs, and the `linkme`-backed factory
25//! registry. Backend implementations land in follow-up releases,
26//! feature-gated so downstream tools only compile what they use.
27
28// `deny` rather than `forbid` — identical in strictness but allows the
29// targeted `#[allow(unsafe_code)]` below for the built-in backends'
30// `#[distributed_slice(RELEASE_PROVIDERS)]` registrations. `linkme`
31// emits `#[link_section]` attributes at the registration sites, and
32// Rust 1.95+ attributes that behaviour to the `unsafe_code` lint.
33// Every other rtb-* crate keeps `forbid` because they register into
34// slices declared in *other* crates (`rtb_app::BUILTIN_COMMANDS`),
35// which puts the emission behind a cross-crate boundary and out of
36// the `forbid`'s view. `rtb-vcs` is the first crate that declares
37// AND registers in the same library, so it needs the override.
38// Consumers still get the guarantee via the workspace-level
39// `unsafe_code = "deny"` lint — nothing in this crate writes
40// hand-rolled `unsafe` blocks.
41#![deny(unsafe_code)]
42
43pub mod config;
44pub mod release;
45
46// v0.5 git-operations slice — entire module gated on the `git` feature.
47// See `docs/development/specs/2026-05-11-v0.5-scope.md`.
48#[cfg(feature = "git")]
49pub mod git;
50
51// Shared HTTP helpers for the REST-API backends. `pub(crate)` —
52// downstream custom backends roll their own.
53#[cfg(feature = "_http")]
54pub(crate) mod http;
55
56#[cfg(feature = "bitbucket")]
57pub mod bitbucket;
58#[cfg(feature = "codeberg")]
59pub mod codeberg;
60#[cfg(feature = "direct")]
61pub mod direct;
62#[cfg(feature = "gitea")]
63pub mod gitea;
64#[cfg(feature = "github")]
65pub mod github;
66#[cfg(feature = "gitlab")]
67pub mod gitlab;
68
69pub use config::{
70    BitbucketParams, CodebergParams, DirectParams, GiteaParams, GithubParams, GitlabParams,
71    ReleaseSourceConfig,
72};
73pub use release::{
74    lookup, registered_types, ProviderError, ProviderFactory, ProviderRegistration,
75    RegisteredProvider, Release, ReleaseAsset, ReleaseProvider, RELEASE_PROVIDERS,
76};