-
Notifications
You must be signed in to change notification settings - Fork 198
/
features.html
112 lines (106 loc) · 6.57 KB
/
features.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{% extends "base.html" %}
{%- import "header/package_navigation.html" as navigation -%}
{%- block title -%}
{% call macros::doc_title(name=metadata.name, version=metadata.version) %}
{%- endblock title -%}
{%- block meta -%}
<link rel="canonical" href="{{ canonical_url|safe }}" />
{%- endblock -%}
{%- block topbar -%}
{%- set inner_path = metadata.target_name_url() -%}
{%- include "rustdoc/topbar.html" -%}
{%- endblock topbar -%}
{%- block header -%}
{% call navigation::package_navigation(metadata=metadata, active_tab="features") %}
{%- endblock header -%}
{%- block body -%}
<div class="container package-page-container">
<div class="pure-g">
<div class="pure-u-1 pure-u-sm-7-24 pure-u-md-5-24">
<div class="pure-menu package-menu">
<ul class="pure-menu-list">
<li class="pure-menu-heading">Feature flags</li>
{%- if let Some(features) = sorted_features -%}
{%- if features.is_empty() -%}
<li class="pure-menu-item">
<span class="documented-info">This release does not have any feature flags.</span>
</li>
{%- else %}
{%- for feature in features -%}
<li class="pure-menu-item">
<a href="#{{ feature.name }}" class="pure-menu-link text-center">
{{- feature.name -}}
</a>
</li>
{%- endfor %}
{%- endif -%}
{%- else %}
<li class="pure-menu-item">
<span class="documented-info">
Feature flags are not available for this release because the build failed before we could retrieve them,
or it was built before features were collected by docs.rs.
</span>
</li>
{%- endif -%}
</ul>
</div>
</div>
<div class="pure-u-1 pure-u-sm-17-24 pure-u-md-19-24 package-details" id="main">
<h1>{{ metadata.name }}</h1>
<div class="info">
There is very little structured metadata to build this page
from currently. You should check the
<a href="/{{ metadata.name }}/{{ metadata.req_version }}/{{ metadata.target_name.as_deref().unwrap_or_default() }}/">main library docs</a>,
<a href="/crate/{{ metadata.name }}/{{ metadata.req_version }}/">readme</a>, or
<a href="/crate/{{ metadata.name }}/{{ metadata.req_version }}/source/Cargo.toml.orig">Cargo.toml</a>
in case the author documented the features in them.
</div>
{%- if let Some(features) = sorted_features -%}
{%- if features.is_empty() -%}
<p data-id="empty-features">This release does not have any feature flags.</p>
{%- else -%}
<p>This version has <b>{{ features.len() }}</b> feature flags, <b data-id="default-feature-len">{{ default_features.len() }}</b> of them enabled by <b>default</b>.</p>
{%- for feature in features -%}
{%- let is_default = feature.name != "default" && is_default_feature(feature.name) -%}
<h3 id="{{ feature.name }}">{{ feature.name }}{%- if is_default %} (default){%- endif -%}</h3>
{%- if !feature.subfeatures.is_empty() -%}
<ul class="pure-menu-list">
{%- for (name, feature) in feature.subfeatures -%}
{%- let is_default = is_default_feature(name) -%}
<li class="pure-menu-item">
{%- match feature -%}
{%- when SubFeature::Feature with (feature) -%}
<a href="#{{ feature }}">
{{- feature -}}
</a>
{% when SubFeature::Dependency with (dependency) %}
{%- let version = dependency_version(dependency) -%}
dep:<a href="/crate/{{ dependency }}/{{ version }}">
{{- dependency -}}
</a>
{% when SubFeature::DependencyFeature with {dependency, feature, optional} %}
{%- let version = dependency_version(dependency) -%}
<a href="/crate/{{ dependency }}/{{ version }}">
{{- dependency -}}
</a>
{%- if optional -%}?{%- endif -%}
/<a href="/crate/{{ dependency }}/{{ version }}/features#{{ feature }}">
{{- feature -}}
</a>
{% endmatch %}
{%- if is_default %} <span class="is-default-feature">(default)</span>{%- endif -%}
</li>
{%- endfor -%}
</ul>
{%- else -%}
<p>This feature flag does not enable additional features.</p>
{%- endif -%}
{%- endfor -%}
{% endif -%}
{% else -%}
<p data-id="null-features">Feature flags are not available for this release because it was built before features were collected by docs.rs.</p>
{%- endif -%}
</div>
</div>
</div>
{%- endblock body -%}