{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
	/* member {{ name }} (aggregate list) */
{% endif %}
	{
		struct xdrgen_aggregate_cursor cursor = {
			.xdr = xdr,
			.member_id = {{ member_sym }},
			.ctx = xdr->xdrgen_ctx,
		};
		bool ok = true;

		if (!{{ hook }}_encode_begin(&cursor))
			return false;
		for (cursor.index = 0; ; cursor.index++) {
			{{ classifier }}{{ c_type }} element = {};

			if (!{{ hook }}_encode(&cursor, &element))
				break;
			if (!xdrgen_encode_{{ type }}(xdr, &element)) {
				ok = false;
				break;
			}
		}
		if (ok && !xdrgen_encode_{{ type }}(xdr, NULL))
			ok = false;
		if (!{{ hook }}_encode_end(&cursor, ok) || !ok)
			return false;
	}