// Code generated by fixer-gen. DO NOT EDIT.
#![allow(clippy::new_without_default)]
#![allow(unused_imports)]

use fixer::field_map::FieldMap;
use fixer::fix_string::FIXString;
use crate::tag;

/// `Trailer` is the `{{ package }}` Trailer type.
pub struct Trailer<'a> {
    pub trailer: &'a mut FieldMap,
}

impl Trailer<'_> {
{% for f in fields %}
{% if not f.is_group %}
{% if f.fixer_type == "FIXString" %}
    /// Sets `{{ f.name }}`, Tag {{ f.tag }}.
    pub fn set_{{ f.snake_name }}(&mut self, v: String) {
        self.trailer.set_field(tag::{{ f.const_name }}, FIXString::from(v));
    }
{% elif f.fixer_type == "FIXInt" %}
    /// Sets `{{ f.name }}`, Tag {{ f.tag }}.
    pub fn set_{{ f.snake_name }}(&mut self, v: isize) {
        self.trailer.set_field(tag::{{ f.const_name }}, fixer::fix_int::FIXInt::from(v));
    }
{% endif %}

    /// Returns true if `{{ f.name }}` is present, Tag {{ f.tag }}.
    pub fn has_{{ f.snake_name }}(&self) -> bool {
        self.trailer.has(tag::{{ f.const_name }})
    }
{% endif %}
{% endfor %}
}
