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;
111 font-feature-settings: "kern", "liga";
112 background-color: var(--main-background-color);
113 color: var(--main-color);
117 font-size: 1.5rem; /* 24px */
120 font-size: 1.375rem; /* 22px */
123 font-size: 1.25rem; /* 20px */
125 h1, h2, h3, h4, h5, h6 {
129 margin: 25px 0 15px 0;
132 .docblock h3, .docblock h4, h5, h6 {
133 margin: 15px 0 5px 0;
135 .docblock > h2:first-child,
136 .docblock > h3:first-child,
137 .docblock > h4:first-child,
138 .docblock > h5:first-child,
139 .docblock > h6:first-child {
146 /* We use overflow-wrap: break-word for Safari, which doesn't recognize
147 `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
148 overflow-wrap: break-word;
149 /* Then override it with `anywhere`, which is required to make non-Safari browsers break
150 more aggressively when we want them to. */
151 overflow-wrap: anywhere;
159 /* The only headings that get underlines are:
160 Markdown-generated headings within the top-doc
161 Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
162 Underlines elsewhere in the documentation break up visual flow and tend to invert
163 section hierarchies. */
165 .top-doc .docblock > h3,
166 .top-doc .docblock > h4 {
167 border-bottom: 1px solid var(--headings-border-bottom-color);
170 font-size: 1.125rem; /* 18px */
182 h1, h2, h3, h4, h5, h6,
186 .search-results .result-name,
193 .scraped-example-list,
194 /* This selector is for the items listed in the "all items" page. */
196 font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
201 .small-section-header a,
210 .result-name .primitive > i, .result-name .keyword > i {
211 color: var(--main-color);
214 .content span.enum, .content a.enum,
215 .content span.struct, .content a.struct,
216 .content span.union, .content a.union,
217 .content span.primitive, .content a.primitive,
218 .content span.type, .content a.type,
219 .content span.foreigntype, .content a.foreigntype {
220 color: var(--type-link-color);
223 .content span.trait, .content a.trait,
224 .content span.traitalias, .content a.traitalias {
225 color: var(--trait-link-color);
228 .content span.associatedtype, .content a.associatedtype,
229 .content span.constant, .content a.constant,
230 .content span.static, .content a.static {
231 color: var(--assoc-item-link-color);
234 .content span.fn, .content a.fn,
235 .content span.method, .content a.method,
236 .content span.tymethod, .content a.tymethod {
237 color: var(--function-link-color);
240 .content span.attr, .content a.attr,
241 .content span.derive, .content a.derive,
242 .content span.macro, .content a.macro {
243 color: var(--macro-link-color);
246 .content span.mod, .content a.mod {
247 color: var(--mod-link-color);
250 .content span.keyword, .content a.keyword {
251 color: var(--keyword-link-color);
255 color: var(--link-color);
256 text-decoration: none;
262 ul ul, ol ul, ul ol, ol ol {
263 margin-bottom: .625em;
267 /* Paragraph spacing at least 1.5 times line spacing per Web Content Accessibility Guidelines.
268 Line-height is 1.5rem, so line spacing is .5rem; .75em is 1.5 times that.
269 https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
272 /* For the last child of a div, the margin will be taken care of
273 by the margin-top of the next item. */
278 /* Fix some style changes due to normalize.css 8 */
281 /* Buttons on Safari have different default padding than other platforms. Make them the same. */
283 /* Opinionated tweak: use pointer cursor as clickability signifier. */
287 /* end tweaks for normalize.css 8 */
289 button#toggle-all-docs {
293 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
294 -webkit-appearance: none;
307 padding: 10px 15px 40px 45px;
308 min-width: 0; /* avoid growing beyond the size limit */
320 details:not(.toggle) summary {
324 code, pre, a.test-arrow, .code-header {
325 font-family: "Source Code Pro", monospace;
327 .docblock code, .docblock-short code {
331 .docblock pre code, .docblock-short pre code {
336 line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
341 /* This rule allows to have scrolling on the X axis. */
342 .item-decl .type-contents-toggle {
346 .source .content pre {
349 .rustdoc.source .example-wrap > pre.src-line-numbers {
350 padding: 20px 0 20px 4px;
357 .sub-logo-container, .logo-container {
358 /* 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);
504 .sidebar a:hover:not(.logo-container) {
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;
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;
670 .small-section-header {
671 /* fields use <span> tags, but should get their own lines */
676 .small-section-header:hover > .anchor, .impl:hover > .anchor,
677 .trait-impl:hover > .anchor, .variant:hover > .anchor {
684 background: none !important;
689 .small-section-header > .anchor {
693 h2.small-section-header > .anchor {
697 .main-heading a:hover,
698 .example-wrap > pre.rust a:hover,
700 .docblock a:not(.test-arrow):not(.scrape-help):hover,
701 .docblock-short a:not(.test-arrow):not(.scrape-help):hover,
703 text-decoration: underline;
706 .crate.block a.current { font-weight: 500; }
708 /* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap
709 as much as needed on mobile (see
710 tests/rustdoc-gui/type-declaration-overflow.goml for an example of why
711 this matters). The `anywhere` value means:
713 "Soft wrap opportunities introduced by the word break are considered when
714 calculating min-content intrinsic sizes."
716 https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#values
718 For table layouts, that becomes a problem: the browser tries to make each
719 column as narrow as possible, and `overflow-wrap: anywhere` means it can do
720 so by breaking words - even if some other column could be shrunk without
721 breaking words! This shows up, for instance, in the `Structs` / `Modules` /
722 `Functions` (etcetera) sections of a module page, and when a docblock
725 So, for table layouts, override the default with break-word, which does
726 _not_ affect min-content intrinsic sizes.
730 overflow-wrap: break-word;
739 .item-left, .item-right {
743 padding-right: 1.25rem;
746 .search-results-title {
749 /* flex layout allows shrinking the <select> appropriately if it becomes too large */
751 /* make things look like in a line, despite the fact that we're using a layout
752 with boxes (i.e. from the flex layout) */
753 align-items: baseline;
756 /* ensures that 100% in properties of #crate-search-div:after
757 are relative to the size of this div */
759 /* allows this div (and with it the <select>-element "#crate-search") to be shrunk */
764 /* keep these two in sync with "@-moz-document url-prefix()" below */
765 padding: 0 23px 0 4px;
766 /* prevents the <select> from overflowing the containing div in case it's shrunk */
768 /* contents can overflow because of max-width limit, then show ellipsis */
769 text-overflow: ellipsis;
770 border: 1px solid var(--border-color);
774 -moz-appearance: none;
775 -webkit-appearance: none;
776 /* Removes default arrow from firefox */
778 background-color: var(--main-background-color);
783 #crate-search:hover, #crate-search:focus {
784 border-color: var(--crate-search-hover-border);
786 /* cancel stylistic differences in padding in firefox
787 for "appearance: none"-style (or equivalent) <select>s */
788 @-moz-document url-prefix() {
790 padding-left: 0px; /* == 4px - 4px */
791 padding-right: 19px; /* == 23px - 4px */
794 /* pseudo-element for holding the dropdown-arrow image; needs to be a separate thing
795 so that we can apply CSS-filters to change the arrow color in themes */
796 #crate-search-div::after {
797 /* lets clicks through! */
798 pointer-events: none;
799 /* completely covers the underlying div */
806 background-repeat: no-repeat;
807 background-size: 20px;
808 background-position: calc(100% - 2px) 56%;
809 /* image is black color */
810 background-image: url("down-arrow-927217e04c7463ac.svg");
811 /* changes the arrow image color */
812 filter: var(--crate-search-div-filter);
814 #crate-search-div:hover::after, #crate-search-div:focus-within::after {
815 filter: var(--crate-search-div-hover-filter);
817 #crate-search > option {
821 /* Override Normalize.css: it has a rule that sets
822 -webkit-appearance: textfield for search inputs. That
823 causes rounded corners and no border on iOS Safari. */
824 -webkit-appearance: none;
826 border: 1px solid var(--border-color);
831 background-color: var(--button-background-color);
832 color: var(--search-color);
834 .search-input:focus {
835 border-color: var(--search-input-focused-border-color);
842 .search-results.active {
846 .search-results > a {
848 /* A little margin ensures the browser's outlining of focused links has room to display. */
851 border-bottom: 1px solid var(--search-result-border-color);
855 .search-results > a > div {
859 .search-results > a > div.desc {
861 text-overflow: ellipsis;
865 .search-results a:hover,
866 .search-results a:focus {
867 background-color: var(--search-result-link-focus-background-color);
870 .search-results .result-name span.alias {
871 color: var(--search-results-alias-color);
873 .search-results .result-name span.grey {
874 color: var(--search-results-grey-color);
884 border: 1px solid var(--border-color);
885 background-color: var(--main-background-color);
886 color: var(--main-color);
887 --popover-arrow-offset: 11px;
890 /* This rule is to draw the little arrow connecting the settings menu to the gear icon. */
894 right: var(--popover-arrow-offset);
895 border: solid var(--border-color);
896 border-width: 1px 1px 0 0;
897 background-color: var(--main-background-color);
899 transform: rotate(-45deg);
903 /* use larger max-width for help popover, but not for help.html */
906 --popover-arrow-offset: 48px;
912 margin-right: 0.5rem;
914 #help span.top, #help span.bottom {
921 border-bottom: 1px solid var(--border-color);
927 border-top: 1px solid var(--border-color);
929 .side-by-side > div {
932 padding: 0 20px 20px 17px;
936 /* This min-height is needed to unify the height of the stab elements because some of them
945 margin-left: 0.3125em;
951 color: var(--main-color);
952 background-color: var(--stab-background-color);
955 white-space: pre-wrap;
957 display: inline-flex;
958 vertical-align: text-bottom;
961 .stab.portability > code {
963 color: var(--stab-code-color);
968 margin-right: 0.3rem;
971 /* Black one-pixel outline around emoji shapes */
980 .module-item.unstable,
981 .import-item.unstable {
997 color: var(--right-side-color);
1005 /* Code highlighting */
1007 color: var(--code-highlight-kw-color);
1010 color: var(--code-highlight-kw-2-color);
1012 pre.rust .lifetime {
1013 color: var(--code-highlight-lifetime-color);
1015 pre.rust .prelude-ty {
1016 color: var(--code-highlight-prelude-color);
1018 pre.rust .prelude-val {
1019 color: var(--code-highlight-prelude-val-color);
1022 color: var(--code-highlight-string-color);
1025 color: var(--code-highlight-number-color);
1027 pre.rust .bool-val {
1028 color: var(--code-highlight-literal-color);
1031 color: var(--code-highlight-self-color);
1034 color: var(--code-highlight-attribute-color);
1037 pre.rust .macro-nonterminal {
1038 color: var(--code-highlight-macro-color);
1040 pre.rust .question-mark {
1042 color: var(--code-highlight-question-mark-color);
1045 color: var(--code-highlight-comment-color);
1047 pre.rust .doccomment {
1048 color: var(--code-highlight-doc-comment-color);
1051 .rustdoc.source .example-wrap pre.rust a {
1052 background: var(--codeblock-link-background);
1055 .example-wrap.compile_fail,
1056 .example-wrap.should_panic {
1057 border-left: 2px solid var(--codeblock-error-color);
1060 .ignore.example-wrap {
1061 border-left: 2px solid var(--codeblock-ignore-color);
1064 .example-wrap.compile_fail:hover,
1065 .example-wrap.should_panic:hover {
1066 border-left: 2px solid var(--codeblock-error-hover-color);
1069 .example-wrap.ignore:hover {
1070 border-left: 2px solid var(--codeblock-ignore-hover-color);
1073 .example-wrap.compile_fail .tooltip,
1074 .example-wrap.should_panic .tooltip {
1075 color: var(--codeblock-error-color);
1078 .example-wrap.ignore .tooltip {
1079 color: var(--codeblock-ignore-color);
1082 .example-wrap.compile_fail:hover .tooltip,
1083 .example-wrap.should_panic:hover .tooltip {
1084 color: var(--codeblock-error-hover-color);
1087 .example-wrap.ignore:hover .tooltip {
1088 color: var(--codeblock-ignore-hover-color);
1091 .example-wrap .tooltip {
1098 .example-wrap .tooltip:hover::after {
1099 padding: 5px 3px 3px 3px;
1103 border: 1px solid var(--border-color);
1108 background-color: var(--tooltip-background-color);
1109 color: var(--tooltip-color);
1112 .example-wrap .tooltip:hover::before {
1119 border: 5px solid transparent;
1120 border-right-color: var(--tooltip-background-color);
1123 .example-wrap.ignore .tooltip:hover::after {
1124 content: "This example is not tested";
1126 .example-wrap.compile_fail .tooltip:hover::after {
1127 content: "This example deliberately fails to compile";
1129 .example-wrap.should_panic .tooltip:hover::after {
1130 content: "This example panics";
1132 .example-wrap.edition .tooltip:hover::after {
1133 content: "This code runs with edition " attr(data-edition);
1136 .example-wrap.compile_fail .tooltip,
1137 .example-wrap.should_panic .tooltip,
1138 .example-wrap.ignore .tooltip {
1146 padding: 5px 10px 5px 10px;
1148 font-size: 1.375rem;
1152 color: var(--test-arrow-color);
1153 background-color: var(--test-arrow-background-color);
1155 a.test-arrow:hover {
1156 color: var(--test-arrow-hover-color);
1157 background-color: var(--test-arrow-hover-background-color);
1159 .example-wrap:hover .test-arrow {
1160 visibility: visible;
1165 color: var(--code-attribute-color);
1173 .out-of-band > span.since {
1186 margin-bottom: 40px;
1189 .sub-variant > .sub-variant-field {
1195 background-color: var(--target-background-color);
1196 border-right: 3px solid var(--target-border-color);
1205 /* placeholder thunk so that the mouse can easily travel from "(i)" to popover
1206 the resulting "hover tunnel" is a stepped triangle, approximating
1207 https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown */
1208 .notable-traits:hover::after {
1210 top: calc(100% - 10px);
1217 .notable .docblock {
1218 margin: 0.25em 0.5em;
1221 .notable .docblock pre, .notable .docblock code {
1222 background: transparent;
1226 white-space: pre-wrap;
1235 .search-failed.active {
1239 .search-failed > ul {
1248 flex-direction: row;
1253 #search-tabs button {
1255 font-size: 1.125rem;
1257 border-top: 2px solid;
1263 #search-tabs .count {
1265 color: var(--search-tab-title-count-color);
1268 #src-sidebar-toggle {
1273 border-bottom: 1px solid;
1276 justify-content: stretch;
1277 align-items: stretch;
1284 #source-sidebar > .title {
1287 border-bottom: 1px solid var(--border-color);
1290 #source-sidebar div.files > a:hover, details.dir-entry summary:hover,
1291 #source-sidebar div.files > a:focus, details.dir-entry summary:focus {
1292 background-color: var(--source-sidebar-background-hover);
1294 #source-sidebar div.files > a.selected {
1295 background-color: var(--source-sidebar-background-selected);
1297 #src-sidebar-toggle > button {
1306 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1307 -webkit-appearance: none;
1311 #settings-menu, #help-button {
1315 #settings-menu > a, #help-button > a {
1317 align-items: center;
1318 justify-content: center;
1319 background-color: var(--button-background-color);
1320 border: 1px solid var(--border-color);
1322 color: var(--settings-button-color);
1323 /* Rare exception to specifying font sizes in rem. Since this is acting
1324 as an icon, it's okay to specify their sizes in pixels. */
1329 #settings-menu > a:hover, #settings-menu > a:focus,
1330 #help-button > a:hover, #help-button > a:focus {
1331 border-color: var(--settings-button-border-focus);
1335 color: var(--copy-path-button-color);
1336 background: var(--main-background-color);
1345 filter: var(--copy-path-img-filter);
1347 #copy-path:hover > img {
1348 filter: var(--copy-path-img-hover-filter);
1351 @keyframes rotating {
1353 transform: rotate(0deg);
1356 transform: rotate(360deg);
1359 #settings-menu.rotate > a img {
1360 animation: rotating 2s linear infinite;
1364 display: inline-block;
1366 font: 15px monospace;
1368 vertical-align: middle;
1369 border: solid 1px var(--border-color);
1371 color: var(--kbd-color);
1372 background-color: var(--kbd-background);
1373 box-shadow: inset 0 -1px 0 var(--kbd-box-shadow-color);
1384 details.dir-entry > summary {
1390 details.dir-entry div.folders, details.dir-entry div.files {
1394 details.dir-entry a {
1398 /* We use CSS containment on the details elements because most sizeable elements
1399 of the page are contained in one of these. This also makes re-rendering
1400 faster on document changes (like closing and opening toggles).
1401 Unfortunately we can't yet specify contain: content or contain: strict
1402 because the [-]/[+] toggles extend past the boundaries of the <details>
1403 https://developer.mozilla.org/en-US/docs/Web/CSS/contain */
1409 /* The hideme class is used on summary tags that contain a span with
1410 placeholder text shown only when the toggle is closed. For instance,
1411 "Expand description" or "Show methods". */
1412 details.toggle > summary.hideme {
1417 details.toggle > summary {
1419 /* focus outline is shown on `::before` instead of this */
1422 details.toggle > summary::-webkit-details-marker,
1423 details.toggle > summary::marker {
1427 details.toggle > summary.hideme > span {
1431 details.toggle > summary::before {
1432 background: url("toggle-plus-1092eb4930d581b0.svg") no-repeat top left;
1437 display: inline-block;
1438 vertical-align: middle;
1440 filter: var(--toggle-filter);
1443 details.toggle > summary.hideme > span,
1444 .more-examples-toggle summary, .more-examples-toggle .hide-more {
1445 color: var(--toggles-color);
1448 /* Screen readers see the text version at the end the line.
1449 Visual readers see the icon at the start of the line, but small and transparent. */
1450 details.toggle > summary::after {
1458 details.toggle > summary.hideme::after {
1459 /* "hideme" toggles already have a description when they're contracted */
1463 details.toggle > summary:focus::before,
1464 details.toggle > summary:hover::before {
1468 details.toggle > summary:focus-visible::before {
1469 /* The SVG is black, and gets turned white using a filter in the dark themes.
1470 Do the same with the outline.
1471 The dotted 1px style is copied from Firefox's focus ring style.
1473 outline: 1px dotted #000;
1474 outline-offset: 1px;
1477 details.non-exhaustive {
1481 details.toggle > summary.hideme::before {
1485 details.toggle > summary:not(.hideme)::before {
1491 .impl-items > details.toggle > summary:not(.hideme)::before {
1496 /* When a "hideme" summary is open and the "Expand description" or "Show
1497 methods" text is hidden, we want the [-] toggle that remains to not
1498 affect the layout of the items to its right. To do that, we use
1499 absolute positioning. Note that we also set position: relative
1500 on the parent <details> to make this work properly. */
1501 details.toggle[open] > summary.hideme {
1505 details.toggle[open] > summary.hideme > span {
1509 details.toggle[open] > summary::before {
1510 background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left;
1513 details.toggle[open] > summary::after {
1514 content: "Collapse";
1517 /* This is needed in docblocks to have the "â–¶" element to be on the same line. */
1518 .docblock summary > * {
1519 display: inline-block;
1522 /* In case there is no documentation before a code block, we need to add some margin at the top
1523 to prevent an overlay between the "collapse toggle" and the information tooltip.
1524 However, it's not needed with smaller screen width because the doc/code block is always put
1525 "one line" below. */
1526 .docblock > .example-wrap:first-child .tooltip {
1533 WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
1534 If you update this line, then you also need to update the line with the same warning
1537 @media (max-width: 700px) {
1538 /* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
1539 or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
1540 by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
1543 scroll-margin-top: 45px;
1547 /* Sidebar should overlay main content, rather than pushing main content to the right.
1548 Turn off `display: flex` on the body element. */
1558 flex-direction: column;
1563 margin-left: initial;
1567 .out-of-band .since::before {
1571 /* Hide the logo and item name from the sidebar. Those are displayed
1572 in the mobile-topbar instead. */
1573 .sidebar .logo-container,
1574 .sidebar .location {
1581 /* Hide the sidebar offscreen while not in use. Doing this instead of display: none means
1582 the sidebar stays visible for screen readers, which is useful for navigation. */
1585 /* Reduce height slightly to account for mobile topbar. */
1586 height: calc(100vh - 45px);
1590 /* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
1591 so don't bump down the main content or the sidebar. */
1593 .rustdoc.source .sidebar {
1601 .source-sidebar-expanded .source .sidebar,
1602 .rustdoc:not(.source) .sidebar:focus-within {
1608 margin: auto 0.5em auto auto;
1610 /* Rare exception to specifying font sizes in rem. Since the topbar
1611 height is specified in pixels, this also has to be specified in
1612 pixels to avoid overflowing the topbar when the user sets a bigger
1617 .mobile-topbar h2 a {
1619 text-overflow: ellipsis;
1621 white-space: nowrap;
1624 .mobile-topbar .logo-container > img {
1627 margin: 5px 0 5px 20px;
1632 flex-direction: row;
1642 .sidebar-menu-toggle {
1644 /* Rare exception to specifying font sizes in rem. Since this is acting
1645 as an icon, it's okay to specify its sizes in pixels. */
1648 color: var(--main-color);
1656 display: none !important;
1659 #search-tabs .count {
1663 #main-content > details.toggle > summary::before,
1664 #main-content > div > details.toggle > summary::before {
1668 #src-sidebar-toggle {
1676 border-top-right-radius: 3px;
1677 border-bottom-right-radius: 3px;
1682 .source-sidebar-expanded #src-sidebar-toggle {
1686 border-top-right-radius: unset;
1687 border-bottom-right-radius: unset;
1690 border-bottom: 1px solid;
1693 /* We don't display these buttons on mobile devices. */
1694 #copy-path, #help-button {
1698 /* Display an alternating layout on tablets and phones */
1699 .item-table, .item-row, .item-left, .item-right,
1700 .search-results > a, .search-results > a > div {
1704 /* Display an alternating layout on tablets and phones */
1705 .search-results > a {
1708 .search-results > a > div.desc, .item-right {
1712 .source-sidebar-expanded .source .sidebar {
1717 /* Position of the "[-]" element. */
1718 details.toggle:not(.top-doc) > summary {
1721 .impl-items > details.toggle > summary:not(.hideme)::before,
1722 #main-content > details.toggle:not(.top-doc) > summary::before,
1723 #main-content > div > details.toggle > summary::before {
1727 /* Align summary-nested and unnested item-info gizmos. */
1728 .impl-items > .item-info {
1738 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
1739 @media (min-width: 701px) {
1740 /* Places file-link for a scraped example on top of the example to save space.
1741 We only do this on large screens so the file-link doesn't overlap too much
1742 with the example's content. */
1743 .scraped-example-title {
1746 background: var(--main-background-color);
1750 box-shadow: 0 0 4px var(--main-background-color);
1755 nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path,
1756 details.toggle[open] > summary::before, details.toggle > summary::before,
1757 details.toggle.top-doc > summary {
1770 @media (max-width: 464px) {
1776 overflow-wrap: break-word;
1777 overflow-wrap: anywhere;
1781 flex-direction: column;
1785 align-self: stretch;
1788 .sub-logo-container > img {
1795 .implementors-toggle > summary,
1797 #implementors-list > .docblock,
1798 .impl-items > section,
1799 .impl-items > .toggle > summary,
1801 .methods > .toggle > summary
1803 margin-bottom: 0.75em;
1806 .variants > .docblock,
1807 .implementors-toggle > .docblock,
1808 .impl-items > .toggle[open]:not(:last-child),
1809 .methods > .toggle[open]:not(:last-child),
1810 .implementors-toggle[open]:not(:last-child) {
1814 #trait-implementations-list .impl-items > .toggle:not(:last-child),
1815 #synthetic-implementations-list .impl-items > .toggle:not(:last-child),
1816 #blanket-implementations-list .impl-items > .toggle:not(:last-child) {
1820 /* Begin: styles for --scrape-examples feature */
1822 .scraped-example-list .scrape-help {
1825 font-weight: normal;
1829 border: 1px solid var(--scrape-example-help-border-color);
1830 border-radius: 50px;
1831 color: var(--scrape-example-help-color);
1833 .scraped-example-list .scrape-help:hover {
1834 border-color: var(--scrape-example-help-hover-border-color);
1835 color: var(--scrape-example-help-hover-color);
1839 /* So .scraped-example-title can be positioned absolutely */
1843 .scraped-example .code-wrapper {
1846 flex-direction: row;
1851 .scraped-example:not(.expanded) .code-wrapper {
1852 /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
1853 * of lines shown in the un-expanded example code viewer. This pre needs to have
1854 * a max-height equal to line-height * N. The line-height is currently 1.5em,
1855 * and we include additional 10px for padding. */
1856 max-height: calc(1.5em * 5 + 10px);
1859 .scraped-example:not(.expanded) .code-wrapper pre {
1862 /* See above comment, should be the same max-height. */
1863 max-height: calc(1.5em * 5 + 10px);
1866 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,
1867 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre {
1868 /* See above comment, except this height is based on HIDDEN_MAX_LINES. */
1869 max-height: calc(1.5em * 10 + 10px);
1872 .scraped-example .code-wrapper .next,
1873 .scraped-example .code-wrapper .prev,
1874 .scraped-example .code-wrapper .expand {
1875 color: var(--main-color);
1882 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1883 -webkit-appearance: none;
1886 .scraped-example .code-wrapper .prev {
1889 .scraped-example .code-wrapper .next {
1892 .scraped-example .code-wrapper .expand {
1896 .scraped-example:not(.expanded) .code-wrapper:before,
1897 .scraped-example:not(.expanded) .code-wrapper:after {
1904 .scraped-example:not(.expanded) .code-wrapper:before {
1907 .scraped-example:not(.expanded) .code-wrapper:after {
1911 .scraped-example .code-wrapper .example-wrap {
1917 .scraped-example:not(.expanded) .code-wrapper .example-wrap {
1921 .scraped-example .example-wrap .rust span.highlight {
1922 background: var(--scrape-example-code-line-highlight);
1924 .scraped-example .example-wrap .rust span.highlight.focus {
1925 background: var(--scrape-example-code-line-highlight-focus);
1928 .more-examples-toggle {
1929 max-width: calc(100% + 25px);
1934 .more-examples-toggle .hide-more {
1939 .more-scraped-examples {
1948 right: calc(100% + 10px);
1953 .toggle-line-inner {
1956 background: var(--scrape-example-toggle-line-background);
1959 .toggle-line:hover .toggle-line-inner {
1960 background: var(--scrape-example-toggle-line-hover-background);
1963 .more-scraped-examples .scraped-example, .example-links {
1967 .more-scraped-examples .scraped-example:first-child {
1975 /* End: styles for --scrape-examples feature */