You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
implClient{pubfnform<F:Into<LocalForm>>(&mutself,form:F) -> &mutSelf{let form = form.into();self.set_header(form.content_type());self.set_body(form.body_data());self}}structLocalForm{/* .. */}implLocalForm{pubfnnew() -> Self;/// A percent-decoded `name` and `value`.pubfnfield<'v,N,V>(mutself,name:N,value:V) -> SelfwhereN:Into<NameBuf<'v>>,V:AsRef<str>;/// Adds all of the `fields` to `self`.pubfnfields<'v,I,F>(mutself,fields:I) -> SelfwhereI:Iterator<Item = F>,F:Into<ValueField<'v>>;/// A percent-encoded `name` and `value`.pubfnraw_field(mutself,name:&'v RawStr,value:&'v RawStr) -> Self;/// Adds a field for the file with name `file_name`, content-type `ct`, and/// file contents `data`.pubfnfile<'v,N,V>(mutself,file_name:N,ct:ContentType,data:V) -> SelfwhereN:Into<Option<&'v str>>,V:AsRef<[u8]>;/// Add a data field with content-type `ct` and binary `data`.pubfndata<'v,V>(mutself,ct:ContentType,data:V) -> SelfwhereV:AsRef<[u8]>;/// The full content-type for this form.pubfncontent_type(&self) -> ContentType;/// The full body data for this form.pubfnbody_data(&self) -> Vec<u8>;}impl<'v,F:Into<ValueField<'v>>,I:Iterator<Item = F>>From<I>forLocalForm{/* .. */}
The text was updated successfully, but these errors were encountered:
Would it not make more sense to create a macro that implements a ToForm trait to serialise a struct to a string encoded form? I feel like that would be a common use case, given that most functions will serialise it back to a struct immediately.
Testing forms in Rocket is currently an entirely manual process:
With the addition of multipart form support, form testing verbosity is even further exacerbated:
Rocket should make testing applications with forms a much simpler task.
Here's how we might hope testing the above forms would look:
An API enabling this might resemble:
The text was updated successfully, but these errors were encountered: