mirror of
https://github.com/bevyengine/bevy
synced 2024-11-24 21:53:07 +00:00
Inverse missing_docs
logic (#11676)
# Objective Currently the `missing_docs` lint is allowed-by-default and enabled at crate level when their documentations is complete (see #3492). This PR proposes to inverse this logic by making `missing_docs` warn-by-default and mark crates with imcomplete docs allowed. ## Solution Makes `missing_docs` warn at workspace level and allowed at crate level when the docs is imcomplete.
This commit is contained in:
parent
55493a823e
commit
694c06f3d0
85 changed files with 149 additions and 123 deletions
|
@ -42,6 +42,7 @@ map_flatten = "warn"
|
|||
|
||||
[workspace.lints.rust]
|
||||
unsafe_op_in_unsafe_fn = "warn"
|
||||
missing_docs = "warn"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//! Accessibility for Bevy
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
use std::sync::{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! Animation for the game engine Bevy
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod animatable;
|
||||
mod util;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! This crate is about everything concerning the highest-level, application layer of a Bevy app.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod app;
|
||||
mod main_schedule;
|
||||
mod plugin;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use bevy_macro_utils::BevyManifest;
|
||||
use proc_macro::{Span, TokenStream};
|
||||
use quote::{format_ident, quote};
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub mod io;
|
||||
pub mod meta;
|
||||
pub mod processor;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
//! ```
|
||||
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod audio;
|
||||
mod audio_output;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
|
||||
//! This crate provides core functionality for Bevy Engine.
|
||||
|
||||
mod name;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub mod blit;
|
||||
pub mod bloom;
|
||||
pub mod contrast_adaptive_sharpening;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
mod app_plugin;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
//! This crate provides a straightforward solution for integrating diagnostics in the [Bevy game engine](https://bevyengine.org/).
|
||||
//! It allows users to easily add diagnostic functionality to their Bevy applications, enhancing
|
||||
//! their ability to monitor and optimize their game's.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
#![allow(clippy::single_component_path_imports)]
|
||||
|
||||
//! Forces dynamic linking of Bevy.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// FIXME(11590): remove this once the lint is fixed
|
||||
#![allow(unsafe_op_in_unsafe_fn)]
|
||||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
mod loader;
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
//! In this example we will simulate a population of entities. In every tick we will:
|
||||
//! 1. spawn a new entity with a certain possibility
|
||||
//! 2. age all entities
|
||||
//! 3. despawn entities with age > 2
|
||||
//!
|
||||
//! To demonstrate change detection, there are some console outputs based on changes in
|
||||
//! the `EntityCounter` resource and updated Age components
|
||||
|
||||
use bevy_ecs::prelude::*;
|
||||
use rand::Rng;
|
||||
use std::ops::Deref;
|
||||
|
||||
// In this example we will simulate a population of entities. In every tick we will:
|
||||
// 1. spawn a new entity with a certain possibility
|
||||
// 2. age all entities
|
||||
// 3. despawn entities with age > 2
|
||||
//
|
||||
// To demonstrate change detection, there are some console outputs based on changes in
|
||||
// the EntityCounter resource and updated Age components
|
||||
fn main() {
|
||||
// Create a new empty World to hold our Entities, Components and Resources
|
||||
let mut world = World::new();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
//! In this example a system sends a custom event with a 50/50 chance during any frame.
|
||||
//! If an event was send, it will be printed by the console in a receiving system.
|
||||
|
||||
use bevy_ecs::prelude::*;
|
||||
|
||||
// In this example a system sends a custom event with a 50/50 chance during any frame.
|
||||
// If an event was send, it will be printed by the console in a receiving system.
|
||||
fn main() {
|
||||
// Create a new empty world and add the event as a resource
|
||||
let mut world = World::new();
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
//! In this example we add a counter resource and increase it's value in one system,
|
||||
//! while a different system prints the current count to the console.
|
||||
|
||||
use bevy_ecs::prelude::*;
|
||||
use rand::Rng;
|
||||
use std::ops::Deref;
|
||||
|
||||
// In this example we add a counter resource and increase it's value in one system,
|
||||
// while a different system prints the current count to the console.
|
||||
fn main() {
|
||||
// Create a world
|
||||
let mut world = World::new();
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
mod component;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// FIXME(11590): remove this once the lint is fixed
|
||||
#![allow(unsafe_op_in_unsafe_fn)]
|
||||
#![warn(missing_docs)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use bevy_macro_utils::BevyManifest;
|
||||
use encase_derive_impl::{implement, syn};
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
//! This crate is built on top of [GilRs](gilrs), a library
|
||||
//! that handles abstracting over platform-specific gamepad APIs.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod converter;
|
||||
mod gilrs_system;
|
||||
mod rumble;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
|
||||
//! This crate adds an immediate mode drawing api to Bevy for visual debugging.
|
||||
//!
|
||||
//! # Example
|
||||
|
@ -79,7 +77,7 @@ use bevy_render::{
|
|||
renderer::RenderDevice,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
};
|
||||
use bevy_utils::{tracing::warn, HashMap};
|
||||
use bevy_utils::HashMap;
|
||||
use config::{
|
||||
DefaultGizmoConfigGroup, GizmoConfig, GizmoConfigGroup, GizmoConfigStore, GizmoMeshConfig,
|
||||
};
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
//!
|
||||
//! The [glTF 2.0 specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html) defines the format of the glTF files.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
#[cfg(feature = "bevy_animation")]
|
||||
use bevy_animation::AnimationClip;
|
||||
use bevy_utils::HashMap;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
//! Parent-child relationships for Bevy entities.
|
||||
//!
|
||||
//! You should use the tools in this crate
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
|
||||
//! Input functionality for the [Bevy game engine](https://bevyengine.org/).
|
||||
//!
|
||||
//! # Supported input devices
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
//! This module is separated into its own crate to enable simple dynamic linking for Bevy, and should not be used directly
|
||||
|
||||
/// `use bevy::prelude::*;` to import common components, bundles, and plugins.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
//! This crate provides logging functions and configuration for [Bevy](https://bevyengine.org)
|
||||
//! apps, and automatically configures platform specific log handlers (i.e. WASM or Android).
|
||||
//!
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
#![deny(unsafe_code)]
|
||||
//! A collection of helper types and functions for working on macros within the Bevy ecosystem.
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
//! matrices like [`Mat2`], [`Mat3`] and [`Mat4`] and orientation representations
|
||||
//! like [`Quat`].
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod affine3;
|
||||
mod aspect_ratio;
|
||||
pub mod bounding;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
//! This example demonstrates how to generate a mesh.
|
||||
|
||||
#![allow(clippy::bool_assert_comparison, clippy::useless_conversion)]
|
||||
|
||||
use glam::{Vec2, Vec3};
|
||||
|
||||
pub type Face = [u32; 3];
|
||||
type Face = [u32; 3];
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Vertex {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
clippy::all,
|
||||
clippy::undocumented_unsafe_blocks
|
||||
)]
|
||||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use glam::{Vec2, Vec3};
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub mod wireframe;
|
||||
|
||||
mod alpha;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![no_std]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use core::fmt::{self, Formatter, Pointer};
|
||||
use core::{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
//! Reflection in Rust.
|
||||
//!
|
||||
//! [Reflection] is a powerful tool provided within many programming languages
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
|
||||
pub mod access;
|
||||
pub use access::*;
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
mod as_bind_group;
|
||||
mod extract_component;
|
||||
mod extract_resource;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
compile_error!("bevy_render cannot compile for a 16-bit platform.");
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
//! # }
|
||||
//! ```
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod dim2;
|
||||
pub use dim2::{CircleMeshBuilder, EllipseMeshBuilder};
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
//! instantiated or removed from a world to allow composition. Scenes can be serialized/deserialized,
|
||||
//! for example to save part of the world state to a file.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod bundle;
|
||||
mod dynamic_scene;
|
||||
mod dynamic_scene_builder;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
//! Provides 2D sprite rendering functionality.
|
||||
mod bundle;
|
||||
mod dynamic_texture_atlas_builder;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//! This sample demonstrates creating a thread pool with 4 tasks and spawning 40 tasks that spin
|
||||
//! for 100ms. It's expected to take about a second to run (assuming the machine has >= 4 logical
|
||||
//! cores)
|
||||
|
||||
use bevy_tasks::TaskPoolBuilder;
|
||||
use web_time::{Duration, Instant};
|
||||
|
||||
// This sample demonstrates creating a thread pool with 4 tasks and spawning 40 tasks that spin
|
||||
// for 100ms. It's expected to take about a second to run (assuming the machine has >= 4 logical
|
||||
// cores)
|
||||
|
||||
fn main() {
|
||||
let pool = TaskPoolBuilder::new()
|
||||
.thread_name("Busy Behavior ThreadPool".to_string())
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//! This sample demonstrates a thread pool with one thread per logical core and only one task
|
||||
//! spinning. Other than the one thread, the system should remain idle, demonstrating good behavior
|
||||
//! for small workloads.
|
||||
|
||||
use bevy_tasks::TaskPoolBuilder;
|
||||
use web_time::{Duration, Instant};
|
||||
|
||||
// This sample demonstrates a thread pool with one thread per logical core and only one task
|
||||
// spinning. Other than the one thread, the system should remain idle, demonstrating good behavior
|
||||
// for small workloads.
|
||||
|
||||
fn main() {
|
||||
let pool = TaskPoolBuilder::new()
|
||||
.thread_name("Idle Behavior ThreadPool".to_string())
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
mod slice;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
mod error;
|
||||
mod font;
|
||||
mod font_atlas;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
/// Common run conditions
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub mod commands;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
//! This crate contains Bevy's UI system, which can be used to create UI for both 2D and 3D games
|
||||
//! # Basic usage
|
||||
//! Spawn UI elements with [`node_bundles::ButtonBundle`], [`node_bundles::ImageBundle`], [`node_bundles::TextBundle`] and [`node_bundles::NodeBundle`]
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME(3492): remove once docs are ready
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::{format_ident, quote};
|
||||
use syn::{
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
//! [Bevy]: https://bevyengine.org/
|
||||
//!
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
#[allow(missing_docs)]
|
||||
pub mod prelude {
|
||||
pub use crate::default;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
//! `bevy_window` provides a platform-agnostic interface for windowing in Bevy.
|
||||
//!
|
||||
//! This crate contains types for window management and events,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
//! `bevy_winit` provides utilities to handle window creation and the eventloop through [`winit`]
|
||||
//!
|
||||
//! Most commonly, the [`WinitPlugin`] is used as part of
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(missing_docs)]
|
||||
|
||||
use accesskit_winit::Adapter;
|
||||
use bevy_a11y::{
|
||||
accesskit::{NodeBuilder, NodeClassSet, NodeId, Role, Tree, TreeUpdate},
|
||||
|
|
|
@ -25,7 +25,7 @@ fn main() {
|
|||
struct MyRoundGizmos {}
|
||||
|
||||
#[derive(Debug, Clone, Resource)]
|
||||
pub struct PrimitiveSegments(usize);
|
||||
struct PrimitiveSegments(usize);
|
||||
impl Default for PrimitiveSegments {
|
||||
fn default() -> Self {
|
||||
Self(10)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! This example demonstrates how to create a custom mesh,
|
||||
//! assign a custom UV mapping for a custom texture,
|
||||
//! and how to change the UV mapping at run-time.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::render::{
|
||||
mesh::{Indices, VertexAttributeValues},
|
||||
|
|
|
@ -87,8 +87,8 @@ impl Material for LineMaterial {
|
|||
|
||||
/// A list of lines with a start and end position
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LineList {
|
||||
pub lines: Vec<(Vec3, Vec3)>,
|
||||
struct LineList {
|
||||
lines: Vec<(Vec3, Vec3)>,
|
||||
}
|
||||
|
||||
impl From<LineList> for Mesh {
|
||||
|
@ -108,8 +108,8 @@ impl From<LineList> for Mesh {
|
|||
|
||||
/// A list of points that will have a line drawn between each consecutive points
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LineStrip {
|
||||
pub points: Vec<Vec3>,
|
||||
struct LineStrip {
|
||||
points: Vec<Vec3>,
|
||||
}
|
||||
|
||||
impl From<LineStrip> for Mesh {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Illustrates spot lights.
|
||||
|
||||
use std::f32::consts::*;
|
||||
|
||||
use bevy::{
|
||||
|
|
|
@ -704,7 +704,7 @@ impl Material for ColorGradientMaterial {
|
|||
}
|
||||
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct ColorGradientMaterial {}
|
||||
struct ColorGradientMaterial {}
|
||||
|
||||
#[derive(Resource)]
|
||||
struct CameraTransform(Transform);
|
||||
|
|
|
@ -6,7 +6,7 @@ use bevy::{
|
|||
};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Curve(CubicCurve<Vec3>);
|
||||
struct Curve(CubicCurve<Vec3>);
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
@ -72,11 +72,7 @@ fn setup(
|
|||
});
|
||||
}
|
||||
|
||||
pub fn animate_cube(
|
||||
time: Res<Time>,
|
||||
mut query: Query<(&mut Transform, &Curve)>,
|
||||
mut gizmos: Gizmos,
|
||||
) {
|
||||
fn animate_cube(time: Res<Time>, mut query: Query<(&mut Transform, &Curve)>, mut gizmos: Gizmos) {
|
||||
let t = (time.elapsed_seconds().sin() + 1.) / 2.;
|
||||
|
||||
for (mut transform, cubic_curve) in &mut query {
|
||||
|
|
|
@ -20,7 +20,7 @@ fn main() {
|
|||
}
|
||||
|
||||
// This "print message plugin" prints a `message` every `wait_duration`
|
||||
pub struct PrintMessagePlugin {
|
||||
struct PrintMessagePlugin {
|
||||
// Put your plugin configuration here
|
||||
wait_duration: Duration,
|
||||
message: String,
|
||||
|
|
|
@ -34,7 +34,7 @@ impl PluginGroup for HelloWorldPlugins {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct PrintHelloPlugin;
|
||||
struct PrintHelloPlugin;
|
||||
|
||||
impl Plugin for PrintHelloPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
|
@ -46,7 +46,7 @@ fn print_hello_system() {
|
|||
info!("hello");
|
||||
}
|
||||
|
||||
pub struct PrintWorldPlugin;
|
||||
struct PrintWorldPlugin;
|
||||
|
||||
impl Plugin for PrintWorldPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
|
|
|
@ -16,12 +16,12 @@ use std::marker::PhantomData;
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Asset, TypePath)]
|
||||
pub struct GzAsset {
|
||||
pub uncompressed: ErasedLoadedAsset,
|
||||
struct GzAsset {
|
||||
uncompressed: ErasedLoadedAsset,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct GzAssetLoader;
|
||||
struct GzAssetLoader;
|
||||
|
||||
/// Possible errors that can be produced by [`GzAssetLoader`]
|
||||
#[non_exhaustive]
|
||||
|
|
|
@ -11,12 +11,13 @@ use serde::Deserialize;
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Asset, TypePath, Debug, Deserialize)]
|
||||
pub struct CustomAsset {
|
||||
pub value: i32,
|
||||
struct CustomAsset {
|
||||
#[allow(dead_code)]
|
||||
value: i32,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct CustomAssetLoader;
|
||||
struct CustomAssetLoader;
|
||||
|
||||
/// Possible errors that can be produced by [`CustomAssetLoader`]
|
||||
#[non_exhaustive]
|
||||
|
@ -54,12 +55,12 @@ impl AssetLoader for CustomAssetLoader {
|
|||
}
|
||||
|
||||
#[derive(Asset, TypePath, Debug)]
|
||||
pub struct Blob {
|
||||
pub bytes: Vec<u8>,
|
||||
struct Blob {
|
||||
bytes: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct BlobAssetLoader;
|
||||
struct BlobAssetLoader;
|
||||
|
||||
/// Possible errors that can be produced by [`CustomAssetLoader`]
|
||||
#[non_exhaustive]
|
||||
|
|
|
@ -107,14 +107,14 @@ impl AssetLoader for TextLoader {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct CoolTextRon {
|
||||
struct CoolTextRon {
|
||||
text: String,
|
||||
dependencies: Vec<String>,
|
||||
embedded_dependencies: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Asset, TypePath, Debug)]
|
||||
pub struct CoolText {
|
||||
struct CoolText {
|
||||
text: String,
|
||||
#[allow(unused)]
|
||||
dependencies: Vec<Handle<Text>>,
|
||||
|
@ -174,7 +174,7 @@ impl AssetLoader for CoolTextLoader {
|
|||
struct CoolTextTransformer;
|
||||
|
||||
#[derive(Default, Serialize, Deserialize)]
|
||||
pub struct CoolTextTransformerSettings {
|
||||
struct CoolTextTransformerSettings {
|
||||
appended: String,
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ fn main() {
|
|||
}
|
||||
|
||||
// All diagnostics should have a unique DiagnosticPath.
|
||||
pub const SYSTEM_ITERATION_COUNT: DiagnosticPath =
|
||||
DiagnosticPath::const_new("system_iteration_count");
|
||||
const SYSTEM_ITERATION_COUNT: DiagnosticPath = DiagnosticPath::const_new("system_iteration_count");
|
||||
|
||||
fn my_system(mut diagnostics: Diagnostics) {
|
||||
// Add a measurement of 10.0 for our diagnostic each time this system runs.
|
||||
|
|
|
@ -11,10 +11,10 @@ fn main() {
|
|||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Player;
|
||||
struct Player;
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct PlayerCount(usize);
|
||||
struct PlayerCount(usize);
|
||||
|
||||
/// The [`SystemParam`] struct can contain any types that can also be included in a
|
||||
/// system function signature.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Demonstrate stepping through systems in order of execution.
|
||||
|
||||
use bevy::{ecs::schedule::Stepping, log::LogPlugin, prelude::*};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! A minimal example that outputs "hello world"
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! A 3d Scene with a button and playing sound.
|
||||
|
||||
use bevy::{
|
||||
input::touch::TouchPhase,
|
||||
prelude::*,
|
||||
|
|
|
@ -49,7 +49,7 @@ pub struct Bar {
|
|||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct NonReflectedValue {
|
||||
struct NonReflectedValue {
|
||||
_a: usize,
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ pub struct C(usize);
|
|||
|
||||
/// Deriving reflect on an enum will implement the `Reflect` and `Enum` traits
|
||||
#[derive(Reflect)]
|
||||
pub enum D {
|
||||
enum D {
|
||||
A,
|
||||
B(usize),
|
||||
C { value: f32 },
|
||||
|
@ -57,7 +57,7 @@ pub struct E {
|
|||
/// that these values behave as expected when nested underneath Reflect-ed structs.
|
||||
#[derive(Reflect, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[reflect_value(PartialEq, Serialize, Deserialize)]
|
||||
pub enum F {
|
||||
enum F {
|
||||
X,
|
||||
Y,
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ impl DoThing for MyType {
|
|||
}
|
||||
|
||||
#[reflect_trait]
|
||||
pub trait DoThing {
|
||||
trait DoThing {
|
||||
fn do_thing(&self) -> String;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
//! This example illustrates how to create a texture for use with a `texture_2d_array<f32>` shader
|
||||
//! uniform variable.
|
||||
|
||||
use bevy::{
|
||||
asset::LoadState,
|
||||
prelude::*,
|
||||
|
@ -5,8 +8,6 @@ use bevy::{
|
|||
render::render_resource::{AsBindGroup, ShaderRef},
|
||||
};
|
||||
|
||||
/// This example illustrates how to create a texture for use with a `texture_2d_array<f32>` shader
|
||||
/// uniform variable.
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins((
|
||||
|
|
|
@ -68,10 +68,10 @@ fn setup(mut commands: Commands, mut images: ResMut<Assets<Image>>) {
|
|||
commands.insert_resource(GameOfLifeImage { texture: image });
|
||||
}
|
||||
|
||||
pub struct GameOfLifeComputePlugin;
|
||||
struct GameOfLifeComputePlugin;
|
||||
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, RenderLabel)]
|
||||
pub struct GameOfLifeLabel;
|
||||
struct GameOfLifeLabel;
|
||||
|
||||
impl Plugin for GameOfLifeComputePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
|
@ -121,7 +121,7 @@ fn prepare_bind_group(
|
|||
}
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct GameOfLifePipeline {
|
||||
struct GameOfLifePipeline {
|
||||
texture_bind_group_layout: BindGroupLayout,
|
||||
init_pipeline: CachedComputePipelineId,
|
||||
update_pipeline: CachedComputePipelineId,
|
||||
|
|
|
@ -58,7 +58,7 @@ fn setup(
|
|||
|
||||
// This is the struct that will be passed to your shader
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[uniform(0)]
|
||||
color: Color,
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ impl Plugin for PostProcessPlugin {
|
|||
}
|
||||
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, RenderLabel)]
|
||||
pub struct PostProcessLabel;
|
||||
struct PostProcessLabel;
|
||||
|
||||
// The post process node used for the render graph
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -76,7 +76,7 @@ impl Material for CustomMaterial {
|
|||
// This is the struct that will be passed to your shader
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
#[bind_group_data(CustomMaterialKey)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[uniform(0)]
|
||||
color: Color,
|
||||
is_red: bool,
|
||||
|
@ -87,7 +87,7 @@ pub struct CustomMaterial {
|
|||
// Specialization keys should be kept as small / cheap to hash as possible,
|
||||
// as they will be used to look up the pipeline for each drawn entity with this material type.
|
||||
#[derive(Eq, PartialEq, Hash, Clone)]
|
||||
pub struct CustomMaterialKey {
|
||||
struct CustomMaterialKey {
|
||||
is_red: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ impl ExtractComponent for InstanceMaterialData {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct CustomMaterialPlugin;
|
||||
struct CustomMaterialPlugin;
|
||||
|
||||
impl Plugin for CustomMaterialPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
|
@ -151,7 +151,7 @@ fn queue_custom(
|
|||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct InstanceBuffer {
|
||||
struct InstanceBuffer {
|
||||
buffer: Buffer,
|
||||
length: usize,
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ fn prepare_instance_buffers(
|
|||
}
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct CustomPipeline {
|
||||
struct CustomPipeline {
|
||||
shader: Handle<Shader>,
|
||||
mesh_pipeline: MeshPipeline,
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ type DrawCustom = (
|
|||
DrawMeshInstanced,
|
||||
);
|
||||
|
||||
pub struct DrawMeshInstanced;
|
||||
struct DrawMeshInstanced;
|
||||
|
||||
impl<P: PhaseItem> RenderCommand<P> for DrawMeshInstanced {
|
||||
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
|
||||
|
|
|
@ -41,7 +41,7 @@ fn setup(
|
|||
|
||||
// This struct defines the data that will be passed to your shader
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[uniform(0)]
|
||||
color: Color,
|
||||
#[texture(1)]
|
||||
|
|
|
@ -41,7 +41,7 @@ fn setup(
|
|||
|
||||
// This is the struct that will be passed to your shader
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[uniform(0)]
|
||||
color: Color,
|
||||
#[texture(1)]
|
||||
|
|
|
@ -47,7 +47,7 @@ fn setup(
|
|||
|
||||
// This is the struct that will be passed to your shader
|
||||
#[derive(Asset, TypePath, AsBindGroup, Clone)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[uniform(0)]
|
||||
color: Color,
|
||||
#[texture(1)]
|
||||
|
|
|
@ -70,7 +70,7 @@ fn rotate_camera(mut camera: Query<&mut Transform, With<MainCamera>>, time: Res<
|
|||
}
|
||||
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[texture(0)]
|
||||
#[sampler(1)]
|
||||
texture: Handle<Image>,
|
||||
|
|
|
@ -157,7 +157,7 @@ fn setup(
|
|||
|
||||
// This is the struct that will be passed to your shader
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct CustomMaterial {
|
||||
struct CustomMaterial {
|
||||
#[uniform(0)]
|
||||
color: Color,
|
||||
#[texture(1)]
|
||||
|
@ -205,7 +205,7 @@ struct ShowPrepassSettings {
|
|||
|
||||
// This shader simply loads the prepass texture and outputs it directly
|
||||
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
|
||||
pub struct PrepassOutputMaterial {
|
||||
struct PrepassOutputMaterial {
|
||||
#[uniform(0)]
|
||||
settings: ShowPrepassSettings,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// General UI benchmark that stress tests layouting, text, interaction and rendering
|
||||
//! General UI benchmark that stress tests layouting, text, interaction and rendering
|
||||
|
||||
use argh::FromArgs;
|
||||
use bevy::{
|
||||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Test rendering of many gizmos.
|
||||
|
||||
use std::f32::consts::TAU;
|
||||
|
||||
use bevy::{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! An example that illustrates how Time is handled in ECS.
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use std::io::{self, BufRead};
|
||||
|
|
|
@ -12,12 +12,12 @@ fn main() {
|
|||
}
|
||||
|
||||
#[derive(Component, Deref, DerefMut)]
|
||||
pub struct PrintOnCompletionTimer(Timer);
|
||||
struct PrintOnCompletionTimer(Timer);
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct Countdown {
|
||||
pub percent_trigger: Timer,
|
||||
pub main_timer: Timer,
|
||||
struct Countdown {
|
||||
percent_trigger: Timer,
|
||||
main_timer: Timer,
|
||||
}
|
||||
|
||||
impl Countdown {
|
||||
|
|
Loading…
Reference in a new issue