Skip to content

Commit c10386d

Browse files
Bump version, address lints
1 parent 8954cd9 commit c10386d

12 files changed

Lines changed: 37 additions & 23 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ keywords = ["bevy", "gamedev", "graphics"]
88
license = "MIT OR Apache-2.0"
99
name = "bevy_vector_shapes"
1010
repository = "https://github.com/james-j-obrien/bevy_vector_shapes"
11-
version = "0.10.0"
11+
version = "0.11.0"
1212

1313
[dependencies]
1414
any_vec = "0.15.0"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fn draw(mut painter: ShapePainter) {
6262

6363
| bevy | bevy_vector_shapes |
6464
| ---- | ------------------ |
65+
| 0.17 | 0.11.0 |
6566
| 0.16 | 0.10.0 |
6667
| 0.15 | 0.9.3 |
6768
| 0.14 | 0.8.2 |

src/painter/canvas.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ pub struct CanvasBundle {
185185

186186
impl CanvasBundle {
187187
/// Create a [`CanvasBundle`] from a given image with the given configuration.
188+
///
189+
/// Note that [`CanvasConfig::hdr`] will not be reflected in the bundle, add a [`bevy::render::view::Hdr`] component instead
190+
/// or use [`CanvasCommands::spawn_canvas`].
188191
pub fn new(image: Handle<Image>, config: CanvasConfig) -> Self {
189192
Self {
190193
camera_2d: Camera2d,
@@ -214,18 +217,18 @@ pub trait CanvasCommands<'w> {
214217
///
215218
/// Returns the created [`Handle<Image>`] and [`EntityCommands`].
216219
fn spawn_canvas(
217-
&mut self,
220+
&'_ mut self,
218221
assets: &mut Assets<Image>,
219222
config: CanvasConfig,
220-
) -> (Handle<Image>, EntityCommands);
223+
) -> (Handle<Image>, EntityCommands<'_>);
221224
}
222225

223226
impl<'w, 's> CanvasCommands<'w> for Commands<'w, 's> {
224227
fn spawn_canvas(
225-
&mut self,
228+
&'_ mut self,
226229
assets: &mut Assets<Image>,
227230
config: CanvasConfig,
228-
) -> (Handle<Image>, EntityCommands) {
231+
) -> (Handle<Image>, EntityCommands<'_>) {
229232
let handle = Canvas::create_image(
230233
assets,
231234
config.width,

src/painter/child_commands.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ pub struct ShapeChildBuilder<'w> {
7474
impl<'w> ShapeChildBuilder<'w> {
7575
/// Spawns an entity with the given bundle and inserts it into the parent entity's [`Children`].
7676
/// Also adds [`Parent`] component to the created entity.
77-
pub fn spawn(&mut self, bundle: impl Bundle) -> EntityCommands {
77+
pub fn spawn(&'_ mut self, bundle: impl Bundle) -> EntityCommands<'_> {
7878
let e = self.commands.spawn(bundle);
7979
self.push_children.children.push(e.id());
8080
e
8181
}
8282

8383
/// Spawns an [`Entity`] with no components and inserts it into the parent entity's [`Children`].
8484
/// Also adds [`Parent`] component to the created entity.
85-
pub fn spawn_empty(&mut self) -> EntityCommands {
85+
pub fn spawn_empty(&'_ mut self) -> EntityCommands<'_> {
8686
let e = self.commands.spawn_empty();
8787
self.push_children.children.push(e.id());
8888
e
@@ -101,7 +101,7 @@ impl<'w> ShapeChildBuilder<'w> {
101101
}
102102

103103
impl<'w> ShapeSpawner<'w> for ShapeChildBuilder<'w> {
104-
fn spawn_shape(&mut self, bundle: impl Bundle) -> ShapeEntityCommands {
104+
fn spawn_shape(&'_ mut self, bundle: impl Bundle) -> ShapeEntityCommands<'_, '_> {
105105
let Self {
106106
commands, config, ..
107107
} = self;

src/painter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub trait ShapeSpawner<'w>: DerefMut<Target = ShapeConfig> {
2828
/// Note: [`ShapeBundle`](crate::ShapeBundle) does not include [`RenderLayers`](bevy::render::view::RenderLayers) as there is no support for optional components
2929
/// so instead it is inserted in this function conditionally depending on the [`ShapeConfig`] in `self`
3030
/// Prefer the function for the shape you want over [`ShapeSpawner::spawn_shape`], e.g. `commands.rect(...)`
31-
fn spawn_shape(&mut self, bundle: impl Bundle) -> ShapeEntityCommands;
31+
fn spawn_shape(&'_ mut self, bundle: impl Bundle) -> ShapeEntityCommands<'_, '_>;
3232
}
3333

3434
/// Plugin that setups up resources and systems for [`Canvas`] and [`ShapePainter`].

src/painter/shape_commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl<'w, 's> ShapeCommands<'w, 's> {
2525
}
2626

2727
impl<'w, 's> ShapeSpawner<'w> for ShapeCommands<'w, 's> {
28-
fn spawn_shape(&mut self, bundle: impl Bundle) -> ShapeEntityCommands {
28+
fn spawn_shape(&'_ mut self, bundle: impl Bundle) -> ShapeEntityCommands<'_, '_> {
2929
let Self {
3030
commands, config, ..
3131
} = self;

src/shapes/disc.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,26 @@ impl DiscBundle for ShapeBundle<DiscComponent> {
234234

235235
/// Extension trait for [`ShapeSpawner`] to enable spawning of entities for disc type shapes.
236236
pub trait DiscSpawner<'w> {
237-
fn circle(&mut self, radius: f32) -> ShapeEntityCommands;
238-
fn arc(&mut self, radius: f32, start_angle: f32, end_angle: f32) -> ShapeEntityCommands;
237+
fn circle(&'_ mut self, radius: f32) -> ShapeEntityCommands<'_, '_>;
238+
fn arc(
239+
&'_ mut self,
240+
radius: f32,
241+
start_angle: f32,
242+
end_angle: f32,
243+
) -> ShapeEntityCommands<'_, '_>;
239244
}
240245

241246
impl<'w, T: ShapeSpawner<'w>> DiscSpawner<'w> for T {
242-
fn circle(&mut self, radius: f32) -> ShapeEntityCommands {
247+
fn circle(&'_ mut self, radius: f32) -> ShapeEntityCommands<'_, '_> {
243248
self.spawn_shape(ShapeBundle::circle(self.config(), radius))
244249
}
245250

246-
fn arc(&mut self, radius: f32, start_angle: f32, end_angle: f32) -> ShapeEntityCommands {
251+
fn arc(
252+
&'_ mut self,
253+
radius: f32,
254+
start_angle: f32,
255+
end_angle: f32,
256+
) -> ShapeEntityCommands<'_, '_> {
247257
self.spawn_shape(ShapeBundle::arc(
248258
self.config(),
249259
radius,

src/shapes/line.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ impl LineBundle for ShapeBundle<LineComponent> {
159159

160160
/// Extension trait for [`ShapeSpawner`] to enable spawning of line entities.
161161
pub trait LineSpawner<'w>: ShapeSpawner<'w> {
162-
fn line(&mut self, start: Vec3, end: Vec3) -> ShapeEntityCommands;
162+
fn line(&'_ mut self, start: Vec3, end: Vec3) -> ShapeEntityCommands<'_, '_>;
163163
}
164164

165165
impl<'w, T: ShapeSpawner<'w>> LineSpawner<'w> for T {
166-
fn line(&mut self, start: Vec3, end: Vec3) -> ShapeEntityCommands {
166+
fn line(&'_ mut self, start: Vec3, end: Vec3) -> ShapeEntityCommands<'_, '_> {
167167
self.spawn_shape(ShapeBundle::line(self.config(), start, end))
168168
}
169169
}

src/shapes/rectangle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ impl RectangleBundle for ShapeBundle<RectangleComponent> {
163163

164164
/// Extension trait for [`ShapeSpawner`] to enable spawning of rectangle entities.
165165
pub trait RectangleSpawner<'w> {
166-
fn rect(&mut self, size: Vec2) -> ShapeEntityCommands;
166+
fn rect(&'_ mut self, size: Vec2) -> ShapeEntityCommands<'_, '_>;
167167
}
168168

169169
impl<'w, T: ShapeSpawner<'w>> RectangleSpawner<'w> for T {
170-
fn rect(&mut self, size: Vec2) -> ShapeEntityCommands {
170+
fn rect(&'_ mut self, size: Vec2) -> ShapeEntityCommands<'_, '_> {
171171
self.spawn_shape(ShapeBundle::rect(self.config(), size))
172172
}
173173
}

0 commit comments

Comments
 (0)