multipart Reader/Writer. EOF is the error EOF.
struct Part
pub struct Part {
pub keys []string
pub vals []string
pub body string
}
Purpose
MIME multipart (RFC 2046 / RFC 2388 form-data) aligned with `mime/multipart` Reader.NextPart + Writer write-field subset. Parts are owning strings (no io.Reader). Headers are parallel slices.
Parameters
keys []string- field ([]string)
vals []string- field ([]string)
body string- body
(Part) body
pub fn (p Part) body() string
Purpose
Call `body` on `Part`.
Parameters
p Part- receiver Part (value receiver)
Returns
string — result string
(&mut Reader) next_part
pub fn (r &mut Reader) next_part() Part
Purpose
Method on `&mut Reader`: next part. Throws on failure.
Parameters
r &mut Reader- receiver &mut Reader (exclusive borrow)
Returns
Part — a value of this type
new_writer_with_boundary
pub fn new_writer_with_boundary(boundary &string) Writer
Purpose
Construct writer with boundary.
Parameters
boundary &string- boundary (borrowed; caller keeps it; type &string)
Returns
Writer — a value of this type
(&mut Writer) write_file
pub fn (w &mut Writer) write_file(name &string, filename &string, content_type &string, body &string)
Purpose
Method on `&mut Writer`: write file.
Parameters
w &mut Writer- receiver &mut Writer (exclusive borrow)
name &string- name (borrowed; caller keeps it; type &string)
filename &string- filename (borrowed; caller keeps it; type &string)
content_type &string- content_type (borrowed; caller keeps it; type &string)
body &string- body (borrowed; caller keeps it; type &string)