Skip to main content

Uploader

Trait Uploader 

Source
pub trait Uploader:
    Send
    + Sync
    + 'static {
    // Required method
    fn store(
        &self,
        filename: &str,
        bytes: &[u8],
    ) -> impl Future<Output = Result<String, String>> + Send;

    // Provided method
    fn holds(&self, path: &str) -> impl Future<Output = bool> + Send { ... }
}
Expand description

Stores one uploaded file and names the value a record stores; installed once per panel with Panel::uploads.

filename arrives sanitized to a non-empty basename without directories or control characters; bytes are bounded by the 10 MiB form-body cap. The framework stores the returned path verbatim.

Required Methods§

Source

fn store( &self, filename: &str, bytes: &[u8], ) -> impl Future<Output = Result<String, String>> + Send

Stores bytes and returns the value to store; the Err string renders inside the field’s inline error, so it must be user-actionable.

Provided Methods§

Source

fn holds(&self, path: &str) -> impl Future<Output = bool> + Send

Answers true only for a path this store returned and still resolves inside its own root; the default answers false.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§