2018-07-12 15:00:57 -05:00
|
|
|
#![crate_name = "foo"]
|
|
|
|
|
2020-05-22 04:50:22 -05:00
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/index.html '//a/@href' 'struct.Foo.html#method.new'
|
|
|
|
//@ has foo/struct.Foo.html '//a/@href' 'struct.Foo.html#method.new'
|
2018-07-12 15:00:57 -05:00
|
|
|
|
|
|
|
/// Use [`new`] to create a new instance.
|
|
|
|
///
|
|
|
|
/// [`new`]: Self::new
|
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
pub fn new() -> Self {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/index.html '//a/@href' 'struct.Bar.html#method.new2'
|
|
|
|
//@ has foo/struct.Bar.html '//a/@href' 'struct.Bar.html#method.new2'
|
2018-07-12 15:00:57 -05:00
|
|
|
|
|
|
|
/// Use [`new2`] to create a new instance.
|
|
|
|
///
|
|
|
|
/// [`new2`]: Self::new2
|
|
|
|
pub struct Bar;
|
|
|
|
|
|
|
|
impl Bar {
|
|
|
|
pub fn new2() -> Self {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
pub struct MyStruct {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.MyStruct.html '//a/@href' 'struct.MyStruct.html#structfield.struct_field'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`struct_field`]
|
|
|
|
///
|
|
|
|
/// [`struct_field`]: Self::struct_field
|
|
|
|
pub struct_field: u8,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum MyEnum {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/enum.MyEnum.html '//a/@href' 'enum.MyEnum.html#variant.EnumVariant'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`EnumVariant`]
|
|
|
|
///
|
|
|
|
/// [`EnumVariant`]: Self::EnumVariant
|
|
|
|
EnumVariant,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub union MyUnion {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/union.MyUnion.html '//a/@href' 'union.MyUnion.html#structfield.union_field'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`union_field`]
|
|
|
|
///
|
|
|
|
/// [`union_field`]: Self::union_field
|
|
|
|
pub union_field: f32,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait MyTrait {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/trait.MyTrait.html '//a/@href' 'trait.MyTrait.html#associatedtype.AssoType'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`AssoType`]
|
|
|
|
///
|
|
|
|
/// [`AssoType`]: Self::AssoType
|
|
|
|
type AssoType;
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/trait.MyTrait.html '//a/@href' 'trait.MyTrait.html#associatedconstant.ASSO_CONST'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`ASSO_CONST`]
|
|
|
|
///
|
|
|
|
/// [`ASSO_CONST`]: Self::ASSO_CONST
|
|
|
|
const ASSO_CONST: i32 = 1;
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/trait.MyTrait.html '//a/@href' 'trait.MyTrait.html#method.asso_fn'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`asso_fn`]
|
|
|
|
///
|
|
|
|
/// [`asso_fn`]: Self::asso_fn
|
|
|
|
fn asso_fn() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MyStruct {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.MyStruct.html '//a/@href' 'struct.MyStruct.html#method.for_impl'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`for_impl`]
|
|
|
|
///
|
|
|
|
/// [`for_impl`]: Self::for_impl
|
|
|
|
pub fn for_impl() {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MyTrait for MyStruct {
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.MyStruct.html '//a/@href' 'struct.MyStruct.html#associatedtype.AssoType'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`AssoType`]
|
|
|
|
///
|
|
|
|
/// [`AssoType`]: Self::AssoType
|
|
|
|
type AssoType = u32;
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.MyStruct.html '//a/@href' 'struct.MyStruct.html#associatedconstant.ASSO_CONST'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`ASSO_CONST`]
|
|
|
|
///
|
|
|
|
/// [`ASSO_CONST`]: Self::ASSO_CONST
|
|
|
|
const ASSO_CONST: i32 = 10;
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/struct.MyStruct.html '//a/@href' 'struct.MyStruct.html#method.asso_fn'
|
2020-05-22 04:50:22 -05:00
|
|
|
|
|
|
|
/// [`asso_fn`]
|
|
|
|
///
|
|
|
|
/// [`asso_fn`]: Self::asso_fn
|
|
|
|
fn asso_fn() {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|