Skip to content

Commit 4d972b9

Browse files
committed
Allow inlining generated methods
1 parent fef6e60 commit 4d972b9

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

macros/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
0.3.1 (2023-10-10)
2+
==================
3+
4+
## Changed
5+
6+
* Allow inlining generated methods
7+
18
0.3.0 (2023-10-10)
29
==================
310

macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "embedded-layout-macros"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
license = "MIT"
55
description = "Procedural macros for embedded-layout"
66
repository = "https://github.com/bugadani/embedded-layout"

macros/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,41 +442,49 @@ pub fn derive_viewgroup(input: TokenStream) -> TokenStream {
442442

443443
let gen_view_group = quote! {
444444
impl #impl_generics embedded_layout::view_group::ViewGroup for #name #ty_generics #where_clause {
445+
#[inline]
445446
fn len(&self) -> usize {
446447
#field_count_impl
447448
}
448449

450+
#[inline]
449451
fn at(&self, index: usize) -> &dyn embedded_layout::View {
450452
#index_impl
451453
}
452454

455+
#[inline]
453456
fn at_mut(&mut self, index: usize) -> &mut dyn embedded_layout::View {
454457
#index_mut_impl
455458
}
456459

460+
#[inline]
457461
fn bounds_of(&self, index: usize) -> embedded_graphics::primitives::Rectangle {
458462
use embedded_layout::View;
459463
#bounds_of_impl
460464
}
461465

466+
#[inline]
462467
fn translate_child(&mut self, index: usize, by: Point) {
463468
use embedded_layout::View;
464469
#translate_child_impl
465470
}
466471
}
467472

468473
impl #impl_generics embedded_graphics::transform::Transform for #name #ty_generics #where_clause {
474+
#[inline]
469475
fn translate(&self, by: Point) -> Self {
470476
#translate_impl
471477
}
472478

479+
#[inline]
473480
fn translate_mut(&mut self, by: Point) -> &mut Self {
474481
embedded_layout::view_group::ViewGroupHelper::translate(self, by);
475482
self
476483
}
477484
}
478485

479486
impl #impl_generics embedded_graphics::geometry::Dimensions for #name #ty_generics #where_clause {
487+
#[inline]
480488
fn bounding_box(&self) -> embedded_graphics::primitives::Rectangle {
481489
embedded_layout::view_group::ViewGroupHelper::bounds(self)
482490
}
@@ -501,6 +509,7 @@ pub fn derive_viewgroup(input: TokenStream) -> TokenStream {
501509
type Color = #pixelcolor;
502510
type Output = ();
503511

512+
#[inline]
504513
fn draw<D: embedded_graphics::draw_target::DrawTarget<Color = #pixelcolor>>(&self, display: &mut D) -> Result<(), D::Error> {
505514
#draw_impl
506515

0 commit comments

Comments
 (0)