#[non_exhaustive]pub struct UploadPolicy { /* private fields */ }Expand description
Immutable upload admission policy.
Implementations§
Source§impl UploadPolicy
impl UploadPolicy
Sourcepub fn try_new(
max_bytes: usize,
allowed: impl IntoIterator<Item = UploadKind>,
) -> Result<Self, UploadError>
pub fn try_new( max_bytes: usize, allowed: impl IntoIterator<Item = UploadKind>, ) -> Result<Self, UploadError>
Constructs a bounded allowlist. The hard ceiling prevents accidentally buffering objects larger than 100 MiB through this in-memory API.
Sourcepub fn allowed_kinds(&self) -> &[UploadKind]
pub fn allowed_kinds(&self) -> &[UploadKind]
Returns the deduplicated content-kind allowlist.
Sourcepub fn admit(
&self,
tenant_id: &str,
file_name: &str,
declared_media_type: &str,
bytes: &[u8],
) -> Result<QuarantinedUpload, UploadError>
pub fn admit( &self, tenant_id: &str, file_name: &str, declared_media_type: &str, bytes: &[u8], ) -> Result<QuarantinedUpload, UploadError>
Validates identity, name, size, declared MIME and signature before an application writes the bytes under the returned quarantine key.
Trait Implementations§
Source§impl Clone for UploadPolicy
impl Clone for UploadPolicy
Source§impl Debug for UploadPolicy
impl Debug for UploadPolicy
impl Eq for UploadPolicy
Source§impl PartialEq for UploadPolicy
impl PartialEq for UploadPolicy
impl StructuralPartialEq for UploadPolicy
Auto Trait Implementations§
impl Freeze for UploadPolicy
impl RefUnwindSafe for UploadPolicy
impl Send for UploadPolicy
impl Sync for UploadPolicy
impl Unpin for UploadPolicy
impl UnsafeUnpin for UploadPolicy
impl UnwindSafe for UploadPolicy
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