blob: f35bd2d61f60e67127a8781577f5d17cfcf05ab9 [file] [log] [blame]
{{ self.doc_string(cnst.attributes) -}}
{% match cnst.ty.kind %}
{% when TypeKind::String { element_count, nullable } %}
pub const {{ name }}: &str = "{{ cnst.value.value.escape_default() }}";
{% when TypeKind::Primitive { subtype } %}
pub const {{ name }}: {{ self.natural_prim(subtype) }} = {{ cnst.value.value }} as {{ self.natural_prim(subtype) }};
{% when TypeKind::Identifier { identifier, nullable, protocol_transport } %}
pub const {{ name }}: {{ self.natural_id(identifier) }} = {{ self.constant(cnst.value, cnst.ty) }};
{% else %}
panic!("invalid constant type");
{% endmatch %}