/src/test/rustdoc/sidebar-items.rs

https://gitlab.com/jianglu/rust · Rust · 59 lines · 21 code · 6 blank · 32 comment · 0 complexity · 7282e96b1144be0f8de4ee6a8922b58d MD5 · raw file

  1. // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // http://rust-lang.org/COPYRIGHT.
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. #![crate_name = "foo"]
  11. // @has foo/trait.Foo.html
  12. // @has - '//*[@class="sidebar-title"][@href="#required-methods"]' 'Required Methods'
  13. // @has - '//*[@class="sidebar-links"]/a' 'bar'
  14. // @has - '//*[@class="sidebar-title"][@href="#provided-methods"]' 'Provided Methods'
  15. // @has - '//*[@class="sidebar-links"]/a' 'foo'
  16. // @has - '//*[@class="sidebar-title"][@href="#associated-const"]' 'Associated Constants'
  17. // @has - '//*[@class="sidebar-links"]/a' 'BAR'
  18. // @has - '//*[@class="sidebar-title"][@href="#associated-types"]' 'Associated Types'
  19. // @has - '//*[@class="sidebar-links"]/a' 'Output'
  20. pub trait Foo {
  21. const BAR: u32 = 0;
  22. type Output: ?Sized;
  23. fn foo() {}
  24. fn bar() -> Self::Output;
  25. }
  26. // @has foo/struct.Bar.html
  27. // @has - '//*[@class="sidebar-title"][@href="#fields"]' 'Fields'
  28. // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f"]' 'f'
  29. // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.u"]' 'u'
  30. // @!has - '//*[@class="sidebar-links"]/a' 'w'
  31. pub struct Bar {
  32. pub f: u32,
  33. pub u: u32,
  34. w: u32,
  35. }
  36. // @has foo/enum.En.html
  37. // @has - '//*[@class="sidebar-title"][@href="#variants"]' 'Variants'
  38. // @has - '//*[@class="sidebar-links"]/a' 'foo'
  39. // @has - '//*[@class="sidebar-links"]/a' 'bar'
  40. pub enum En {
  41. foo,
  42. bar,
  43. }
  44. // @has foo/union.MyUnion.html
  45. // @has - '//*[@class="sidebar-title"][@href="#fields"]' 'Fields'
  46. // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f1"]' 'f1'
  47. // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f2"]' 'f2'
  48. // @!has - '//*[@class="sidebar-links"]/a' 'w'
  49. pub union MyUnion {
  50. pub f1: u32,
  51. pub f2: f32,
  52. w: u32,
  53. }