1 /* See FiraSans-LICENSE.txt for the Fira Sans license. */
3 font-family: 'Fira Sans';
6 src: local('Fira Sans'),
7 url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");
11 font-family: 'Fira Sans';
14 src: local('Fira Sans Medium'),
15 url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");
19 /* See SourceSerif4-LICENSE.md for the Source Serif 4 license. */
21 font-family: 'Source Serif 4';
24 src: local('Source Serif 4'),
25 url("SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2") format("woff2");
29 font-family: 'Source Serif 4';
32 src: local('Source Serif 4 Italic'),
33 url("SourceSerif4-It-d034fe4ef9d0fa00.ttf.woff2") format("woff2");
37 font-family: 'Source Serif 4';
40 src: local('Source Serif 4 Bold'),
41 url("SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2") format("woff2");
45 /* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */
47 font-family: 'Source Code Pro';
50 /* Avoid using locally installed font because bad versions are in circulation:
51 * see https://github.com/rust-lang/rust/issues/24355 */
52 src: url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");
56 font-family: 'Source Code Pro';
59 src: url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");
63 font-family: 'Source Code Pro';
66 src: url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");
70 /* Avoid using legacy CJK serif fonts in Windows like Batang. */
72 font-family: 'NanumBarunGothic';
73 src: url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");
75 unicode-range: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
79 -webkit-box-sizing: border-box;
80 -moz-box-sizing: border-box;
81 box-sizing: border-box;
84 /* This part handles the "default" theme being used depending on the system one. */
88 @media (prefers-color-scheme: light) {
93 @media (prefers-color-scheme: dark) {
99 /* General structure and fonts */
102 /* Line spacing at least 1.5 per Web Content Accessibility Guidelines
103 https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
104 font: 1rem/1.5 "Source Serif 4", NanumBarunGothic, serif;
107 /* We use overflow-wrap: break-word for Safari, which doesn't recognize
108 `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
109 overflow-wrap: break-word;
110 /* Then override it with `anywhere`, which is required to make non-Safari browsers break
111 more aggressively when we want them to. */
112 overflow-wrap: anywhere;
114 -webkit-font-feature-settings: "kern", "liga";
115 -moz-font-feature-settings: "kern", "liga";
116 font-feature-settings: "kern", "liga";
118 background-color: var(--main-background-color);
119 color: var(--main-color);
123 font-size: 1.5rem; /* 24px */
126 font-size: 1.375rem; /* 22px */
129 font-size: 1.25rem; /* 20px */
131 h1, h2, h3, h4, h5, h6 {
135 margin: 25px 0 15px 0;
138 .docblock h3, .docblock h4, h5, h6 {
139 margin: 15px 0 5px 0;
141 .docblock > h2:first-child,
142 .docblock > h3:first-child,
143 .docblock > h4:first-child,
144 .docblock > h5:first-child,
145 .docblock > h6:first-child {
152 /* We use overflow-wrap: break-word for Safari, which doesn't recognize
153 `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
154 overflow-wrap: break-word;
155 /* Then override it with `anywhere`, which is required to make non-Safari browsers break
156 more aggressively when we want them to. */
157 overflow-wrap: anywhere;
165 /* The only headings that get underlines are:
166 Markdown-generated headings within the top-doc
167 Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
168 Underlines elsewhere in the documentation break up visual flow and tend to invert
169 section hierarchies. */
171 .top-doc .docblock > h3,
172 .top-doc .docblock > h4 {
173 border-bottom: 1px solid var(--headings-border-bottom-color);
176 font-size: 1.125rem; /* 18px */
188 h1, h2, h3, h4, h5, h6,
192 .search-results .result-name,
199 .scraped-example-list,
200 /* This selector is for the items listed in the "all items" page. */
202 font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
207 .small-section-header a,
216 .result-name .primitive > i, .result-name .keyword > i {
217 color: var(--main-color);
220 .content span.enum, .content a.enum,
221 .content span.struct, .content a.struct,
222 .content span.union, .content a.union,
223 .content span.primitive, .content a.primitive,
224 .content span.type, .content a.type,
225 .content span.foreigntype, .content a.foreigntype {
226 color: var(--type-link-color);
229 .content span.trait, .content a.trait,
230 .content span.traitalias, .content a.traitalias {
231 color: var(--trait-link-color);
234 .content span.associatedtype, .content a.associatedtype,
235 .content span.constant, .content a.constant,
236 .content span.static, .content a.static {
237 color: var(--assoc-item-link-color);
240 .content span.fn, .content a.fn,
241 .content span.method, .content a.method,
242 .content span.tymethod, .content a.tymethod {
243 color: var(--function-link-color);
246 .content span.attr, .content a.attr,
247 .content span.derive, .content a.derive,
248 .content span.macro, .content a.macro {
249 color: var(--macro-link-color);
252 .content span.mod, .content a.mod {
253 color: var(--mod-link-color);
256 .content span.keyword, .content a.keyword {
257 color: var(--keyword-link-color);
261 color: var(--link-color);
267 ul ul, ol ul, ul ol, ol ol {
268 margin-bottom: .625em;
272 /* Paragraph spacing at least 1.5 times line spacing per Web Content Accessibility Guidelines.
273 Line-height is 1.5rem, so line spacing is .5rem; .75em is 1.5 times that.
274 https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
277 /* For the last child of a div, the margin will be taken care of
278 by the margin-top of the next item. */
283 /* Fix some style changes due to normalize.css 8 */
286 /* Buttons on Safari have different default padding than other platforms. Make them the same. */
288 /* Opinionated tweak: use pointer cursor as clickability signifier. */
292 /* end tweaks for normalize.css 8 */
294 button#toggle-all-docs {
298 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
299 -webkit-appearance: none;
312 padding: 10px 15px 40px 45px;
313 min-width: 0; /* avoid growing beyond the size limit */
325 details:not(.rustdoc-toggle) summary {
329 code, pre, a.test-arrow, .code-header {
330 font-family: "Source Code Pro", monospace;
332 .docblock code, .docblock-short code {
336 .docblock pre code, .docblock-short pre code {
341 line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
347 .source .content pre {
350 .rustdoc.source .example-wrap > pre.src-line-numbers {
351 padding: 20px 0 20px 4px;
358 .sub-logo-container, .logo-container {
359 /* zero text boxes so that computed line height = image height exactly */
363 .sub-logo-container {
367 .sub-logo-container > img {
374 filter: var(--rust-logo-filter);
387 .rustdoc.source .sidebar {
389 border-right: 1px solid;
391 /* The sidebar is by default hidden */
395 .sidebar, .mobile-topbar, .sidebar-menu-toggle,
396 #src-sidebar-toggle, #source-sidebar {
397 background-color: var(--sidebar-background-color);
400 #src-sidebar-toggle > button:hover, #src-sidebar-toggle > button:focus {
401 background-color: var(--sidebar-background-color-hover);
404 .source .sidebar > *:not(#src-sidebar-toggle) {
408 .source-sidebar-expanded .source .sidebar {
413 .source-sidebar-expanded .source .sidebar > *:not(#src-sidebar-toggle) {
421 /* Improve the scrollbar display on firefox */
423 scrollbar-width: initial;
424 scrollbar-color: var(--scrollbar-color);
427 scrollbar-width: thin;
428 scrollbar-color: var(--scrollbar-color);
431 /* Improve the scrollbar display on webkit-based browsers */
432 ::-webkit-scrollbar {
435 .sidebar::-webkit-scrollbar {
438 ::-webkit-scrollbar-track {
439 -webkit-box-shadow: inset 0;
440 background-color: var(--scrollbar-track-background-color);
442 .sidebar::-webkit-scrollbar-track {
443 background-color: var(--scrollbar-track-background-color);
445 ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
446 background-color: var(--scrollbar-thumb-background-color);
449 /* Everything else */
452 display: none !important;
455 .sidebar .logo-container {
462 overflow-wrap: break-word;
465 .logo-container > img {
470 ul.block, .block li {
479 padding: 0.25rem; /* 4px */
480 margin-left: -0.25rem;
484 overflow-wrap: anywhere;
490 font-size: 1.125rem; /* 18px */
500 .sidebar a, .sidebar .current {
501 color: var(--sidebar-link-color);
505 background-color: var(--sidebar-current-link-background-color);
508 .sidebar-elems .block {
512 .sidebar-elems .block li a {
514 text-overflow: ellipsis;
522 .rustdoc .example-wrap {
527 /* For the last child of a div, the margin will be taken care of
528 by the margin-top of the next item. */
529 .rustdoc .example-wrap:last-child {
533 .rustdoc .example-wrap > pre {
539 .rustdoc .example-wrap > pre.example-line-numbers,
540 .rustdoc .example-wrap > pre.src-line-numbers {
542 min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */
545 -webkit-user-select: none;
546 -moz-user-select: none;
547 -ms-user-select: none;
550 color: var(--src-line-numbers-span-color);
553 .rustdoc .example-wrap > pre.src-line-numbers {
556 .src-line-numbers a, .src-line-numbers span {
557 color: var(--src-line-numbers-span-color);
560 .src-line-numbers :target {
561 background-color: transparent;
565 .src-line-numbers .line-highlighted {
566 background-color: var(--src-line-number-highlighted-background-color);
574 overflow-wrap: break-word;
575 overflow-wrap: anywhere;
577 /* Wrap non-pre code blocks (`text`) but not (```text```). */
578 .docblock :not(pre) > code,
579 .docblock-short code {
580 white-space: pre-wrap;
583 .top-doc .docblock h2 { font-size: 1.375rem; }
584 .top-doc .docblock h3 { font-size: 1.25rem; }
585 .top-doc .docblock h4,
586 .top-doc .docblock h5 {
589 .top-doc .docblock h6 {
593 .docblock h5 { font-size: 1rem; }
594 .docblock h6 { font-size: 0.875rem; }
601 .docblock > :not(.more-examples-toggle):not(.example-wrap) {
611 .docblock code, .docblock-short code,
612 pre, .rustdoc.source .example-wrap {
613 background-color: var(--code-block-background-color);
622 border-collapse: collapse;
625 .docblock table td, .docblock table th {
627 border: 1px solid var(--border-color);
630 .docblock table tbody tr:nth-child(2n) {
631 background: var(--table-alt-row-background-color);
634 /* Shift "where ..." part of method or fn definition down a line */
651 #main-content > .item-info {
657 flex-flow: row nowrap;
658 margin: 4px 0 25px 0;
673 text-decoration: none;
676 .small-section-header {
677 /* fields use <span> tags, but should get their own lines */
682 .small-section-header:hover > .anchor, .impl:hover > .anchor,
683 .trait-impl:hover > .anchor, .variant:hover > .anchor {
690 background: none !important;
695 .small-section-header > .anchor {
699 h2.small-section-header > .anchor {
703 .main-heading a:hover,
704 .example-wrap > pre.rust a:hover,
706 .docblock a:not(.test-arrow):not(.scrape-help):hover,
707 .docblock-short a:not(.test-arrow):not(.scrape-help):hover,
709 text-decoration: underline;
712 .crate.block a.current { font-weight: 500; }
714 /* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap
715 as much as needed on mobile (see
716 src/test/rustdoc-gui/type-declaration-overflow.goml for an example of why
717 this matters). The `anywhere` value means:
719 "Soft wrap opportunities introduced by the word break are considered when
720 calculating min-content intrinsic sizes."
722 https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#values
724 For table layouts, that becomes a problem: the browser tries to make each
725 column as narrow as possible, and `overflow-wrap: anywhere` means it can do
726 so by breaking words - even if some other column could be shrunk without
727 breaking words! This shows up, for instance, in the `Structs` / `Modules` /
728 `Functions` (etcetera) sections of a module page, and when a docblock
731 So, for table layouts, override the default with break-word, which does
732 _not_ affect min-content intrinsic sizes.
736 overflow-wrap: break-word;
745 .item-left, .item-right {
749 padding-right: 1.25rem;
752 .search-results-title {
755 /* flex layout allows shrinking the <select> appropriately if it becomes too large */
757 /* make things look like in a line, despite the fact that we're using a layout
758 with boxes (i.e. from the flex layout) */
759 align-items: baseline;
762 /* ensures that 100% in properties of #crate-search-div:after
763 are relative to the size of this div */
765 /* allows this div (and with it the <select>-element "#crate-search") to be shrunk */
770 /* keep these two in sync with "@-moz-document url-prefix()" below */
771 padding: 0 23px 0 4px;
772 /* prevents the <select> from overflowing the containing div in case it's shrunk */
774 /* contents can overflow because of max-width limit, then show ellipsis */
775 text-overflow: ellipsis;
776 border: 1px solid var(--border-color);
780 -moz-appearance: none;
781 -webkit-appearance: none;
782 /* Removes default arrow from firefox */
784 background-color: var(--main-background-color);
789 #crate-search:hover, #crate-search:focus {
790 border-color: var(--crate-search-hover-border);
792 /* cancel stylistic differences in padding in firefox
793 for "appearance: none"-style (or equivalent) <select>s */
794 @-moz-document url-prefix() {
796 padding-left: 0px; /* == 4px - 4px */
797 padding-right: 19px; /* == 23px - 4px */
800 /* pseudo-element for holding the dropdown-arrow image; needs to be a separate thing
801 so that we can apply CSS-filters to change the arrow color in themes */
802 #crate-search-div::after {
803 /* lets clicks through! */
804 pointer-events: none;
805 /* completely covers the underlying div */
812 background-repeat: no-repeat;
813 background-size: 20px;
814 background-position: calc(100% - 2px) 56%;
815 /* image is black color */
816 background-image: url("down-arrow-927217e04c7463ac.svg");
817 /* changes the arrow image color */
818 filter: var(--crate-search-div-filter);
820 #crate-search-div:hover::after, #crate-search-div:focus-within::after {
821 filter: var(--crate-search-div-hover-filter);
823 #crate-search > option {
827 /* Override Normalize.css: it has a rule that sets
828 -webkit-appearance: textfield for search inputs. That
829 causes rounded corners and no border on iOS Safari. */
830 -webkit-appearance: none;
832 border: 1px solid var(--border-color);
837 background-color: var(--button-background-color);
838 color: var(--search-color);
840 .search-input:focus {
841 border-color: var(--search-input-focused-border-color);
848 .search-results.active {
852 .search-results > a {
854 /* A little margin ensures the browser's outlining of focused links has room to display. */
857 border-bottom: 1px solid var(--search-result-border-color);
861 .search-results > a > div {
865 .search-results > a > div.desc {
867 text-overflow: ellipsis;
871 .search-results a:hover,
872 .search-results a:focus {
873 background-color: var(--search-result-link-focus-background-color);
876 .search-results .result-name span.alias {
877 color: var(--search-results-alias-color);
879 .search-results .result-name span.grey {
880 color: var(--search-results-grey-color);
890 border: 1px solid var(--border-color);
891 background-color: var(--main-background-color);
892 color: var(--main-color);
893 --popover-arrow-offset: 11px;
896 /* This rule is to draw the little arrow connecting the settings menu to the gear icon. */
900 right: var(--popover-arrow-offset);
901 border: solid var(--border-color);
902 border-width: 1px 1px 0 0;
903 background-color: var(--main-background-color);
905 transform: rotate(-45deg);
909 /* use larger max-width for help popover, but not for help.html */
912 --popover-arrow-offset: 48px;
918 margin-right: 0.5rem;
920 #help span.top, #help span.bottom {
927 border-bottom: 1px solid var(--border-color);
933 border-top: 1px solid var(--border-color);
935 .side-by-side > div {
938 padding: 0 20px 20px 17px;
942 /* This min-height is needed to unify the height of the stab elements because some of them
951 margin-left: 0.3125em;
957 color: var(--main-color);
958 background-color: var(--stab-background-color);
961 white-space: pre-wrap;
963 display: inline-flex;
964 vertical-align: text-bottom;
967 .stab.portability > code {
969 color: var(--stab-code-color);
974 margin-right: 0.3rem;
977 /* Black one-pixel outline around emoji shapes */
986 .module-item.unstable,
987 .import-item.unstable {
1003 color: var(--right-side-color);
1011 /* Code highlighting */
1013 color: var(--code-highlight-kw-color);
1016 color: var(--code-highlight-kw-2-color);
1018 pre.rust .lifetime {
1019 color: var(--code-highlight-lifetime-color);
1021 pre.rust .prelude-ty {
1022 color: var(--code-highlight-prelude-color);
1024 pre.rust .prelude-val {
1025 color: var(--code-highlight-prelude-val-color);
1028 color: var(--code-highlight-string-color);
1031 color: var(--code-highlight-number-color);
1033 pre.rust .bool-val {
1034 color: var(--code-highlight-literal-color);
1037 color: var(--code-highlight-self-color);
1040 color: var(--code-highlight-attribute-color);
1043 pre.rust .macro-nonterminal {
1044 color: var(--code-highlight-macro-color);
1046 pre.rust .question-mark {
1048 color: var(--code-highlight-question-mark-color);
1051 color: var(--code-highlight-comment-color);
1053 pre.rust .doccomment {
1054 color: var(--code-highlight-doc-comment-color);
1057 .rustdoc.source .example-wrap pre.rust a {
1058 background: var(--codeblock-link-background);
1061 .example-wrap.compile_fail,
1062 .example-wrap.should_panic {
1063 border-left: 2px solid var(--codeblock-error-color);
1066 .ignore.example-wrap {
1067 border-left: 2px solid var(--codeblock-ignore-color);
1070 .example-wrap.compile_fail:hover,
1071 .example-wrap.should_panic:hover {
1072 border-left: 2px solid var(--codeblock-error-hover-color);
1075 .example-wrap.ignore:hover {
1076 border-left: 2px solid var(--codeblock-ignore-hover-color);
1079 .example-wrap.compile_fail .tooltip,
1080 .example-wrap.should_panic .tooltip {
1081 color: var(--codeblock-error-color);
1084 .example-wrap.ignore .tooltip {
1085 color: var(--codeblock-ignore-color);
1088 .example-wrap.compile_fail:hover .tooltip,
1089 .example-wrap.should_panic:hover .tooltip {
1090 color: var(--codeblock-error-hover-color);
1093 .example-wrap.ignore:hover .tooltip {
1094 color: var(--codeblock-ignore-hover-color);
1097 .example-wrap .tooltip {
1104 .example-wrap .tooltip:hover::after {
1105 padding: 5px 3px 3px 3px;
1109 border: 1px solid var(--border-color);
1114 background-color: var(--tooltip-background-color);
1115 color: var(--tooltip-color);
1118 .example-wrap .tooltip:hover::before {
1125 border: 5px solid transparent;
1126 border-right-color: var(--tooltip-background-color);
1129 .example-wrap.ignore .tooltip:hover::after {
1130 content: "This example is not tested";
1132 .example-wrap.compile_fail .tooltip:hover::after {
1133 content: "This example deliberately fails to compile";
1135 .example-wrap.should_panic .tooltip:hover::after {
1136 content: "This example panics";
1138 .example-wrap.edition .tooltip:hover::after {
1139 content: "This code runs with edition " attr(data-edition);
1142 .example-wrap.compile_fail .tooltip,
1143 .example-wrap.should_panic .tooltip,
1144 .example-wrap.ignore .tooltip {
1152 padding: 5px 10px 5px 10px;
1154 font-size: 1.375rem;
1158 color: var(--test-arrow-color);
1159 background-color: var(--test-arrow-background-color);
1161 a.test-arrow:hover {
1162 color: var(--test-arrow-hover-color);
1163 background-color: var(--test-arrow-hover-background-color);
1165 .example-wrap:hover .test-arrow {
1166 visibility: visible;
1171 color: var(--code-attribute-color);
1179 .out-of-band > span.since {
1192 margin-bottom: 40px;
1195 .sub-variant > .sub-variant-field {
1201 background-color: var(--target-background-color);
1202 border-right: 3px solid var(--target-border-color);
1211 /* placeholder thunk so that the mouse can easily travel from "(i)" to popover
1212 the resulting "hover tunnel" is a stepped triangle, approximating
1213 https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown */
1214 .notable-traits:hover::after {
1216 top: calc(100% - 10px);
1223 .notable .docblock {
1224 margin: 0.25em 0.5em;
1227 .notable .docblock pre, .notable .docblock code {
1228 background: transparent;
1232 white-space: pre-wrap;
1241 .search-failed.active {
1245 .search-failed > ul {
1254 flex-direction: row;
1259 #search-tabs button {
1261 font-size: 1.125rem;
1263 border-top: 2px solid;
1269 #search-tabs .count {
1271 color: var(--search-tab-title-count-color);
1274 #src-sidebar-toggle {
1279 border-bottom: 1px solid;
1282 justify-content: stretch;
1283 align-items: stretch;
1290 #source-sidebar > .title {
1293 border-bottom: 1px solid var(--border-color);
1296 #source-sidebar div.files > a:hover, details.dir-entry summary:hover,
1297 #source-sidebar div.files > a:focus, details.dir-entry summary:focus {
1298 background-color: var(--source-sidebar-background-hover);
1300 #source-sidebar div.files > a.selected {
1301 background-color: var(--source-sidebar-background-selected);
1303 #src-sidebar-toggle > button {
1312 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1313 -webkit-appearance: none;
1317 #settings-menu, #help-button {
1321 #settings-menu > a, #help-button > a {
1323 align-items: center;
1324 justify-content: center;
1325 background-color: var(--button-background-color);
1326 border: 1px solid var(--border-color);
1328 color: var(--settings-button-color);
1329 /* Rare exception to specifying font sizes in rem. Since this is acting
1330 as an icon, it's okay to specify their sizes in pixels. */
1335 #settings-menu > a:hover, #settings-menu > a:focus,
1336 #help-button > a:hover, #help-button > a:focus {
1337 border-color: var(--settings-button-border-focus);
1341 color: var(--copy-path-button-color);
1342 background: var(--main-background-color);
1351 filter: var(--copy-path-img-filter);
1353 #copy-path:hover > img {
1354 filter: var(--copy-path-img-hover-filter);
1357 @keyframes rotating {
1359 transform: rotate(0deg);
1362 transform: rotate(360deg);
1365 #settings-menu.rotate > a img {
1366 animation: rotating 2s linear infinite;
1370 display: inline-block;
1372 font: 15px monospace;
1374 vertical-align: middle;
1375 border: solid 1px var(--border-color);
1377 color: var(--kbd--color);
1378 background-color: var(--kbd-background);
1379 box-shadow: inset 0 -1px 0 var(--kbd-box-shadow-color);
1390 details.dir-entry > summary {
1396 details.dir-entry div.folders, details.dir-entry div.files {
1400 details.dir-entry a {
1404 /* We use CSS containment on the details elements because most sizeable elements
1405 of the page are contained in one of these. This also makes re-rendering
1406 faster on document changes (like closing and opening toggles).
1407 Unfortunately we can't yet specify contain: content or contain: strict
1408 because the [-]/[+] toggles extend past the boundaries of the <details>
1409 https://developer.mozilla.org/en-US/docs/Web/CSS/contain */
1410 details.rustdoc-toggle {
1415 /* The hideme class is used on summary tags that contain a span with
1416 placeholder text shown only when the toggle is closed. For instance,
1417 "Expand description" or "Show methods". */
1418 details.rustdoc-toggle > summary.hideme {
1423 details.rustdoc-toggle > summary {
1425 /* focus outline is shown on `::before` instead of this */
1428 details.rustdoc-toggle > summary::-webkit-details-marker,
1429 details.rustdoc-toggle > summary::marker {
1433 details.rustdoc-toggle > summary.hideme > span {
1437 details.rustdoc-toggle > summary::before {
1438 background: url("toggle-plus-1092eb4930d581b0.svg") no-repeat top left;
1443 display: inline-block;
1444 vertical-align: middle;
1446 filter: var(--toggle-filter);
1449 details.rustdoc-toggle > summary.hideme > span,
1450 .more-examples-toggle summary, .more-examples-toggle .hide-more {
1451 color: var(--toggles-color);
1454 /* Screen readers see the text version at the end the line.
1455 Visual readers see the icon at the start of the line, but small and transparent. */
1456 details.rustdoc-toggle > summary::after {
1464 details.rustdoc-toggle > summary.hideme::after {
1465 /* "hideme" toggles already have a description when they're contracted */
1469 details.rustdoc-toggle > summary:focus::before,
1470 details.rustdoc-toggle > summary:hover::before {
1474 details.rustdoc-toggle > summary:focus-visible::before {
1475 /* The SVG is black, and gets turned white using a filter in the dark themes.
1476 Do the same with the outline.
1477 The dotted 1px style is copied from Firefox's focus ring style.
1479 outline: 1px dotted #000;
1480 outline-offset: 1px;
1483 details.non-exhaustive {
1487 details.rustdoc-toggle > summary.hideme::before {
1491 details.rustdoc-toggle > summary:not(.hideme)::before {
1497 .impl-items > details.rustdoc-toggle > summary:not(.hideme)::before {
1502 /* When a "hideme" summary is open and the "Expand description" or "Show
1503 methods" text is hidden, we want the [-] toggle that remains to not
1504 affect the layout of the items to its right. To do that, we use
1505 absolute positioning. Note that we also set position: relative
1506 on the parent <details> to make this work properly. */
1507 details.rustdoc-toggle[open] > summary.hideme {
1511 details.rustdoc-toggle[open] > summary.hideme > span {
1515 details.rustdoc-toggle[open] > summary::before {
1516 background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left;
1519 details.rustdoc-toggle[open] > summary::after {
1520 content: "Collapse";
1523 /* This is needed in docblocks to have the "â–¶" element to be on the same line. */
1524 .docblock summary > * {
1525 display: inline-block;
1528 /* In case there is no documentation before a code block, we need to add some margin at the top
1529 to prevent an overlay between the "collapse toggle" and the information tooltip.
1530 However, it's not needed with smaller screen width because the doc/code block is always put
1531 "one line" below. */
1532 .docblock > .example-wrap:first-child .tooltip {
1539 WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
1540 If you update this line, then you also need to update the line with the same warning
1543 @media (max-width: 700px) {
1544 /* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
1545 or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
1546 by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
1549 scroll-margin-top: 45px;
1553 /* Sidebar should overlay main content, rather than pushing main content to the right.
1554 Turn off `display: flex` on the body element. */
1564 flex-direction: column;
1569 margin-left: initial;
1573 .out-of-band .since::before {
1577 /* Hide the logo and item name from the sidebar. Those are displayed
1578 in the mobile-topbar instead. */
1579 .sidebar .sidebar-logo,
1580 .sidebar .location {
1587 /* Hide the sidebar offscreen while not in use. Doing this instead of display: none means
1588 the sidebar stays visible for screen readers, which is useful for navigation. */
1591 /* Reduce height slightly to account for mobile topbar. */
1592 height: calc(100vh - 45px);
1596 /* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
1597 so don't bump down the main content or the sidebar. */
1599 .rustdoc.source .sidebar {
1607 .source-sidebar-expanded .source .sidebar,
1608 .sidebar:focus-within {
1612 .rustdoc.source > .sidebar {
1618 margin: auto 0.5em auto auto;
1620 /* Rare exception to specifying font sizes in rem. Since the topbar
1621 height is specified in pixels, this also has to be specified in
1622 pixels to avoid overflowing the topbar when the user sets a bigger
1627 .mobile-topbar h2 a {
1629 text-overflow: ellipsis;
1631 white-space: nowrap;
1634 .mobile-topbar .logo-container > img {
1637 margin: 5px 0 5px 20px;
1642 flex-direction: row;
1652 .sidebar-menu-toggle {
1654 /* Rare exception to specifying font sizes in rem. Since this is acting
1655 as an icon, it's okay to specify its sizes in pixels. */
1658 color: var(--main-color);
1670 display: none !important;
1673 #search-tabs .count {
1677 #main-content > details.rustdoc-toggle > summary::before,
1678 #main-content > div > details.rustdoc-toggle > summary::before {
1682 #src-sidebar-toggle {
1690 border-top-right-radius: 3px;
1691 border-bottom-right-radius: 3px;
1696 .source-sidebar-expanded #src-sidebar-toggle {
1700 border-top-right-radius: unset;
1701 border-bottom-right-radius: unset;
1704 border-bottom: 1px solid;
1707 /* We don't display these buttons on mobile devices. */
1708 #copy-path, #help-button {
1712 /* Display an alternating layout on tablets and phones */
1713 .item-table, .item-row, .item-left, .item-right,
1714 .search-results > a, .search-results > a > div {
1718 /* Display an alternating layout on tablets and phones */
1719 .search-results > a {
1722 .search-results > a > div.desc, .item-right {
1726 .source-sidebar-expanded .source .sidebar {
1731 /* Position of the "[-]" element. */
1732 details.rustdoc-toggle:not(.top-doc) > summary {
1735 .impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
1736 #main-content > details.rustdoc-toggle:not(.top-doc) > summary::before,
1737 #main-content > div > details.rustdoc-toggle > summary::before {
1741 /* Align summary-nested and unnested item-info gizmos. */
1742 .impl-items > .item-info {
1752 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
1753 @media (min-width: 701px) {
1754 /* Places file-link for a scraped example on top of the example to save space.
1755 We only do this on large screens so the file-link doesn't overlap too much
1756 with the example's content. */
1757 .scraped-example-title {
1760 background: var(--main-background-color);
1764 box-shadow: 0 0 4px var(--main-background-color);
1769 nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path,
1770 details.rustdoc-toggle[open] > summary::before, details.rustdoc-toggle > summary::before,
1771 details.rustdoc-toggle.top-doc > summary {
1784 @media (max-width: 464px) {
1790 overflow-wrap: break-word;
1791 overflow-wrap: anywhere;
1795 flex-direction: column;
1799 align-self: stretch;
1802 .sub-logo-container > img {
1809 .implementors-toggle > summary,
1811 #implementors-list > .docblock,
1812 .impl-items > section,
1813 .impl-items > .rustdoc-toggle > summary,
1815 .methods > .rustdoc-toggle > summary
1817 margin-bottom: 0.75em;
1820 .variants > .docblock,
1821 .implementors-toggle > .docblock,
1822 .impl-items > .rustdoc-toggle[open]:not(:last-child),
1823 .methods > .rustdoc-toggle[open]:not(:last-child),
1824 .implementors-toggle[open]:not(:last-child) {
1828 #trait-implementations-list .impl-items > .rustdoc-toggle:not(:last-child),
1829 #synthetic-implementations-list .impl-items > .rustdoc-toggle:not(:last-child),
1830 #blanket-implementations-list .impl-items > .rustdoc-toggle:not(:last-child) {
1834 /* Begin: styles for --scrape-examples feature */
1836 .scraped-example-list .scrape-help {
1839 font-weight: normal;
1843 border: 1px solid var(--scrape-example-help-border-color);
1844 border-radius: 50px;
1845 color: var(--scrape-example-help-color);
1847 .scraped-example-list .scrape-help:hover {
1848 border-color: var(--scrape-example-help-hover-border-color);
1849 color: var(--scrape-example-help-hover-color);
1853 /* So .scraped-example-title can be positioned absolutely */
1857 .scraped-example .code-wrapper {
1860 flex-direction: row;
1865 .scraped-example:not(.expanded) .code-wrapper {
1866 /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
1867 * of lines shown in the un-expanded example code viewer. This pre needs to have
1868 * a max-height equal to line-height * N. The line-height is currently 1.5em,
1869 * and we include additional 10px for padding. */
1870 max-height: calc(1.5em * 5 + 10px);
1873 .scraped-example:not(.expanded) .code-wrapper pre {
1876 /* See above comment, should be the same max-height. */
1877 max-height: calc(1.5em * 5 + 10px);
1880 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,
1881 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre {
1882 /* See above comment, except this height is based on HIDDEN_MAX_LINES. */
1883 max-height: calc(1.5em * 10 + 10px);
1886 .scraped-example .code-wrapper .next,
1887 .scraped-example .code-wrapper .prev,
1888 .scraped-example .code-wrapper .expand {
1889 color: var(--main-color);
1896 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1897 -webkit-appearance: none;
1900 .scraped-example .code-wrapper .prev {
1903 .scraped-example .code-wrapper .next {
1906 .scraped-example .code-wrapper .expand {
1910 .scraped-example:not(.expanded) .code-wrapper:before,
1911 .scraped-example:not(.expanded) .code-wrapper:after {
1918 .scraped-example:not(.expanded) .code-wrapper:before {
1921 .scraped-example:not(.expanded) .code-wrapper:after {
1925 .scraped-example .code-wrapper .example-wrap {
1931 .scraped-example:not(.expanded) .code-wrapper .example-wrap {
1935 .scraped-example .example-wrap .rust span.highlight {
1936 background: var(--scrape-example-code-line-highlight);
1938 .scraped-example .example-wrap .rust span.highlight.focus {
1939 background: var(--scrape-example-code-line-highlight-focus);
1942 .more-examples-toggle {
1943 max-width: calc(100% + 25px);
1948 .more-examples-toggle .hide-more {
1953 .more-scraped-examples {
1962 right: calc(100% + 10px);
1967 .toggle-line-inner {
1970 background: var(--scrape-example-toggle-line-background);
1973 .toggle-line:hover .toggle-line-inner {
1974 background: var(--scrape-example-toggle-line-hover-background);
1977 .more-scraped-examples .scraped-example, .example-links {
1981 .more-scraped-examples .scraped-example:first-child {
1989 /* End: styles for --scrape-examples feature */