title: How can I add onto the end of a large [u8] variable in rust?
body: <p>I have a DNA sequence that I have via reading in from a fasta and it is as a <code>&amp;[u8]</code> variable. How can I most efficiently add in a $ at the end so that I can build a suffix array from it? I'm trying to mess around with pattern matching algorithms. Thanks in advance, I'm a bit new to this. I've tried simple <code>+</code> and some concat macros, but when I try it says that <code>b&quot;$&quot;</code> is <code>&amp;[u8; 1]</code> which I think it means that it has a specified length and therefore can't be added, but then it might just be adding the bits anyway. Thanks for all your help.</p>
  <p>Here's what I try to run</p>
  <pre><code>    use bio::data_structures::suffix_array::suffix_array;
      use bio::io::fasta;
      // use std::io;
      use std::env;
      use std::str;
      
      fn main() {
          let args: Vec&lt;String&gt; = env::args().collect();
          let filename: &amp;str = &amp;args[1];
      
          
          let reader = fasta::Reader::from_file(filename).unwrap();
          let mut nb_reads = 0;
          let mut nb_bases = 0;
      
      
          
          for result in reader.records() {
      
              let result_data = &amp;result.unwrap();
      
              let dol: u8 = b&quot;$&quot;[0];
      
              nb_reads += 1;
              nb_bases += result_data.seq().len();
      
              let seq = result_data.seq() + b&quot;$&quot;;
      
              println!(&quot;seq id: {:?}&quot;,result_data.id());
      
              let sa = suffix_array(seq);
              println!(&quot;sa: {:#?}&quot;,sa);
      
          }
      println!(&quot;Number of reads: {}&quot;, nb_reads);
      println!(&quot;Number of bases: {}&quot;, nb_bases);
  }
  </code></pre>
  <p>I've figured out a bit more so that it doesn't complain, but it doesn't appear to work. I made it a vector and then pushed a variable into it, but then when I do that it results in a variable of unit type, in this instance <code>seq_dol</code></p>
  <pre><code>fn main() {
      let args: Vec&lt;String&gt; = env::args().collect();
      let filename: &amp;str = &amp;args[1];
  
      
      let reader = fasta::Reader::from_file(filename).unwrap();
      let mut nb_reads = 0;
      let mut nb_bases = 0;
  
  
      
      for result in reader.records() {
  
          let result_data = &amp;result.unwrap();
  
          let dol: u8 = b&quot;$&quot;[0];
  
          nb_reads += 1;
          nb_bases += result_data.seq().len();
  
          let seq_vec = result_data.seq().to_vec();
          
          let seq_dol = seq_vec.push(dol);
  
          println!(&quot;seq id: {:?}&quot;,result_data.id());
  
          let sa = suffix_array(seq_dol);
          println!(&quot;sa: {:?}&quot;,sa);
  
      }
  
      println!(&quot;Number of reads: {}&quot;, nb_reads);
      println!(&quot;Number of bases: {}&quot;, nb_bases);
  }
  </code></pre>