1
Fork 0

Fix union fields display

This commit is contained in:
Guillaume Gomez 2023-06-21 17:25:19 +02:00
parent 6fc0273b5a
commit 6f48526963
4 changed files with 11 additions and 11 deletions

View file

@ -421,11 +421,10 @@ fn document<'a, 'cx: 'a>(
display_fn(move |f| { display_fn(move |f| {
document_item_info(cx, item, parent).render_into(f).unwrap(); document_item_info(cx, item, parent).render_into(f).unwrap();
if parent.is_none() { if parent.is_none() {
write!(f, "{}", document_full_collapsible(item, cx, heading_offset))?; write!(f, "{}", document_full_collapsible(item, cx, heading_offset))
} else { } else {
write!(f, "{}", document_full(item, cx, heading_offset))?; write!(f, "{}", document_full(item, cx, heading_offset))
} }
Ok(())
}) })
} }

View file

@ -1,5 +1,5 @@
{% if !items.is_empty() %} {% if !items.is_empty() %}
<span class="item-info"> {# #} <span class="item-info">
{% for item in items %} {% for item in items %}
{{item|safe}} {# #} {{item|safe}} {# #}
{% endfor %} {% endfor %}

View file

@ -4,14 +4,15 @@
</code></pre> </code></pre>
{{ self.document() | safe }} {{ self.document() | safe }}
{% if self.fields_iter().peek().is_some() %} {% if self.fields_iter().peek().is_some() %}
<h2 id="fields" class="fields small-section-header"> <h2 id="fields" class="fields small-section-header"> {# #}
Fields<a href="#fields" class="anchor">§</a> Fields<a href="#fields" class="anchor">§</a> {# #}
</h2> </h2>
{% for (field, ty) in self.fields_iter() %} {% for (field, ty) in self.fields_iter() %}
{% let name = field.name.expect("union field name") %} {% let name = field.name.expect("union field name") %}
<span id="structfield.{{ name }}" class="{{ ItemType::StructField }} small-section-header"> <span id="structfield.{{ name }}" {#+ #}
<a href="#structfield.{{ name }}" class="anchor field">§</a> class="{{ ItemType::StructField +}} small-section-header"> {# #}
<code>{{ name }}: {{ self.print_ty(ty) | safe }}</code> <a href="#structfield.{{ name }}" class="anchor field">§</a> {# #}
<code>{{ name }}: {{+ self.print_ty(ty) | safe }}</code> {# #}
</span> </span>
{% if let Some(stability_class) = self.stability_field(field) %} {% if let Some(stability_class) = self.stability_field(field) %}
<span class="stab {{ stability_class }}"></span> <span class="stab {{ stability_class }}"></span>

View file

@ -1,5 +1,5 @@
<div class="main-heading"> {# #} <div class="main-heading"> {# #}
<h1> {# #} <h1>
{{typ}} {{typ}}
{# The breadcrumbs of the item path, like std::string #} {# The breadcrumbs of the item path, like std::string #}
{% for component in path_components %} {% for component in path_components %}
@ -12,7 +12,7 @@
alt="Copy item path"> {# #} alt="Copy item path"> {# #}
</button> {# #} </button> {# #}
</h1> {# #} </h1> {# #}
<span class="out-of-band"> {# #} <span class="out-of-band">
{% if !stability_since_raw.is_empty() %} {% if !stability_since_raw.is_empty() %}
{{ stability_since_raw|safe +}} · {#+ #} {{ stability_since_raw|safe +}} · {#+ #}
{% endif %} {% endif %}