/* When static files are updated, their suffixes need to be updated. 1. In the top directory run: ./x.py doc --stage 1 library/core 2. Find the directory containing files named with updated suffixes: find build -path '*'/stage1-std/'*'/static.files 3. Copy the filenames with updated suffixes from the directory. */ :root { --nav-sub-mobile-padding: 8px; --search-typename-width: 6.75rem; } /* See FiraSans-LICENSE.txt for the Fira Sans license. */ @font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 400; src: local('Fira Sans'), url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 500; src: local('Fira Sans Medium'), url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2"); font-display: swap; } /* See SourceSerif4-LICENSE.md for the Source Serif 4 license. */ @font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400; src: local('Source Serif 4'), url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Source Serif 4'; font-style: italic; font-weight: 400; src: local('Source Serif 4 Italic'), url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 700; src: local('Source Serif 4 Bold'), url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2"); font-display: swap; } /* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */ @font-face { font-family: 'Source Code Pro'; font-style: normal; font-weight: 400; /* Avoid using locally installed font because bad versions are in circulation: * see https://github.com/rust-lang/rust/issues/24355 */ src: url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Source Code Pro'; font-style: italic; font-weight: 400; src: url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Source Code Pro'; font-style: normal; font-weight: 600; src: url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2"); font-display: swap; } /* Avoid using legacy CJK serif fonts in Windows like Batang. */ @font-face { font-family: 'NanumBarunGothic'; src: url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2"); font-display: swap; unicode-range: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF; } * { box-sizing: border-box; } /* General structure and fonts */ body { /* Line spacing at least 1.5 per Web Content Accessibility Guidelines https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */ font: 1rem/1.5 "Source Serif 4", NanumBarunGothic, serif; margin: 0; position: relative; /* We use overflow-wrap: break-word for Safari, which doesn't recognize `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */ overflow-wrap: break-word; /* Then override it with `anywhere`, which is required to make non-Safari browsers break more aggressively when we want them to. */ overflow-wrap: anywhere; font-feature-settings: "kern", "liga"; background-color: var(--main-background-color); color: var(--main-color); } h1 { font-size: 1.5rem; /* 24px */ } h2 { font-size: 1.375rem; /* 22px */ } h3 { font-size: 1.25rem; /* 20px */ } h1, h2, h3, h4, h5, h6 { font-weight: 500; } h1, h2, h3, h4 { margin: 25px 0 15px 0; padding-bottom: 6px; } .docblock h3, .docblock h4, h5, h6 { margin: 15px 0 5px 0; } .docblock > h2:first-child, .docblock > h3:first-child, .docblock > h4:first-child, .docblock > h5:first-child, .docblock > h6:first-child { margin-top: 0; } .main-heading h1 { margin: 0; padding: 0; flex-grow: 1; /* We use overflow-wrap: break-word for Safari, which doesn't recognize `anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */ overflow-wrap: break-word; /* Then override it with `anywhere`, which is required to make non-Safari browsers break more aggressively when we want them to. */ overflow-wrap: anywhere; } .main-heading { display: flex; flex-wrap: wrap; padding-bottom: 6px; margin-bottom: 15px; } /* The only headings that get underlines are: Markdown-generated headings within the top-doc Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc) Underlines elsewhere in the documentation break up visual flow and tend to invert section hierarchies. */ .content h2, .top-doc .docblock > h3, .top-doc .docblock > h4 { border-bottom: 1px solid var(--headings-border-bottom-color); } /* while line-height 1.5 is required for any "block of text", which WCAG defines as more than one sentence, it looks weird for very large main headers */ h1, h2 { line-height: 1.25; padding-top: 3px; padding-bottom: 9px; } h3.code-header { font-size: 1.125rem; /* 18px */ } h4.code-header { font-size: 1rem; } .code-header { font-weight: 600; margin: 0; padding: 0; white-space: pre-wrap; } #crate-search, h1, h2, h3, h4, h5, h6, .sidebar, .mobile-topbar, .search-input, .search-results .result-name, .item-name > a, .out-of-band, span.since, a.src, #help-button > a, summary.hideme, .scraped-example-list, /* This selector is for the items listed in the "all items" page. */ ul.all-items { font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif; } #toggle-all-docs, a.anchor, .small-section-header a, #src-sidebar a, .rust a, .sidebar h2 a, .sidebar h3 a, .mobile-topbar h2 a, h1 a, .search-results a, .stab, .result-name i { color: var(--main-color); } span.enum, a.enum, span.struct, a.struct, span.union, a.union, span.primitive, a.primitive, span.type, a.type, span.foreigntype, a.foreigntype { color: var(--type-link-color); } span.trait, a.trait, span.traitalias, a.traitalias { color: var(--trait-link-color); } span.associatedtype, a.associatedtype, span.constant, a.constant, span.static, a.static { color: var(--assoc-item-link-color); } span.fn, a.fn, span.method, a.method, span.tymethod, a.tymethod { color: var(--function-link-color); } span.attr, a.attr, span.derive, a.derive, span.macro, a.macro { color: var(--macro-link-color); } span.mod, a.mod { color: var(--mod-link-color); } span.keyword, a.keyword { color: var(--keyword-link-color); } a { color: var(--link-color); text-decoration: none; } ol, ul { padding-left: 24px; } ul ul, ol ul, ul ol, ol ol { margin-bottom: .625em; } p, .docblock > .warning { /* Paragraph spacing at least 1.5 times line spacing per Web Content Accessibility Guidelines. Line-height is 1.5rem, so line spacing is .5rem; .75em is 1.5 times that. https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */ margin: 0 0 .75em 0; } /* For the last child of a div, the margin will be taken care of by the margin-top of the next item. */ p:last-child, .docblock > .warning:last-child { margin: 0; } /* Fix some style changes due to normalize.css 8 */ button { /* Buttons on Safari have different default padding than other platforms. Make them the same. */ padding: 1px 6px; /* Opinionated tweak: use pointer cursor as clickability signifier. */ cursor: pointer; } /* end tweaks for normalize.css 8 */ button#toggle-all-docs { padding: 0; background: none; border: none; /* iOS button gradient: https://stackoverflow.com/q/5438567 */ -webkit-appearance: none; opacity: 1; } .rustdoc { display: flex; flex-direction: row; flex-wrap: nowrap; } main { position: relative; flex-grow: 1; padding: 10px 15px 40px 45px; min-width: 0; /* avoid growing beyond the size limit */ } .src main { padding: 15px; } .width-limiter { max-width: 960px; margin-right: auto; } details:not(.toggle) summary { margin-bottom: .6em; } code, pre, a.test-arrow, .code-header { font-family: "Source Code Pro", monospace; } .docblock code, .docblock-short code { border-radius: 3px; padding: 0 0.125em; } .docblock pre code, .docblock-short pre code { padding: 0; } pre { padding: 14px; line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */ } pre.item-decl { overflow-x: auto; } /* This rule allows to have scrolling on the X axis. */ .item-decl .type-contents-toggle { contain: initial; } .src .content pre { padding: 20px; } .rustdoc.src .example-wrap pre.src-line-numbers { padding: 20px 0 20px 4px; } img { max-width: 100%; } .sub-logo-container, .logo-container { /* zero text boxes so that computed line height = image height exactly */ line-height: 0; display: block; } .sub-logo-container { margin-right: 32px; } .sub-logo-container > img { height: 60px; width: 60px; object-fit: contain; } .rust-logo { filter: var(--rust-logo-filter); } .sidebar { font-size: 0.875rem; flex: 0 0 200px; overflow-y: scroll; overscroll-behavior: contain; position: sticky; height: 100vh; top: 0; left: 0; } .rustdoc.src .sidebar { flex-basis: 50px; border-right: 1px solid; overflow-x: hidden; /* The sidebar is by default hidden */ overflow-y: hidden; z-index: 1; } .sidebar, .mobile-topbar, .sidebar-menu-toggle, #src-sidebar-toggle, #src-sidebar { background-color: var(--sidebar-background-color); } #src-sidebar-toggle > button:hover, #src-sidebar-toggle > button:focus { background-color: var(--sidebar-background-color-hover); } .src .sidebar > *:not(#src-sidebar-toggle) { visibility: hidden; } .src-sidebar-expanded .src .sidebar { overflow-y: auto; flex-basis: 300px; } .src-sidebar-expanded .src .sidebar > *:not(#src-sidebar-toggle) { visibility: visible; } #all-types { margin-top: 1em; } /* Improve the scrollbar display on firefox */ * { scrollbar-width: initial; scrollbar-color: var(--scrollbar-color); } .sidebar { scrollbar-width: thin; scrollbar-color: var(--scrollbar-color); } /* Improve the scrollbar display on webkit-based browsers */ ::-webkit-scrollbar { width: 12px; } .sidebar::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0; background-color: var(--scrollbar-track-background-color); } .sidebar::-webkit-scrollbar-track { background-color: var(--scrollbar-track-background-color); } ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background-color: var(--scrollbar-thumb-background-color); } /* Everything else */ .hidden { display: none !important; } .sidebar .logo-container { margin-top: 10px; margin-bottom: 10px; text-align: center; } .version { overflow-wrap: break-word; } .logo-container > img { height: 100px; width: 100px; } ul.block, .block li { padding: 0; margin: 0; list-style: none; } .sidebar-elems a, .sidebar > h2 a { display: block; padding: 0.25rem; /* 4px */ margin-left: -0.25rem; } .sidebar h2 { overflow-wrap: anywhere; padding: 0; margin: 0.7rem 0; } .sidebar h3 { font-size: 1.125rem; /* 18px */ padding: 0; margin: 0; } .sidebar-elems, .sidebar > h2 { padding-left: 24px; } .sidebar a { color: var(--sidebar-link-color); } .sidebar .current, .sidebar a:hover:not(.logo-container) { background-color: var(--sidebar-current-link-background-color); } .sidebar-elems .block { margin-bottom: 2em; } .sidebar-elems .block li a { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .mobile-topbar { display: none; } .rustdoc .example-wrap { display: flex; position: relative; margin-bottom: 10px; } /* For the last child of a div, the margin will be taken care of by the margin-top of the next item. */ .rustdoc .example-wrap:last-child { margin-bottom: 0px; } .rustdoc .example-wrap pre { margin: 0; flex-grow: 1; } .rustdoc:not(.src) .example-wrap pre { overflow: auto hidden; } .rustdoc .example-wrap pre.example-line-numbers, .rustdoc .example-wrap pre.src-line-numbers { flex-grow: 0; min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */ overflow: initial; text-align: right; -webkit-user-select: none; user-select: none; padding: 14px 8px; color: var(--src-line-numbers-span-color); } .rustdoc .example-wrap pre.src-line-numbers { padding: 14px 0; } .src-line-numbers a, .src-line-numbers span { color: var(--src-line-numbers-span-color); padding: 0 8px; } .src-line-numbers :target { background-color: transparent; border-right: none; padding: 0 8px; } .src-line-numbers .line-highlighted { background-color: var(--src-line-number-highlighted-background-color); } .search-loading { text-align: center; } .docblock-short { overflow-wrap: break-word; overflow-wrap: anywhere; } /* Wrap non-pre code blocks (`text`) but not (```text```). */ .docblock :not(pre) > code, .docblock-short code { white-space: pre-wrap; } .top-doc .docblock h2 { font-size: 1.375rem; } .top-doc .docblock h3 { font-size: 1.25rem; } .top-doc .docblock h4, .top-doc .docblock h5 { font-size: 1.125rem; } .top-doc .docblock h6 { font-size: 1rem; } .docblock h5 { font-size: 1rem; } .docblock h6 { font-size: 0.875rem; } .docblock { margin-left: 24px; position: relative; } .docblock > :not(.more-examples-toggle):not(.example-wrap) { max-width: 100%; overflow-x: auto; } .out-of-band { flex-grow: 0; font-size: 1.125rem; } .docblock code, .docblock-short code, pre, .rustdoc.src .example-wrap { background-color: var(--code-block-background-color); } #main-content { position: relative; } .docblock table { margin: .5em 0; border-collapse: collapse; } .docblock table td, .docblock table th { padding: .5em; border: 1px solid var(--border-color); } .docblock table tbody tr:nth-child(2n) { background: var(--table-alt-row-background-color); } /* Shift "where ..." part of method or fn definition down a line */ .method .where, .fn .where, .where.fmt-newline { display: block; white-space: pre-wrap; font-size: 0.875rem; } .item-info { display: block; margin-left: 24px; } .item-info code { font-size: 0.875rem; } #main-content > .item-info { margin-left: 0; } nav.sub { flex-grow: 1; flex-flow: row nowrap; margin: 4px 0 25px 0; display: flex; align-items: center; } .search-form { position: relative; display: flex; height: 34px; flex-grow: 1; } .src nav.sub { margin: 0 0 15px 0; } .small-section-header { /* fields use tags, but should get their own lines */ display: block; position: relative; } .small-section-header:hover > .anchor, .impl:hover > .anchor, .trait-impl:hover > .anchor, .variant:hover > .anchor { display: initial; } .anchor { display: none; position: absolute; left: -0.5em; background: none !important; } .anchor.field { left: -5px; } .small-section-header > .anchor { left: -15px; padding-right: 8px; } h2.small-section-header > .anchor { padding-right: 6px; } .main-heading a:hover, .example-wrap .rust a:hover, .all-items a:hover, .docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, .docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, .item-info a { text-decoration: underline; } .crate.block a.current { font-weight: 500; } /* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap as much as needed on mobile (see tests/rustdoc-gui/type-declaration-overflow.goml for an example of why this matters). The `anywhere` value means: "Soft wrap opportunities introduced by the word break are considered when calculating min-content intrinsic sizes." https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#values For table layouts, that becomes a problem: the browser tries to make each column as narrow as possible, and `overflow-wrap: anywhere` means it can do so by breaking words - even if some other column could be shrunk without breaking words! This shows up, for instance, in the `Structs` / `Modules` / `Functions` (etcetera) sections of a module page, and when a docblock contains a table. So, for table layouts, override the default with break-word, which does _not_ affect min-content intrinsic sizes. */ table, .item-table { overflow-wrap: break-word; } .item-table { display: table; padding: 0; margin: 0; } .item-table > li { display: table-row; } .item-table > li > div { display: table-cell; } .item-table > li > .item-name { padding-right: 1.25rem; } .search-results-title { margin-top: 0; white-space: nowrap; /* flex layout allows shrinking the -element "#crate-search") to be shrunk */ min-width: 5em; } #crate-search { min-width: 115px; padding: 0 23px 0 4px; /* prevents the