Skip to content

Commit

Permalink
Add ToItem implementation for references
Browse files Browse the repository at this point in the history
  • Loading branch information
JieningYu committed Feb 7, 2024
1 parent 40a3365 commit 60b056e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/item/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ pub trait ToItem<'s, 'r, K, P> {
fn to_item(&'s self) -> Item<'r, K, P>;
}

impl<'ss, 's, 'r, K, P, T> ToItem<'ss, 'r, K, P> for &'s T
where
T: ToItem<'s, 'r, K, P>,
{
#[inline]
fn to_item(&'ss self) -> Item<'r, K, P> {
(*self).to_item()
}
}

/// The max item count of an `ItemStack`.
pub const MAX_STACK_COUNT: u32 = 64;

Expand Down

0 comments on commit 60b056e

Please sign in to comment.