Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/components/crate-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
{{svg-jar "rust"}}
<span>
v{{@version.msrv}}
<EmberTooltip @text="Minimum Supported Rust Version" />

<EmberTooltip>
&quot;Minimum Supported Rust Version&quot;
{{#if @version.edition}}
<div local-class="edition">requires Rust Edition {{@version.edition}}</div>
{{/if}}
</EmberTooltip>
</span>
</div>
{{/if}}
Expand Down
4 changes: 4 additions & 0 deletions app/components/crate-sidebar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
}
}

.edition {
margin-top: var(--space-2xs);
}

.license {
a {
color: var(--main-color);
Expand Down
7 changes: 7 additions & 0 deletions app/components/version-list/row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@
<span local-class="msrv">
{{svg-jar "rust"}}
v{{@version.msrv}}

<EmberTooltip>
&quot;Minimum Supported Rust Version&quot;
{{#if @version.edition}}
<div local-class="edition">requires Rust Edition {{@version.edition}}</div>
{{/if}}
</EmberTooltip>
</span>
{{/if}}

Expand Down
12 changes: 8 additions & 4 deletions app/components/version-list/row.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
z-index: 1;
cursor: help;
}

:global(.ember-tooltip) {
word-break: break-all;
}
}

.version {
display: grid;
grid-template-columns: auto auto;
place-items: center;

:global(.ember-tooltip) {
word-break: break-all;
}

@media only screen and (max-width: 550px) {
grid-template-columns: auto;
margin: 0 var(--space-s);
Expand Down Expand Up @@ -212,6 +212,10 @@
}
}

.edition {
margin-top: var(--space-2xs);
}

.bytes {
font-variant-numeric: tabular-nums;
text-transform: none;
Expand Down
16 changes: 14 additions & 2 deletions app/models/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export default class Version extends Model {
*/
@attr rust_version;

/**
* The Rust edition required to compile this crate version.
* @type {string | null}
*/
@attr edition;

/** @type {boolean | null} */
@attr has_lib;
/** @type {string[] | null} */
Expand All @@ -46,8 +52,14 @@ export default class Version extends Model {

get msrv() {
let rustVersion = this.rust_version;
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
if (rustVersion) {
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
} else if (this.edition === '2018') {
return '1.31.0';
} else if (this.edition === '2021') {
return '1.56.0';
}
}

get isNew() {
Expand Down
1 change: 1 addition & 0 deletions app/styles/application.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,6 @@ noscript {
}

:global(.ember-tooltip) {
max-width: 300px;
font-weight: normal;
}
Loading