@@ -256,6 +256,9 @@ pub struct Cache {
256
256
// the access levels from crateanalysis.
257
257
pub access_levels : Arc < AccessLevels < DefId > > ,
258
258
259
+ /// The version of the crate being documented, if given fron the `--crate-version` flag.
260
+ pub crate_version : Option < String > ,
261
+
259
262
// Private fields only used when initially crawling a crate to build a cache
260
263
261
264
stack : Vec < String > ,
@@ -534,6 +537,7 @@ pub fn run(mut krate: clean::Crate,
534
537
primitive_locations : FxHashMap ( ) ,
535
538
stripped_mod : false ,
536
539
access_levels : krate. access_levels . clone ( ) ,
540
+ crate_version : krate. version . take ( ) ,
537
541
orphan_impl_items : Vec :: new ( ) ,
538
542
traits : mem:: replace ( & mut krate. external_traits , FxHashMap ( ) ) ,
539
543
deref_trait_did,
@@ -3422,6 +3426,16 @@ impl<'a> fmt::Display for Sidebar<'a> {
3422
3426
write ! ( fmt, "{}" , it. name. as_ref( ) . unwrap( ) ) ?;
3423
3427
write ! ( fmt, "</p>" ) ?;
3424
3428
3429
+ if it. is_crate ( ) {
3430
+ if let Some ( ref version) = cache ( ) . crate_version {
3431
+ write ! ( fmt,
3432
+ "<div class='block version'>\
3433
+ <p>Version {}</p>\
3434
+ </div>",
3435
+ version) ?;
3436
+ }
3437
+ }
3438
+
3425
3439
match it. inner {
3426
3440
clean:: StructItem ( ref s) => sidebar_struct ( fmt, it, s) ?,
3427
3441
clean:: TraitItem ( ref t) => sidebar_trait ( fmt, it, t) ?,
0 commit comments