Rust
Rust
Clear All Multipart Parts
See more REST Examples
Demonstrates Rest.ClearAllParts, which removes all multipart subparts from the request under construction.
Background. Clearing the parts is useful when reusing the same Rest object to build a different multipart request.
Chilkat Rust Downloads
let rest = chilkat::Rest::new();
let b_tls = true;
let b_auto_reconnect = true;
if rest.connect("example.com", 443, b_tls, b_auto_reconnect).is_err() {
println!("{}", rest.last_error_text());
return;
}
// Build a part.
rest.set_part_selector("1");
if rest.set_multipart_body_string("value1").is_err() {
println!("{}", rest.last_error_text());
return;
}
// Remove all multipart subparts from the request under construction, for example before reusing the
// same Rest object for a different multipart request.
let _ = rest.clear_all_parts();
println!("All multipart parts cleared.");