<commit_before>var util = require('../util')

var toRust = function (curlCommand) {
  var request = util.parseCurlCommand(curlCommand)
  var rustCode = 'extern crate reqwest;\n'

  if (request.headers || request.cookies) {
    rustCode += 'use reqwest::headers::*;\n'
  }
  if (request.multipartUploads) {
    rustCode += 'use reqwest::multipart;\n'
  }

  rustCode += '\nfn main() -> Result<(), reqwest::Error> {\n'

  if (request.headers || request.cookies) {
    rustCode += '    let mut headers = HeaderMap::new();\n'

    for (var header in request.headers) {
      rustCode += '    headers.insert(' + header.replace(/-/g, '_').toUpperCase() + ', "' + request.headers[header] + '".parse().unwrap());\n'
    }

    for (var cookie in request.cookies) {
      rustCode += '    headers.insert(COOKIE, "' + cookie + '".parse().unwrap());\n'
    }
  }

  if (request.multipartUploads) {
    rustCode += '    let form = multipart::From::new()'
<commit_msg>From to Form in rust generator<commit_after>var util = require('../util')

var toRust = function (curlCommand) {
  var request = util.parseCurlCommand(curlCommand)
  var rustCode = 'extern crate reqwest;\n'

  if (request.headers || request.cookies) {
    rustCode += 'use reqwest::headers::*;\n'
  }
  if (request.multipartUploads) {
    rustCode += 'use reqwest::multipart;\n'
  }

  rustCode += '\nfn main() -> Result<(), reqwest::Error> {\n'

  if (request.headers || request.cookies) {
    rustCode += '    let mut headers = HeaderMap::new();\n'

    for (var header in request.headers) {
      rustCode += '    headers.insert(' + header.replace(/-/g, '_').toUpperCase() + ', "' + request.headers[header] + '".parse().unwrap());\n'
    }

    for (var cookie in request.cookies) {
      rustCode += '    headers.insert(COOKIE, "' + cookie + '".parse().unwrap());\n'
    }
  }

  if (request.multipartUploads) {
    rustCode += '    let form = multipart::Form::new()'

{'fraction_non_alphanumeric': 0.18785677218474311, 'fraction_numerical': 0.0, 'mean_word_length': 3.265486725663717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6494479', 'n_tokens_mistral': 654, 'n_tokens_neox': 637, 'n_words': 137}