# File lib/bson/bson_ruby.rb, line 522
    def serialize_string_element(buf, key, val, type)
      buf.put(type)
      self.class.serialize_key(buf, key)

      # Make a hole for the length
      len_pos = buf.position
      buf.put_int(0)

      # Save the string
      start_pos = buf.position
      self.class.serialize_cstr(buf, val)
      end_pos = buf.position

      # Put the string size in front
      buf.put_int(end_pos - start_pos, len_pos)

      # Go back to where we were
      buf.position = end_pos
    end