pub struct DirectUploadRequest {
pub filename: String,
pub content_type: String,
pub size: u64,
}Expand description
What the browser declares before a direct upload: the file’s name, type and size.
The JSON body of the “start an upload” request ({"filename": "a.png", "content_type": "image/png", "size": 1234}), read from File.name,
File.type and File.size. direct_upload
checks it against Rules before signing anything.
§Examples
let request: ocre::storage::DirectUploadRequest =
serde_json::from_str(r#"{"filename":"a.png","content_type":"image/png","size":1234}"#).unwrap();
assert_eq!(request.size, 1234);Fields§
§filename: StringFile name, as the browser gives it (cleaned up when attached).
content_type: StringDeclared content type; signed into the upload URL, so R2 stores this one.
size: u64Declared size in bytes; signed into the upload URL as Content-Length.
Trait Implementations§
Source§impl Clone for DirectUploadRequest
impl Clone for DirectUploadRequest
Source§fn clone(&self) -> DirectUploadRequest
fn clone(&self) -> DirectUploadRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DirectUploadRequest
impl Debug for DirectUploadRequest
Source§impl Default for DirectUploadRequest
impl Default for DirectUploadRequest
Source§fn default() -> DirectUploadRequest
fn default() -> DirectUploadRequest
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DirectUploadRequest
impl<'de> Deserialize<'de> for DirectUploadRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DirectUploadRequest
Source§impl PartialEq for DirectUploadRequest
impl PartialEq for DirectUploadRequest
Source§fn eq(&self, other: &DirectUploadRequest) -> bool
fn eq(&self, other: &DirectUploadRequest) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DirectUploadRequest
impl Serialize for DirectUploadRequest
impl StructuralPartialEq for DirectUploadRequest
Auto Trait Implementations§
impl Freeze for DirectUploadRequest
impl RefUnwindSafe for DirectUploadRequest
impl Send for DirectUploadRequest
impl Sync for DirectUploadRequest
impl Unpin for DirectUploadRequest
impl UnsafeUnpin for DirectUploadRequest
impl UnwindSafe for DirectUploadRequest
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.