Documentation for variadics (#15387)
# Objective Relevant: #15208 ## Solution I went ahead and added the variadics documentation in all applicable locations. ## Testing - I built the documentation and inspected it to see whether the feature is there.
This commit is contained in:
parent
461305b3d7
commit
c841dd92a1
@ -1,4 +1,6 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
// `rustdoc_internals` is needed for `#[doc(fake_variadics)]`
|
||||||
|
#![allow(internal_features)]
|
||||||
|
#![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![doc(
|
#![doc(
|
||||||
html_logo_url = "https://bevyengine.org/assets/icon.png",
|
html_logo_url = "https://bevyengine.org/assets/icon.png",
|
||||||
|
@ -162,7 +162,8 @@ mod sealed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_plugins_tuples {
|
macro_rules! impl_plugins_tuples {
|
||||||
($(($param: ident, $plugins: ident)),*) => {
|
($(#[$meta:meta])* $(($param: ident, $plugins: ident)),*) => {
|
||||||
|
$(#[$meta])*
|
||||||
impl<$($param, $plugins),*> Plugins<(PluginsTupleMarker, $($param,)*)> for ($($plugins,)*)
|
impl<$($param, $plugins),*> Plugins<(PluginsTupleMarker, $($param,)*)> for ($($plugins,)*)
|
||||||
where
|
where
|
||||||
$($plugins: Plugins<$param>),*
|
$($plugins: Plugins<$param>),*
|
||||||
@ -179,5 +180,12 @@ mod sealed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
all_tuples!(impl_plugins_tuples, 0, 15, P, S);
|
all_tuples!(
|
||||||
|
#[doc(fake_variadic)]
|
||||||
|
impl_plugins_tuples,
|
||||||
|
0,
|
||||||
|
15,
|
||||||
|
P,
|
||||||
|
S
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -287,6 +287,7 @@ macro_rules! tuple_impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(#[$meta])*
|
||||||
impl<$($name: Bundle),*> DynamicBundle for ($($name,)*) {
|
impl<$($name: Bundle),*> DynamicBundle for ($($name,)*) {
|
||||||
#[allow(unused_variables, unused_mut)]
|
#[allow(unused_variables, unused_mut)]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -2014,7 +2014,6 @@ pub struct AnyOf<T>(PhantomData<T>);
|
|||||||
|
|
||||||
macro_rules! impl_tuple_query_data {
|
macro_rules! impl_tuple_query_data {
|
||||||
($(#[$meta:meta])* $(($name: ident, $state: ident)),*) => {
|
($(#[$meta:meta])* $(($name: ident, $state: ident)),*) => {
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[allow(clippy::unused_unit)]
|
#[allow(clippy::unused_unit)]
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
@ -2023,6 +2022,7 @@ macro_rules! impl_tuple_query_data {
|
|||||||
type ReadOnly = ($($name::ReadOnly,)*);
|
type ReadOnly = ($($name::ReadOnly,)*);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(#[$meta])*
|
||||||
/// SAFETY: each item in the tuple is read only
|
/// SAFETY: each item in the tuple is read only
|
||||||
unsafe impl<$($name: ReadOnlyQueryData),*> ReadOnlyQueryData for ($($name,)*) {}
|
unsafe impl<$($name: ReadOnlyQueryData),*> ReadOnlyQueryData for ($($name,)*) {}
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@
|
|||||||
//! [the language feature for dyn upcasting coercion]: https://github.com/rust-lang/rust/issues/65991
|
//! [the language feature for dyn upcasting coercion]: https://github.com/rust-lang/rust/issues/65991
|
||||||
//! [derive macro]: derive@crate::Reflect
|
//! [derive macro]: derive@crate::Reflect
|
||||||
//! [`'static` lifetime]: https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html#trait-bound
|
//! [`'static` lifetime]: https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html#trait-bound
|
||||||
//! [`Function`]: func::Function
|
//! [`Function`]: crate::func::Function
|
||||||
//! [derive macro documentation]: derive@crate::Reflect
|
//! [derive macro documentation]: derive@crate::Reflect
|
||||||
//! [deriving `Reflect`]: derive@crate::Reflect
|
//! [deriving `Reflect`]: derive@crate::Reflect
|
||||||
//! [type data]: TypeData
|
//! [type data]: TypeData
|
||||||
|
@ -676,6 +676,7 @@ impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J,
|
|||||||
|
|
||||||
macro_rules! impl_type_path_tuple {
|
macro_rules! impl_type_path_tuple {
|
||||||
($(#[$meta:meta])*) => {
|
($(#[$meta:meta])*) => {
|
||||||
|
$(#[$meta])*
|
||||||
impl TypePath for () {
|
impl TypePath for () {
|
||||||
fn type_path() -> &'static str {
|
fn type_path() -> &'static str {
|
||||||
"()"
|
"()"
|
||||||
@ -737,29 +738,50 @@ all_tuples!(
|
|||||||
#[cfg(feature = "functions")]
|
#[cfg(feature = "functions")]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
macro_rules! impl_get_ownership_tuple {
|
macro_rules! impl_get_ownership_tuple {
|
||||||
($($name: ident),*) => {
|
($(#[$meta:meta])* $($name: ident),*) => {
|
||||||
|
$(#[$meta])*
|
||||||
$crate::func::args::impl_get_ownership!(($($name,)*); <$($name),*>);
|
$crate::func::args::impl_get_ownership!(($($name,)*); <$($name),*>);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
all_tuples!(impl_get_ownership_tuple, 0, 12, P);
|
all_tuples!(
|
||||||
|
#[doc(fake_variadic)]
|
||||||
|
impl_get_ownership_tuple,
|
||||||
|
0,
|
||||||
|
12,
|
||||||
|
P
|
||||||
|
);
|
||||||
|
|
||||||
macro_rules! impl_from_arg_tuple {
|
macro_rules! impl_from_arg_tuple {
|
||||||
($($name: ident),*) => {
|
($(#[$meta:meta])* $($name: ident),*) => {
|
||||||
|
$(#[$meta])*
|
||||||
$crate::func::args::impl_from_arg!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
|
$crate::func::args::impl_from_arg!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
all_tuples!(impl_from_arg_tuple, 0, 12, P);
|
all_tuples!(
|
||||||
|
#[doc(fake_variadic)]
|
||||||
|
impl_from_arg_tuple,
|
||||||
|
0,
|
||||||
|
12,
|
||||||
|
P
|
||||||
|
);
|
||||||
|
|
||||||
macro_rules! impl_into_return_tuple {
|
macro_rules! impl_into_return_tuple {
|
||||||
($($name: ident),+) => {
|
($(#[$meta:meta])* $($name: ident),+) => {
|
||||||
|
$(#[$meta])*
|
||||||
$crate::func::impl_into_return!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
|
$crate::func::impl_into_return!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// The unit type (i.e. `()`) is special-cased, so we skip implementing it here.
|
// The unit type (i.e. `()`) is special-cased, so we skip implementing it here.
|
||||||
all_tuples!(impl_into_return_tuple, 1, 12, P);
|
all_tuples!(
|
||||||
|
#[doc(fake_variadic)]
|
||||||
|
impl_into_return_tuple,
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
P
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user