mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Use #[doc(fake_variadic)]
on StableInterpolate
(#15933)
This is a follow-up to #15931 that adds `#[doc(fake_variadic)]` for improved docs output :)
This commit is contained in:
parent
5157fef84b
commit
ed351294ec
2 changed files with 26 additions and 1 deletions
|
@ -310,8 +310,31 @@ impl StableInterpolate for Dir3A {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you're confused about how #[doc(fake_variadic)] works,
|
||||||
|
// then the `all_tuples` macro is nicely documented (it can be found in the `bevy_utils` crate).
|
||||||
|
// tl;dr: `#[doc(fake_variadic)]` goes on the impl of tuple length one.
|
||||||
|
// the others have to be hidden using `#[doc(hidden)]`.
|
||||||
macro_rules! impl_stable_interpolate_tuple {
|
macro_rules! impl_stable_interpolate_tuple {
|
||||||
|
(($T:ident, $n:tt)) => {
|
||||||
|
impl_stable_interpolate_tuple! {
|
||||||
|
@impl
|
||||||
|
#[cfg_attr(any(docsrs, docsrs_dep), doc(fake_variadic))]
|
||||||
|
#[cfg_attr(
|
||||||
|
any(docsrs, docsrs_dep),
|
||||||
|
doc = "This trait is implemented for tuples up to 11 items long."
|
||||||
|
)]
|
||||||
|
($T, $n)
|
||||||
|
}
|
||||||
|
};
|
||||||
($(($T:ident, $n:tt)),*) => {
|
($(($T:ident, $n:tt)),*) => {
|
||||||
|
impl_stable_interpolate_tuple! {
|
||||||
|
@impl
|
||||||
|
#[cfg_attr(any(docsrs, docsrs_dep), doc(hidden))]
|
||||||
|
$(($T, $n)),*
|
||||||
|
}
|
||||||
|
};
|
||||||
|
(@impl $(#[$($meta:meta)*])* $(($T:ident, $n:tt)),*) => {
|
||||||
|
$(#[$($meta)*])*
|
||||||
impl<$($T: StableInterpolate),*> StableInterpolate for ($($T,)*) {
|
impl<$($T: StableInterpolate),*> StableInterpolate for ($($T,)*) {
|
||||||
fn interpolate_stable(&self, other: &Self, t: f32) -> Self {
|
fn interpolate_stable(&self, other: &Self, t: f32) -> Self {
|
||||||
(
|
(
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
#![allow(internal_features)]
|
||||||
|
#![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))]
|
||||||
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://bevyengine.org/assets/icon.png",
|
html_logo_url = "https://bevyengine.org/assets/icon.png",
|
||||||
html_favicon_url = "https://bevyengine.org/assets/icon.png"
|
html_favicon_url = "https://bevyengine.org/assets/icon.png"
|
||||||
|
|
Loading…
Reference in a new issue