Skip to main content

docgen_core/
asseturl.rs

1//! An S3-agnostic hook that lets the asset-URL rewrite pass point a resolved,
2//! docs-root-relative asset path at an externally-hosted URL (e.g. an S3/CDN
3//! object). `docgen-core` owns the trait so it never depends on `docgen-s3`;
4//! the S3 crate implements it. When no resolver is supplied, the pass emits the
5//! usual base-absolute local URL.
6pub trait AssetUrlResolver {
7    /// Return the public URL for the asset at `rel_path` (docs-root-relative,
8    /// `/`-separated, no leading slash), or `None` to fall back to the local URL.
9    fn resolve(&self, rel_path: &str) -> Option<String>;
10}