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 box-sizing: border-box;
82 /* This part handles the "default" theme being used depending on the system one. */
86 @media (prefers-color-scheme: light) {
91 @media (prefers-color-scheme: dark) {
97 /* General structure and fonts */
100 /* Line spacing at least 1.5 per Web Content Accessibility Guidelines
101 https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
102 font: 1rem/1.5 "Source Serif 4", NanumBarunGothic, serif;
105 /* We use overflow-wrap: break-word for Safari, which doesn't recognize
106 `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
107 overflow-wrap: break-word;
108 /* Then override it with `anywhere`, which is required to make non-Safari browsers break
109 more aggressively when we want them to. */
110 overflow-wrap: anywhere;
112 -webkit-font-feature-settings: "kern", "liga";
113 -moz-font-feature-settings: "kern", "liga";
114 font-feature-settings: "kern", "liga";
116 background-color: var(--main-background-color);
117 color: var(--main-color);
121 font-size: 1.5rem; /* 24px */
124 font-size: 1.375rem; /* 22px */
127 font-size: 1.25rem; /* 20px */
129 h1, h2, h3, h4, h5, h6 {
133 margin: 25px 0 15px 0;
136 .docblock h3, .docblock h4, h5, h6 {
137 margin: 15px 0 5px 0;
139 .docblock > h2:first-child,
140 .docblock > h3:first-child,
141 .docblock > h4:first-child,
142 .docblock > h5:first-child,
143 .docblock > h6:first-child {
150 /* We use overflow-wrap: break-word for Safari, which doesn't recognize
151 `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
152 overflow-wrap: break-word;
153 /* Then override it with `anywhere`, which is required to make non-Safari browsers break
154 more aggressively when we want them to. */
155 overflow-wrap: anywhere;
163 /* The only headings that get underlines are:
164 Markdown-generated headings within the top-doc
165 Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
166 Underlines elsewhere in the documentation break up visual flow and tend to invert
167 section hierarchies. */
169 .top-doc .docblock > h3,
170 .top-doc .docblock > h4 {
171 border-bottom: 1px solid var(--headings-border-bottom-color);
174 font-size: 1.125rem; /* 18px */
186 h1, h2, h3, h4, h5, h6,
190 .search-results .result-name,
197 .scraped-example-list,
198 /* This selector is for the items listed in the "all items" page. */
200 font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
205 .small-section-header a,
214 .result-name .primitive > i, .result-name .keyword > i {
215 color: var(--main-color);
218 .content span.enum, .content a.enum,
219 .content span.struct, .content a.struct,
220 .content span.union, .content a.union,
221 .content span.primitive, .content a.primitive,
222 .content span.type, .content a.type,
223 .content span.foreigntype, .content a.foreigntype {
224 color: var(--type-link-color);
227 .content span.trait, .content a.trait,
228 .content span.traitalias, .content a.traitalias {
229 color: var(--trait-link-color);
232 .content span.associatedtype, .content a.associatedtype,
233 .content span.constant, .content a.constant,
234 .content span.static, .content a.static {
235 color: var(--assoc-item-link-color);
238 .content span.fn, .content a.fn,
239 .content span.method, .content a.method,
240 .content span.tymethod, .content a.tymethod {
241 color: var(--function-link-color);
244 .content span.attr, .content a.attr,
245 .content span.derive, .content a.derive,
246 .content span.macro, .content a.macro {
247 color: var(--macro-link-color);
250 .content span.mod, .content a.mod {
251 color: var(--mod-link-color);
254 .content span.keyword, .content a.keyword {
255 color: var(--keyword-link-color);
259 color: var(--link-color);
265 ul ul, ol ul, ul ol, ol ol {
266 margin-bottom: .625em;
270 /* Paragraph spacing at least 1.5 times line spacing per Web Content Accessibility Guidelines.
271 Line-height is 1.5rem, so line spacing is .5rem; .75em is 1.5 times that.
272 https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
275 /* For the last child of a div, the margin will be taken care of
276 by the margin-top of the next item. */
281 /* Fix some style changes due to normalize.css 8 */
284 /* Buttons on Safari have different default padding than other platforms. Make them the same. */
286 /* Opinionated tweak: use pointer cursor as clickability signifier. */
290 /* end tweaks for normalize.css 8 */
292 button#toggle-all-docs {
296 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
297 -webkit-appearance: none;
310 padding: 10px 15px 40px 45px;
311 min-width: 0; /* avoid growing beyond the size limit */
323 details:not(.rustdoc-toggle) summary {
327 code, pre, a.test-arrow, .code-header {
328 font-family: "Source Code Pro", monospace;
330 .docblock code, .docblock-short code {
334 .docblock pre code, .docblock-short pre code {
339 line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
345 .source .content pre {
348 .rustdoc.source .example-wrap > pre.src-line-numbers {
349 padding: 20px 0 20px 4px;
356 .sub-logo-container, .logo-container {
357 /* zero text boxes so that computed line height = image height exactly */
361 .sub-logo-container {
365 .sub-logo-container > img {
372 filter: var(--rust-logo-filter);
385 .rustdoc.source .sidebar {
387 border-right: 1px solid;
389 /* The sidebar is by default hidden */
393 .sidebar, .mobile-topbar, .sidebar-menu-toggle,
394 #src-sidebar-toggle, #source-sidebar {
395 background-color: var(--sidebar-background-color);
398 #src-sidebar-toggle > button:hover, #src-sidebar-toggle > button:focus {
399 background-color: var(--sidebar-background-color-hover);
402 .source .sidebar > *:not(#src-sidebar-toggle) {
406 .source-sidebar-expanded .source .sidebar {
411 .source-sidebar-expanded .source .sidebar > *:not(#src-sidebar-toggle) {
419 /* Improve the scrollbar display on firefox */
421 scrollbar-width: initial;
422 scrollbar-color: var(--scrollbar-color);
425 scrollbar-width: thin;
426 scrollbar-color: var(--scrollbar-color);
429 /* Improve the scrollbar display on webkit-based browsers */
430 ::-webkit-scrollbar {
433 .sidebar::-webkit-scrollbar {
436 ::-webkit-scrollbar-track {
437 -webkit-box-shadow: inset 0;
438 background-color: var(--scrollbar-track-background-color);
440 .sidebar::-webkit-scrollbar-track {
441 background-color: var(--scrollbar-track-background-color);
443 ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
444 background-color: var(--scrollbar-thumb-background-color);
447 /* Everything else */
450 display: none !important;
453 .sidebar .logo-container {
460 overflow-wrap: break-word;
463 .logo-container > img {
468 ul.block, .block li {
477 padding: 0.25rem; /* 4px */
478 margin-left: -0.25rem;
482 overflow-wrap: anywhere;
488 font-size: 1.125rem; /* 18px */
498 .sidebar a, .sidebar .current {
499 color: var(--sidebar-link-color);
503 background-color: var(--sidebar-current-link-background-color);
506 .sidebar-elems .block {
510 .sidebar-elems .block li a {
512 text-overflow: ellipsis;
520 .rustdoc .example-wrap {
525 /* For the last child of a div, the margin will be taken care of
526 by the margin-top of the next item. */
527 .rustdoc .example-wrap:last-child {
531 .rustdoc .example-wrap > pre {
537 .rustdoc .example-wrap > pre.example-line-numbers,
538 .rustdoc .example-wrap > pre.src-line-numbers {
540 min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */
543 -webkit-user-select: none;
544 -moz-user-select: none;
545 -ms-user-select: none;
548 color: var(--src-line-numbers-span-color);
551 .rustdoc .example-wrap > pre.src-line-numbers {
554 .src-line-numbers a, .src-line-numbers span {
555 color: var(--src-line-numbers-span-color);
558 .src-line-numbers :target {
559 background-color: transparent;
563 .src-line-numbers .line-highlighted {
564 background-color: var(--src-line-number-highlighted-background-color);
572 overflow-wrap: break-word;
573 overflow-wrap: anywhere;
575 /* Wrap non-pre code blocks (`text`) but not (```text```). */
576 .docblock :not(pre) > code,
577 .docblock-short code {
578 white-space: pre-wrap;
581 .top-doc .docblock h2 { font-size: 1.375rem; }
582 .top-doc .docblock h3 { font-size: 1.25rem; }
583 .top-doc .docblock h4,
584 .top-doc .docblock h5 {
587 .top-doc .docblock h6 {
591 .docblock h5 { font-size: 1rem; }
592 .docblock h6 { font-size: 0.875rem; }
599 .docblock > :not(.more-examples-toggle):not(.example-wrap) {
609 .docblock code, .docblock-short code,
610 pre, .rustdoc.source .example-wrap {
611 background-color: var(--code-block-background-color);
620 border-collapse: collapse;
623 .docblock table td, .docblock table th {
625 border: 1px solid var(--border-color);
628 .docblock table tbody tr:nth-child(2n) {
629 background: var(--table-alt-row-background-color);
632 /* Shift "where ..." part of method or fn definition down a line */
649 #main-content > .item-info {
655 flex-flow: row nowrap;
656 margin: 4px 0 25px 0;
671 text-decoration: none;
674 .small-section-header {
675 /* fields use <span> tags, but should get their own lines */
680 .small-section-header:hover > .anchor, .impl:hover > .anchor,
681 .trait-impl:hover > .anchor, .variant:hover > .anchor {
688 background: none !important;
693 .small-section-header > .anchor {
697 h2.small-section-header > .anchor {
701 .main-heading a:hover,
702 .example-wrap > pre.rust a:hover,
704 .docblock a:not(.test-arrow):not(.scrape-help):hover,
705 .docblock-short a:not(.test-arrow):not(.scrape-help):hover,
707 text-decoration: underline;
710 .crate.block a.current { font-weight: 500; }
712 /* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap
713 as much as needed on mobile (see
714 src/test/rustdoc-gui/type-declaration-overflow.goml for an example of why
715 this matters). The `anywhere` value means:
717 "Soft wrap opportunities introduced by the word break are considered when
718 calculating min-content intrinsic sizes."
720 https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#values
722 For table layouts, that becomes a problem: the browser tries to make each
723 column as narrow as possible, and `overflow-wrap: anywhere` means it can do
724 so by breaking words - even if some other column could be shrunk without
725 breaking words! This shows up, for instance, in the `Structs` / `Modules` /
726 `Functions` (etcetera) sections of a module page, and when a docblock
729 So, for table layouts, override the default with break-word, which does
730 _not_ affect min-content intrinsic sizes.
734 overflow-wrap: break-word;
743 .item-left, .item-right {
747 padding-right: 1.25rem;
750 .search-results-title {
753 /* flex layout allows shrinking the <select> appropriately if it becomes too large */
755 /* make things look like in a line, despite the fact that we're using a layout
756 with boxes (i.e. from the flex layout) */
757 align-items: baseline;
760 /* ensures that 100% in properties of #crate-search-div:after
761 are relative to the size of this div */
763 /* allows this div (and with it the <select>-element "#crate-search") to be shrunk */
768 /* keep these two in sync with "@-moz-document url-prefix()" below */
769 padding: 0 23px 0 4px;
770 /* prevents the <select> from overflowing the containing div in case it's shrunk */
772 /* contents can overflow because of max-width limit, then show ellipsis */
773 text-overflow: ellipsis;
774 border: 1px solid var(--border-color);
778 -moz-appearance: none;
779 -webkit-appearance: none;
780 /* Removes default arrow from firefox */
782 background-color: var(--main-background-color);
787 #crate-search:hover, #crate-search:focus {
788 border-color: var(--crate-search-hover-border);
790 /* cancel stylistic differences in padding in firefox
791 for "appearance: none"-style (or equivalent) <select>s */
792 @-moz-document url-prefix() {
794 padding-left: 0px; /* == 4px - 4px */
795 padding-right: 19px; /* == 23px - 4px */
798 /* pseudo-element for holding the dropdown-arrow image; needs to be a separate thing
799 so that we can apply CSS-filters to change the arrow color in themes */
800 #crate-search-div::after {
801 /* lets clicks through! */
802 pointer-events: none;
803 /* completely covers the underlying div */
810 background-repeat: no-repeat;
811 background-size: 20px;
812 background-position: calc(100% - 2px) 56%;
813 /* image is black color */
814 background-image: url("down-arrow-927217e04c7463ac.svg");
815 /* changes the arrow image color */
816 filter: var(--crate-search-div-filter);
818 #crate-search-div:hover::after, #crate-search-div:focus-within::after {
819 filter: var(--crate-search-div-hover-filter);
821 #crate-search > option {
825 /* Override Normalize.css: it has a rule that sets
826 -webkit-appearance: textfield for search inputs. That
827 causes rounded corners and no border on iOS Safari. */
828 -webkit-appearance: none;
830 border: 1px solid var(--border-color);
835 background-color: var(--button-background-color);
836 color: var(--search-color);
838 .search-input:focus {
839 border-color: var(--search-input-focused-border-color);
846 .search-results.active {
850 .search-results > a {
852 /* A little margin ensures the browser's outlining of focused links has room to display. */
855 border-bottom: 1px solid var(--search-result-border-color);
859 .search-results > a > div {
863 .search-results > a > div.desc {
865 text-overflow: ellipsis;
869 .search-results a:hover,
870 .search-results a:focus {
871 background-color: var(--search-result-link-focus-background-color);
874 .search-results .result-name span.alias {
875 color: var(--search-results-alias-color);
877 .search-results .result-name span.grey {
878 color: var(--search-results-grey-color);
888 border: 1px solid var(--border-color);
889 background-color: var(--main-background-color);
890 color: var(--main-color);
891 --popover-arrow-offset: 11px;
894 /* This rule is to draw the little arrow connecting the settings menu to the gear icon. */
898 right: var(--popover-arrow-offset);
899 border: solid var(--border-color);
900 border-width: 1px 1px 0 0;
901 background-color: var(--main-background-color);
903 transform: rotate(-45deg);
907 /* use larger max-width for help popover, but not for help.html */
910 --popover-arrow-offset: 48px;
916 margin-right: 0.5rem;
918 #help span.top, #help span.bottom {
925 border-bottom: 1px solid var(--border-color);
931 border-top: 1px solid var(--border-color);
933 .side-by-side > div {
936 padding: 0 20px 20px 17px;
940 /* This min-height is needed to unify the height of the stab elements because some of them
949 margin-left: 0.3125em;
955 color: var(--main-color);
956 background-color: var(--stab-background-color);
959 white-space: pre-wrap;
961 display: inline-flex;
962 vertical-align: text-bottom;
965 .stab.portability > code {
967 color: var(--stab-code-color);
972 margin-right: 0.3rem;
975 /* Black one-pixel outline around emoji shapes */
984 .module-item.unstable,
985 .import-item.unstable {
1001 color: var(--right-side-color);
1009 /* Code highlighting */
1011 color: var(--code-highlight-kw-color);
1014 color: var(--code-highlight-kw-2-color);
1016 pre.rust .lifetime {
1017 color: var(--code-highlight-lifetime-color);
1019 pre.rust .prelude-ty {
1020 color: var(--code-highlight-prelude-color);
1022 pre.rust .prelude-val {
1023 color: var(--code-highlight-prelude-val-color);
1026 color: var(--code-highlight-string-color);
1029 color: var(--code-highlight-number-color);
1031 pre.rust .bool-val {
1032 color: var(--code-highlight-literal-color);
1035 color: var(--code-highlight-self-color);
1038 color: var(--code-highlight-attribute-color);
1041 pre.rust .macro-nonterminal {
1042 color: var(--code-highlight-macro-color);
1044 pre.rust .question-mark {
1046 color: var(--code-highlight-question-mark-color);
1049 color: var(--code-highlight-comment-color);
1051 pre.rust .doccomment {
1052 color: var(--code-highlight-doc-comment-color);
1055 .rustdoc.source .example-wrap pre.rust a {
1056 background: var(--codeblock-link-background);
1059 .example-wrap.compile_fail,
1060 .example-wrap.should_panic {
1061 border-left: 2px solid var(--codeblock-error-color);
1064 .ignore.example-wrap {
1065 border-left: 2px solid var(--codeblock-ignore-color);
1068 .example-wrap.compile_fail:hover,
1069 .example-wrap.should_panic:hover {
1070 border-left: 2px solid var(--codeblock-error-hover-color);
1073 .example-wrap.ignore:hover {
1074 border-left: 2px solid var(--codeblock-ignore-hover-color);
1077 .example-wrap.compile_fail .tooltip,
1078 .example-wrap.should_panic .tooltip {
1079 color: var(--codeblock-error-color);
1082 .example-wrap.ignore .tooltip {
1083 color: var(--codeblock-ignore-color);
1086 .example-wrap.compile_fail:hover .tooltip,
1087 .example-wrap.should_panic:hover .tooltip {
1088 color: var(--codeblock-error-hover-color);
1091 .example-wrap.ignore:hover .tooltip {
1092 color: var(--codeblock-ignore-hover-color);
1095 .example-wrap .tooltip {
1102 .example-wrap .tooltip:hover::after {
1103 padding: 5px 3px 3px 3px;
1107 border: 1px solid var(--border-color);
1112 background-color: var(--tooltip-background-color);
1113 color: var(--tooltip-color);
1116 .example-wrap .tooltip:hover::before {
1123 border: 5px solid transparent;
1124 border-right-color: var(--tooltip-background-color);
1127 .example-wrap.ignore .tooltip:hover::after {
1128 content: "This example is not tested";
1130 .example-wrap.compile_fail .tooltip:hover::after {
1131 content: "This example deliberately fails to compile";
1133 .example-wrap.should_panic .tooltip:hover::after {
1134 content: "This example panics";
1136 .example-wrap.edition .tooltip:hover::after {
1137 content: "This code runs with edition " attr(data-edition);
1140 .example-wrap.compile_fail .tooltip,
1141 .example-wrap.should_panic .tooltip,
1142 .example-wrap.ignore .tooltip {
1150 padding: 5px 10px 5px 10px;
1152 font-size: 1.375rem;
1156 color: var(--test-arrow-color);
1157 background-color: var(--test-arrow-background-color);
1159 a.test-arrow:hover {
1160 color: var(--test-arrow-hover-color);
1161 background-color: var(--test-arrow-hover-background-color);
1163 .example-wrap:hover .test-arrow {
1164 visibility: visible;
1169 color: var(--code-attribute-color);
1177 .out-of-band > span.since {
1190 margin-bottom: 40px;
1193 .sub-variant > .sub-variant-field {
1199 background-color: var(--target-background-color);
1200 border-right: 3px solid var(--target-border-color);
1209 /* placeholder thunk so that the mouse can easily travel from "(i)" to popover
1210 the resulting "hover tunnel" is a stepped triangle, approximating
1211 https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown */
1212 .notable-traits:hover::after {
1214 top: calc(100% - 10px);
1221 .notable .docblock {
1222 margin: 0.25em 0.5em;
1225 .notable .docblock pre, .notable .docblock code {
1226 background: transparent;
1230 white-space: pre-wrap;
1239 .search-failed.active {
1243 .search-failed > ul {
1252 flex-direction: row;
1257 #search-tabs button {
1259 font-size: 1.125rem;
1261 border-top: 2px solid;
1267 #search-tabs .count {
1269 color: var(--search-tab-title-count-color);
1272 #src-sidebar-toggle {
1277 border-bottom: 1px solid;
1280 justify-content: stretch;
1281 align-items: stretch;
1288 #source-sidebar > .title {
1291 border-bottom: 1px solid var(--border-color);
1294 #source-sidebar div.files > a:hover, details.dir-entry summary:hover,
1295 #source-sidebar div.files > a:focus, details.dir-entry summary:focus {
1296 background-color: var(--source-sidebar-background-hover);
1298 #source-sidebar div.files > a.selected {
1299 background-color: var(--source-sidebar-background-selected);
1301 #src-sidebar-toggle > button {
1310 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1311 -webkit-appearance: none;
1315 #settings-menu, #help-button {
1319 #settings-menu > a, #help-button > a {
1321 align-items: center;
1322 justify-content: center;
1323 background-color: var(--button-background-color);
1324 border: 1px solid var(--border-color);
1326 color: var(--settings-button-color);
1327 /* Rare exception to specifying font sizes in rem. Since this is acting
1328 as an icon, it's okay to specify their sizes in pixels. */
1333 #settings-menu > a:hover, #settings-menu > a:focus,
1334 #help-button > a:hover, #help-button > a:focus {
1335 border-color: var(--settings-button-border-focus);
1339 color: var(--copy-path-button-color);
1340 background: var(--main-background-color);
1349 filter: var(--copy-path-img-filter);
1351 #copy-path:hover > img {
1352 filter: var(--copy-path-img-hover-filter);
1355 @keyframes rotating {
1357 transform: rotate(0deg);
1360 transform: rotate(360deg);
1363 #settings-menu.rotate > a img {
1364 animation: rotating 2s linear infinite;
1368 display: inline-block;
1370 font: 15px monospace;
1372 vertical-align: middle;
1373 border: solid 1px var(--border-color);
1375 color: var(--kbd--color);
1376 background-color: var(--kbd-background);
1377 box-shadow: inset 0 -1px 0 var(--kbd-box-shadow-color);
1388 details.dir-entry > summary {
1394 details.dir-entry div.folders, details.dir-entry div.files {
1398 details.dir-entry a {
1402 /* We use CSS containment on the details elements because most sizeable elements
1403 of the page are contained in one of these. This also makes re-rendering
1404 faster on document changes (like closing and opening toggles).
1405 Unfortunately we can't yet specify contain: content or contain: strict
1406 because the [-]/[+] toggles extend past the boundaries of the <details>
1407 https://developer.mozilla.org/en-US/docs/Web/CSS/contain */
1408 details.rustdoc-toggle {
1413 /* The hideme class is used on summary tags that contain a span with
1414 placeholder text shown only when the toggle is closed. For instance,
1415 "Expand description" or "Show methods". */
1416 details.rustdoc-toggle > summary.hideme {
1421 details.rustdoc-toggle > summary {
1423 /* focus outline is shown on `::before` instead of this */
1426 details.rustdoc-toggle > summary::-webkit-details-marker,
1427 details.rustdoc-toggle > summary::marker {
1431 details.rustdoc-toggle > summary.hideme > span {
1435 details.rustdoc-toggle > summary::before {
1436 background: url("toggle-plus-1092eb4930d581b0.svg") no-repeat top left;
1441 display: inline-block;
1442 vertical-align: middle;
1444 filter: var(--toggle-filter);
1447 details.rustdoc-toggle > summary.hideme > span,
1448 .more-examples-toggle summary, .more-examples-toggle .hide-more {
1449 color: var(--toggles-color);
1452 /* Screen readers see the text version at the end the line.
1453 Visual readers see the icon at the start of the line, but small and transparent. */
1454 details.rustdoc-toggle > summary::after {
1462 details.rustdoc-toggle > summary.hideme::after {
1463 /* "hideme" toggles already have a description when they're contracted */
1467 details.rustdoc-toggle > summary:focus::before,
1468 details.rustdoc-toggle > summary:hover::before {
1472 details.rustdoc-toggle > summary:focus-visible::before {
1473 /* The SVG is black, and gets turned white using a filter in the dark themes.
1474 Do the same with the outline.
1475 The dotted 1px style is copied from Firefox's focus ring style.
1477 outline: 1px dotted #000;
1478 outline-offset: 1px;
1481 details.non-exhaustive {
1485 details.rustdoc-toggle > summary.hideme::before {
1489 details.rustdoc-toggle > summary:not(.hideme)::before {
1495 .impl-items > details.rustdoc-toggle > summary:not(.hideme)::before {
1500 /* When a "hideme" summary is open and the "Expand description" or "Show
1501 methods" text is hidden, we want the [-] toggle that remains to not
1502 affect the layout of the items to its right. To do that, we use
1503 absolute positioning. Note that we also set position: relative
1504 on the parent <details> to make this work properly. */
1505 details.rustdoc-toggle[open] > summary.hideme {
1509 details.rustdoc-toggle[open] > summary.hideme > span {
1513 details.rustdoc-toggle[open] > summary::before {
1514 background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left;
1517 details.rustdoc-toggle[open] > summary::after {
1518 content: "Collapse";
1521 /* This is needed in docblocks to have the "â–¶" element to be on the same line. */
1522 .docblock summary > * {
1523 display: inline-block;
1526 /* In case there is no documentation before a code block, we need to add some margin at the top
1527 to prevent an overlay between the "collapse toggle" and the information tooltip.
1528 However, it's not needed with smaller screen width because the doc/code block is always put
1529 "one line" below. */
1530 .docblock > .example-wrap:first-child .tooltip {
1537 WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
1538 If you update this line, then you also need to update the line with the same warning
1541 @media (max-width: 700px) {
1542 /* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
1543 or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
1544 by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
1547 scroll-margin-top: 45px;
1551 /* Sidebar should overlay main content, rather than pushing main content to the right.
1552 Turn off `display: flex` on the body element. */
1562 flex-direction: column;
1567 margin-left: initial;
1571 .out-of-band .since::before {
1575 /* Hide the logo and item name from the sidebar. Those are displayed
1576 in the mobile-topbar instead. */
1577 .sidebar .sidebar-logo,
1578 .sidebar .location {
1585 /* Hide the sidebar offscreen while not in use. Doing this instead of display: none means
1586 the sidebar stays visible for screen readers, which is useful for navigation. */
1589 /* Reduce height slightly to account for mobile topbar. */
1590 height: calc(100vh - 45px);
1594 /* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
1595 so don't bump down the main content or the sidebar. */
1597 .rustdoc.source .sidebar {
1605 .source-sidebar-expanded .source .sidebar,
1606 .sidebar:focus-within {
1610 .rustdoc.source > .sidebar {
1616 margin: auto 0.5em auto auto;
1618 /* Rare exception to specifying font sizes in rem. Since the topbar
1619 height is specified in pixels, this also has to be specified in
1620 pixels to avoid overflowing the topbar when the user sets a bigger
1625 .mobile-topbar h2 a {
1627 text-overflow: ellipsis;
1629 white-space: nowrap;
1632 .mobile-topbar .logo-container > img {
1635 margin: 5px 0 5px 20px;
1640 flex-direction: row;
1650 .sidebar-menu-toggle {
1652 /* Rare exception to specifying font sizes in rem. Since this is acting
1653 as an icon, it's okay to specify its sizes in pixels. */
1656 color: var(--main-color);
1668 display: none !important;
1671 #search-tabs .count {
1675 #main-content > details.rustdoc-toggle > summary::before,
1676 #main-content > div > details.rustdoc-toggle > summary::before {
1680 #src-sidebar-toggle {
1688 border-top-right-radius: 3px;
1689 border-bottom-right-radius: 3px;
1694 .source-sidebar-expanded #src-sidebar-toggle {
1698 border-top-right-radius: unset;
1699 border-bottom-right-radius: unset;
1702 border-bottom: 1px solid;
1705 /* We don't display these buttons on mobile devices. */
1706 #copy-path, #help-button {
1710 /* Display an alternating layout on tablets and phones */
1711 .item-table, .item-row, .item-left, .item-right,
1712 .search-results > a, .search-results > a > div {
1716 /* Display an alternating layout on tablets and phones */
1717 .search-results > a {
1720 .search-results > a > div.desc, .item-right {
1724 .source-sidebar-expanded .source .sidebar {
1729 /* Position of the "[-]" element. */
1730 details.rustdoc-toggle:not(.top-doc) > summary {
1733 .impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
1734 #main-content > details.rustdoc-toggle:not(.top-doc) > summary::before,
1735 #main-content > div > details.rustdoc-toggle > summary::before {
1739 /* Align summary-nested and unnested item-info gizmos. */
1740 .impl-items > .item-info {
1750 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
1751 @media (min-width: 701px) {
1752 /* Places file-link for a scraped example on top of the example to save space.
1753 We only do this on large screens so the file-link doesn't overlap too much
1754 with the example's content. */
1755 .scraped-example-title {
1758 background: var(--main-background-color);
1762 box-shadow: 0 0 4px var(--main-background-color);
1767 nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path,
1768 details.rustdoc-toggle[open] > summary::before, details.rustdoc-toggle > summary::before,
1769 details.rustdoc-toggle.top-doc > summary {
1782 @media (max-width: 464px) {
1788 overflow-wrap: break-word;
1789 overflow-wrap: anywhere;
1793 flex-direction: column;
1797 align-self: stretch;
1800 .sub-logo-container > img {
1807 .implementors-toggle > summary,
1809 #implementors-list > .docblock,
1810 .impl-items > section,
1811 .impl-items > .rustdoc-toggle > summary,
1813 .methods > .rustdoc-toggle > summary
1815 margin-bottom: 0.75em;
1818 .variants > .docblock,
1819 .implementors-toggle > .docblock,
1820 .impl-items > .rustdoc-toggle[open]:not(:last-child),
1821 .methods > .rustdoc-toggle[open]:not(:last-child),
1822 .implementors-toggle[open]:not(:last-child) {
1826 #trait-implementations-list .impl-items > .rustdoc-toggle:not(:last-child),
1827 #synthetic-implementations-list .impl-items > .rustdoc-toggle:not(:last-child),
1828 #blanket-implementations-list .impl-items > .rustdoc-toggle:not(:last-child) {
1832 /* Begin: styles for --scrape-examples feature */
1834 .scraped-example-list .scrape-help {
1837 font-weight: normal;
1841 border: 1px solid var(--scrape-example-help-border-color);
1842 border-radius: 50px;
1843 color: var(--scrape-example-help-color);
1845 .scraped-example-list .scrape-help:hover {
1846 border-color: var(--scrape-example-help-hover-border-color);
1847 color: var(--scrape-example-help-hover-color);
1851 /* So .scraped-example-title can be positioned absolutely */
1855 .scraped-example .code-wrapper {
1858 flex-direction: row;
1863 .scraped-example:not(.expanded) .code-wrapper {
1864 /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
1865 * of lines shown in the un-expanded example code viewer. This pre needs to have
1866 * a max-height equal to line-height * N. The line-height is currently 1.5em,
1867 * and we include additional 10px for padding. */
1868 max-height: calc(1.5em * 5 + 10px);
1871 .scraped-example:not(.expanded) .code-wrapper pre {
1874 /* See above comment, should be the same max-height. */
1875 max-height: calc(1.5em * 5 + 10px);
1878 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,
1879 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre {
1880 /* See above comment, except this height is based on HIDDEN_MAX_LINES. */
1881 max-height: calc(1.5em * 10 + 10px);
1884 .scraped-example .code-wrapper .next,
1885 .scraped-example .code-wrapper .prev,
1886 .scraped-example .code-wrapper .expand {
1887 color: var(--main-color);
1894 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1895 -webkit-appearance: none;
1898 .scraped-example .code-wrapper .prev {
1901 .scraped-example .code-wrapper .next {
1904 .scraped-example .code-wrapper .expand {
1908 .scraped-example:not(.expanded) .code-wrapper:before,
1909 .scraped-example:not(.expanded) .code-wrapper:after {
1916 .scraped-example:not(.expanded) .code-wrapper:before {
1919 .scraped-example:not(.expanded) .code-wrapper:after {
1923 .scraped-example .code-wrapper .example-wrap {
1929 .scraped-example:not(.expanded) .code-wrapper .example-wrap {
1933 .scraped-example .example-wrap .rust span.highlight {
1934 background: var(--scrape-example-code-line-highlight);
1936 .scraped-example .example-wrap .rust span.highlight.focus {
1937 background: var(--scrape-example-code-line-highlight-focus);
1940 .more-examples-toggle {
1941 max-width: calc(100% + 25px);
1946 .more-examples-toggle .hide-more {
1951 .more-scraped-examples {
1960 right: calc(100% + 10px);
1965 .toggle-line-inner {
1968 background: var(--scrape-example-toggle-line-background);
1971 .toggle-line:hover .toggle-line-inner {
1972 background: var(--scrape-example-toggle-line-hover-background);
1975 .more-scraped-examples .scraped-example, .example-links {
1979 .more-scraped-examples .scraped-example:first-child {
1987 /* End: styles for --scrape-examples feature */