Skip to main content

Module attach

Module attach 

Source

Structs§

Attachment
One stored attachment, as the detail page and the serve route need it.
FileField
A file field a resource exposes on its detail page. Declared from Resource::file_fields.
UploadedFile
A file arriving on an upload request. The adapter builds this from the multipart body; bytes is the whole file held in memory (fine for the admin use-case — logos, avatars, small docs — a streaming path can come later).

Traits§

Attachments
A pluggable attachment backend: stores the bytes somewhere and records the metadata so it can be listed and served back.

Functions§

attachments
The registered backend, if any.
is_enabled
Whether attachment support is on. The detail page checks this before rendering upload widgets, and crud::delete before trying to purge.
list
List a record’s attachments for display. Returns empty (never errors to the caller) so the detail page renders even when the backend hiccups.
purge
Purge every attachment for a record. Best-effort: a failure is logged, not propagated, so a storage hiccup can’t block a delete the user asked for.
set_attachments
Register the global attachment backend. Set-once, matching the other seams.
store
Store an uploaded file, returning a ready ApiResponse. The adapter calls this after parsing multipart; auth is the caller’s responsibility (the resource checks Update before invoking).