 b6a647cc01
			
		
	
	
		b6a647cc01
		
	
	
	
	
		
			
			Adds a `default()` shorthand for `Default::default()` ... because life is too short to constantly type `Default::default()`.
```rust
use bevy::prelude::*;
#[derive(Default)]
struct Foo {
  bar: usize,
  baz: usize,
}
// Normally you would do this:
let foo = Foo {
  bar: 10,
  ..Default::default()
};
// But now you can do this:
let foo = Foo {
  bar: 10,
  ..default()
};
```
The examples have been adapted to use `..default()`. I've left internal crates as-is for now because they don't pull in the bevy prelude, and the ergonomics of each case should be considered individually.
		
	
			
		
			
				
	
	
		
			21 lines
		
	
	
		
			473 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			473 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use bevy::prelude::*;
 | |
| 
 | |
| fn main() {
 | |
|     App::new()
 | |
|         .add_plugins(DefaultPlugins)
 | |
|         .add_startup_system(setup)
 | |
|         .run();
 | |
| }
 | |
| 
 | |
| fn setup(mut commands: Commands) {
 | |
|     commands.spawn_bundle(OrthographicCameraBundle::new_2d());
 | |
|     commands.spawn_bundle(SpriteBundle {
 | |
|         sprite: Sprite {
 | |
|             color: Color::rgb(0.25, 0.25, 0.75),
 | |
|             custom_size: Some(Vec2::new(50.0, 50.0)),
 | |
|             ..default()
 | |
|         },
 | |
|         ..default()
 | |
|     });
 | |
| }
 |