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);
1218 margin: 0.25em 0.5em;
1221 .notable .content pre, .notable .content code {
1222 background: transparent;
1226 white-space: pre-wrap;
1229 .notable .content > h3:first-child {
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 */
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.toggle > summary.hideme {
1421 details.toggle > summary {
1423 /* focus outline is shown on `::before` instead of this */
1426 details.toggle > summary::-webkit-details-marker,
1427 details.toggle > summary::marker {
1431 details.toggle > summary.hideme > span {
1435 details.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.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.toggle > summary::after {
1462 details.toggle > summary.hideme::after {
1463 /* "hideme" toggles already have a description when they're contracted */
1467 details.toggle > summary:focus::before,
1468 details.toggle > summary:hover::before {
1472 details.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.toggle > summary.hideme::before {
1489 details.toggle > summary:not(.hideme)::before {
1495 .impl-items > details.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.toggle[open] > summary.hideme {
1509 details.toggle[open] > summary.hideme > span {
1513 details.toggle[open] > summary::before {
1514 background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left;
1517 details.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 .logo-container,
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 .rustdoc:not(.source) .sidebar:focus-within {
1612 margin: auto 0.5em auto auto;
1614 /* Rare exception to specifying font sizes in rem. Since the topbar
1615 height is specified in pixels, this also has to be specified in
1616 pixels to avoid overflowing the topbar when the user sets a bigger
1621 .mobile-topbar h2 a {
1623 text-overflow: ellipsis;
1625 white-space: nowrap;
1628 .mobile-topbar .logo-container > img {
1631 margin: 5px 0 5px 20px;
1636 flex-direction: row;
1646 .sidebar-menu-toggle {
1648 /* Rare exception to specifying font sizes in rem. Since this is acting
1649 as an icon, it's okay to specify its sizes in pixels. */
1652 color: var(--main-color);
1660 display: none !important;
1663 #search-tabs .count {
1667 #main-content > details.toggle > summary::before,
1668 #main-content > div > details.toggle > summary::before {
1672 #src-sidebar-toggle {
1680 border-top-right-radius: 3px;
1681 border-bottom-right-radius: 3px;
1686 .source-sidebar-expanded #src-sidebar-toggle {
1690 border-top-right-radius: unset;
1691 border-bottom-right-radius: unset;
1694 border-bottom: 1px solid;
1697 /* We don't display these buttons on mobile devices. */
1698 #copy-path, #help-button {
1702 /* Display an alternating layout on tablets and phones */
1703 .item-table, .item-row, .item-left, .item-right,
1704 .search-results > a, .search-results > a > div {
1708 /* Display an alternating layout on tablets and phones */
1709 .search-results > a {
1712 .search-results > a > div.desc, .item-right {
1716 .source-sidebar-expanded .source .sidebar {
1721 /* Position of the "[-]" element. */
1722 details.toggle:not(.top-doc) > summary {
1725 .impl-items > details.toggle > summary:not(.hideme)::before,
1726 #main-content > details.toggle:not(.top-doc) > summary::before,
1727 #main-content > div > details.toggle > summary::before {
1731 /* Align summary-nested and unnested item-info gizmos. */
1732 .impl-items > .item-info {
1742 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
1743 @media (min-width: 701px) {
1744 /* Places file-link for a scraped example on top of the example to save space.
1745 We only do this on large screens so the file-link doesn't overlap too much
1746 with the example's content. */
1747 .scraped-example-title {
1750 background: var(--main-background-color);
1754 box-shadow: 0 0 4px var(--main-background-color);
1759 nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path,
1760 details.toggle[open] > summary::before, details.toggle > summary::before,
1761 details.toggle.top-doc > summary {
1774 @media (max-width: 464px) {
1780 overflow-wrap: break-word;
1781 overflow-wrap: anywhere;
1785 flex-direction: column;
1789 align-self: stretch;
1792 .sub-logo-container > img {
1799 .implementors-toggle > summary,
1801 #implementors-list > .docblock,
1802 .impl-items > section,
1803 .impl-items > .toggle > summary,
1805 .methods > .toggle > summary
1807 margin-bottom: 0.75em;
1810 .variants > .docblock,
1811 .implementors-toggle > .docblock,
1812 .impl-items > .toggle[open]:not(:last-child),
1813 .methods > .toggle[open]:not(:last-child),
1814 .implementors-toggle[open]:not(:last-child) {
1818 #trait-implementations-list .impl-items > .toggle:not(:last-child),
1819 #synthetic-implementations-list .impl-items > .toggle:not(:last-child),
1820 #blanket-implementations-list .impl-items > .toggle:not(:last-child) {
1824 /* Begin: styles for --scrape-examples feature */
1826 .scraped-example-list .scrape-help {
1829 font-weight: normal;
1833 border: 1px solid var(--scrape-example-help-border-color);
1834 border-radius: 50px;
1835 color: var(--scrape-example-help-color);
1837 .scraped-example-list .scrape-help:hover {
1838 border-color: var(--scrape-example-help-hover-border-color);
1839 color: var(--scrape-example-help-hover-color);
1843 /* So .scraped-example-title can be positioned absolutely */
1847 .scraped-example .code-wrapper {
1850 flex-direction: row;
1855 .scraped-example:not(.expanded) .code-wrapper {
1856 /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
1857 * of lines shown in the un-expanded example code viewer. This pre needs to have
1858 * a max-height equal to line-height * N. The line-height is currently 1.5em,
1859 * and we include additional 10px for padding. */
1860 max-height: calc(1.5em * 5 + 10px);
1863 .scraped-example:not(.expanded) .code-wrapper pre {
1866 /* See above comment, should be the same max-height. */
1867 max-height: calc(1.5em * 5 + 10px);
1870 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,
1871 .more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre {
1872 /* See above comment, except this height is based on HIDDEN_MAX_LINES. */
1873 max-height: calc(1.5em * 10 + 10px);
1876 .scraped-example .code-wrapper .next,
1877 .scraped-example .code-wrapper .prev,
1878 .scraped-example .code-wrapper .expand {
1879 color: var(--main-color);
1886 /* iOS button gradient: https://stackoverflow.com/q/5438567 */
1887 -webkit-appearance: none;
1890 .scraped-example .code-wrapper .prev {
1893 .scraped-example .code-wrapper .next {
1896 .scraped-example .code-wrapper .expand {
1900 .scraped-example:not(.expanded) .code-wrapper:before,
1901 .scraped-example:not(.expanded) .code-wrapper:after {
1908 .scraped-example:not(.expanded) .code-wrapper:before {
1911 .scraped-example:not(.expanded) .code-wrapper:after {
1915 .scraped-example .code-wrapper .example-wrap {
1921 .scraped-example:not(.expanded) .code-wrapper .example-wrap {
1925 .scraped-example .example-wrap .rust span.highlight {
1926 background: var(--scrape-example-code-line-highlight);
1928 .scraped-example .example-wrap .rust span.highlight.focus {
1929 background: var(--scrape-example-code-line-highlight-focus);
1932 .more-examples-toggle {
1933 max-width: calc(100% + 25px);
1938 .more-examples-toggle .hide-more {
1943 .more-scraped-examples {
1952 right: calc(100% + 10px);
1957 .toggle-line-inner {
1960 background: var(--scrape-example-toggle-line-background);
1963 .toggle-line:hover .toggle-line-inner {
1964 background: var(--scrape-example-toggle-line-hover-background);
1967 .more-scraped-examples .scraped-example, .example-links {
1971 .more-scraped-examples .scraped-example:first-child {
1979 /* End: styles for --scrape-examples feature */