title: How to use Serde to parse a YAML file with multiple different types?
body: <p>I'm trying to parse this YAML file</p>
  
  <pre><code>application:
    build: something
    container_name: another_thing
    environment:
      - ONE_ENV=fake
      - SEC_ENV=something
  </code></pre>
  
  <p>I've created this code that works perfectly:</p>
  
  <pre><code>#[macro_use]
  extern crate serde_derive;
  extern crate serde_yaml;
  
  use std::fs::File;
  use std::io::Read;
  
  #[derive(Debug, PartialEq, Serialize, Deserialize)]
  struct Application {
      application: Data,
  }
  
  #[derive(Debug, PartialEq, Serialize, Deserialize)]
  struct Data {
      build: String,
      container_name: String,
  
      #[serde(skip_serializing_if = "Option::is_none")]
      environment: Option&lt;Vec&lt;String&gt;&gt;,
  }
  
  fn main() {
      let filename = "example.yml";
      match File::open(filename) {
          Ok(mut file) =&gt; {
              let mut content = String::new();
              file.read_to_string(&amp;mut content).unwrap();
  
              let application_data: Application = serde_yaml::from_str(&amp;content).unwrap();
              println!("{:?}", application_data.application.environment);
          }
          Err(error) =&gt; {
              println!("There is an error {}: {}", filename, error);
          }
      }
  }
  </code></pre>
  
  <p>I need to support this format too:</p>
  
  <pre><code>application:
    build: something
    container_name: another_thing
    environment:
      ONE_ENV: fake
      SEC_ENV: something
  </code></pre>
  
  <p>How I can deal with two different ways to parse?</p>