pub struct FileInput {
pub name: String,
pub mime_type: String,
pub contents: Vec<u8>,
pub path: Option<PathBuf>,
}Expand description
File input for upload operations
Fields§
§name: StringFile name
mime_type: StringMIME type
contents: Vec<u8>File contents
path: Option<PathBuf>Original path (if from filesystem)
Implementations§
Source§impl FileInput
impl FileInput
Sourcepub fn new(
name: impl Into<String>,
mime_type: impl Into<String>,
contents: Vec<u8>,
) -> Self
pub fn new( name: impl Into<String>, mime_type: impl Into<String>, contents: Vec<u8>, ) -> Self
Create a new file input
Sourcepub fn from_path(path: impl AsRef<Path>) -> Self
pub fn from_path(path: impl AsRef<Path>) -> Self
Create from path (mock - doesn’t actually read file)
Sourcepub fn from_path_with_contents(
path: impl AsRef<Path>,
contents: Vec<u8>,
) -> Self
pub fn from_path_with_contents( path: impl AsRef<Path>, contents: Vec<u8>, ) -> Self
Create from path with contents
Sourcepub fn contents_string(&self) -> Option<String>
pub fn contents_string(&self) -> Option<String>
Get contents as string (if valid UTF-8)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileInput
impl<'de> Deserialize<'de> for FileInput
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
Auto Trait Implementations§
impl Freeze for FileInput
impl RefUnwindSafe for FileInput
impl Send for FileInput
impl Sync for FileInput
impl Unpin for FileInput
impl UnsafeUnpin for FileInput
impl UnwindSafe for FileInput
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