pub struct Form { /* private fields */ }Expand description
An ordered list of parts, encoded in one piece by Form::encode.
Implementations§
Source§impl Form
impl Form
pub fn new() -> Self
pub fn text(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn file( self, name: impl Into<String>, filename: impl Into<String>, bytes: Vec<u8>, ) -> Self
pub fn part(self, part: Part) -> Self
pub fn parts(&self) -> &[Part]
Sourcepub fn encode(&self, entropy: [u8; 16]) -> Result<Encoded>
pub fn encode(&self, entropy: [u8; 16]) -> Result<Encoded>
Serialize the form. entropy should come from the host’s secure random
source; any value yields a boundary absent from every part, but only
unpredictable entropy keeps the boundary unguessable.
A content type containing a control character (CR/LF included) is rejected. Quotes, CR and LF in names and filenames are percent-encoded as browsers do; other bytes are written as given.
Trait Implementations§
impl Eq for Form
impl StructuralPartialEq for Form
Auto Trait Implementations§
impl Forget for Form
impl Freeze for Form
impl RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin for Form
impl UnwindSafe for Form
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