pub struct AssetServiceResolver {
pub scheme: String,
pub base_url: String,
pub subject_id: Option<String>,
pub max_body_bytes: usize,
/* private fields */
}Expand description
Resolver for an asset service’s own URI scheme, named by the caller:
{scheme}://{asset_id}→GET {base}/download/{asset_id}{scheme}://{asset_id}/{derivative}→GET {base}/download/{asset_id}/{derivative}
Authenticates by sending X-Subject-Id (a subject identifier as injected
by an identity proxy such as Ory Oathkeeper). The id is the caller’s
choice — typically the PDF generator’s service account or the
requesting user.
Fields§
§scheme: StringURI scheme this resolver answers, without ://. Example: asset.
base_url: StringBase URL, no trailing slash. Example: http://assets:3002.
subject_id: Option<String>Sent as X-Subject-Id. Required for non-public assets.
max_body_bytes: usizeImplementations§
Trait Implementations§
Source§impl AssetResolver for AssetServiceResolver
impl AssetResolver for AssetServiceResolver
Source§fn fetch(&self, uri: &str) -> Result<Vec<u8>, AssetError>
fn fetch(&self, uri: &str) -> Result<Vec<u8>, AssetError>
Fetch the bytes referenced by
uri. The URI can be a relative or
absolute path, an http:// / https:// URL, an asset-service
reference, or anything else a caller-supplied resolver knows how to handle.Source§fn resolve_id(&self, _id: &str) -> Option<String>
fn resolve_id(&self, _id: &str) -> Option<String>
Resolve a bare asset
id (no path, no extension — e.g. an asset
service’s UUID) to a URI that fetch can load. A filesystem
resolver searches its root recursively for a file whose stem matches;
resolvers that can’t map an id return None (the default). Used as a
fallback for {% media id="…" /%} when the id isn’t a file sitting
directly in the asset root.Auto Trait Implementations§
impl !RefUnwindSafe for AssetServiceResolver
impl !UnwindSafe for AssetServiceResolver
impl Forget for AssetServiceResolver
impl Freeze for AssetServiceResolver
impl Move for AssetServiceResolver
impl Send for AssetServiceResolver
impl Sync for AssetServiceResolver
impl Unpin for AssetServiceResolver
impl UnsafeUnpin for AssetServiceResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.