
{%- if f.is_message %}
{#- [optional|repeated] MyMessage => &'this MyMessage #}
type {{ f.ident_camel_unesc }}MessageType<'this> where Self: 'this = &'this {{ f.simple_field_message_path }};
{%- endif %} {#- if f.is_message #}

{%- if f.is_repeated %}

{#- The repeated field getters are different with the struct itselves repeated getter impls. #}
type {{ f.ident_camel_unesc }}RepeatedType<'this> =
    {%- if f.is_message %}
    {#- repeated MyMessage => &'this [MyMessage] #}
    &'this [{{ f.simple_scalar_field_type }}];
    {%- endif %} {#- if f.is_message #}
    {%- if f.is_string || f.is_bytes %}
    {#- repeated String => AsRefRepeatedField<'this, Vec<String>, String, str> #}
    ::puroro::AsRefRepeatedField<
        'this,
        {{ f.simple_field_type }},
        {{ f.simple_scalar_field_type }},
        {%- if f.is_string %}str,{%- endif %}
        {%- if f.is_bytes %}[u8],{%- endif %}
    >;
    {%- endif %} {#- if f.is_string || f.is_bytes #}
    {%- if f.is_numerical %}
    {#- repeated i32 => CloneThenIntoRepeatedField<'this, Vec<i32>, i32, i32> #}
    ::puroro::CloneThenIntoRepeatedField<
        'this,
        {{ f.simple_field_type }},
        {{ f.trait_scalar_getter_type }},
        {{ f.trait_scalar_getter_type }},
        >;
    {%- endif %} {#- if f.is_numerical #}

fn {{ f.ident }}<'this>(&'this self) -> Self::{{ f.ident_camel_unesc }}RepeatedType<'this> {
    {%- if f.is_message %}
    &self.{{ f.ident }}
    {%- endif %} {#- if f.is_message #}
    {%- if f.is_string || f.is_bytes %}
    ::puroro::AsRefRepeatedField::new(&self.{{ f.ident }})
    {%- endif %} {#- if f.is_string || f.is_bytes #}
    {%- if f.is_numerical %}
    ::puroro::CloneThenIntoRepeatedField::new(&self.{{ f.ident }})
    {%- endif %} {#- if f.is_numerical #}
}

{%- else %} {#- if f.is_repeated #}

{%- if !f.is_explicit_oneof_field %}
{#- As same as the struct itselves impl. #}
{#- [optional] i32 => Option<i32> #}
{#- [optional] String => Option<&'this str> #}
{#- [optional] MyMessage => Option<&'this MyMessage> #}
fn {{ f.ident_unesc }}_opt<'this>(&'this self) -> Option<{{ f.trait_scalar_getter_type }}> {
    <self::{{ m.simple_ident }}>::{{ f.ident_unesc }}_opt(self)
}
{%- endif %} {#- if !f.is_explicit_oneof_field #}

{%- endif %} {#- if f.is_repeated #}
