#[non_exhaustive]pub struct FilePayload {
pub name: String,
pub mime_type: String,
pub buffer: Vec<u8>,
}Expand description
FilePayload represents a file for advanced file uploads.
Allows explicit control over filename, MIME type, and file contents when uploading files to input elements.
§Example
let file = FilePayload::new("document.pdf", "application/pdf", vec![/* PDF bytes */]);See: https://playwright.dev/docs/api/class-locator#locator-set-input-files
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringFile name
mime_type: StringMIME type
buffer: Vec<u8>File contents as bytes
Implementations§
Source§impl FilePayload
impl FilePayload
Sourcepub fn new(
name: impl Into<String>,
mime_type: impl Into<String>,
buffer: Vec<u8>,
) -> Self
pub fn new( name: impl Into<String>, mime_type: impl Into<String>, buffer: Vec<u8>, ) -> Self
Creates a FilePayload from a name, MIME type, and contents.
Trait Implementations§
Source§impl Clone for FilePayload
impl Clone for FilePayload
Source§fn clone(&self) -> FilePayload
fn clone(&self) -> FilePayload
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 moreAuto Trait Implementations§
impl Freeze for FilePayload
impl RefUnwindSafe for FilePayload
impl Send for FilePayload
impl Sync for FilePayload
impl Unpin for FilePayload
impl UnsafeUnpin for FilePayload
impl UnwindSafe for FilePayload
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