pub struct ShapedRecipeGrid { /* private fields */ }Expand description
A width, height, and exactly width * height ingredient displays.
Fields are private so the length invariant cannot be broken after construction. Width, height, and ingredient count are encoded as VarInts.
Implementations§
Source§impl ShapedRecipeGrid
impl ShapedRecipeGrid
Sourcepub fn new(
width: u32,
height: u32,
ingredients: Vec<SlotDisplay>,
) -> Result<Self, InvalidShapedRecipeGrid>
pub fn new( width: u32, height: u32, ingredients: Vec<SlotDisplay>, ) -> Result<Self, InvalidShapedRecipeGrid>
Creates a grid when its dimensions and ingredient count are valid.
Sourcepub const fn dimensions(&self) -> (u32, u32)
pub const fn dimensions(&self) -> (u32, u32)
Returns the grid dimensions as (width, height).
Sourcepub fn ingredients(&self) -> &[SlotDisplay]
pub fn ingredients(&self) -> &[SlotDisplay]
Returns the ingredient displays in row-major order.
Sourcepub fn into_ingredients(self) -> Vec<SlotDisplay>
pub fn into_ingredients(self) -> Vec<SlotDisplay>
Extracts the ingredient displays in row-major order.
Trait Implementations§
Source§impl Clone for ShapedRecipeGrid
impl Clone for ShapedRecipeGrid
Source§fn clone(&self) -> ShapedRecipeGrid
fn clone(&self) -> ShapedRecipeGrid
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShapedRecipeGrid
impl Debug for ShapedRecipeGrid
Source§impl PartialEq for ShapedRecipeGrid
impl PartialEq for ShapedRecipeGrid
impl StructuralPartialEq for ShapedRecipeGrid
Auto Trait Implementations§
impl Freeze for ShapedRecipeGrid
impl RefUnwindSafe for ShapedRecipeGrid
impl Send for ShapedRecipeGrid
impl Sync for ShapedRecipeGrid
impl Unpin for ShapedRecipeGrid
impl UnsafeUnpin for ShapedRecipeGrid
impl UnwindSafe for ShapedRecipeGrid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ContextualCodec for Twhere
T: TypeCodec,
impl<T> ContextualCodec for Twhere
T: TypeCodec,
Source§fn encode_with_context(
&self,
writer: &mut impl Write,
_context: &Context,
) -> Result<(), CodecError>
fn encode_with_context( &self, writer: &mut impl Write, _context: &Context, ) -> Result<(), CodecError>
Encodes this value using context supplied by its enclosing structure.
Source§fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
Decodes this value using context supplied by its enclosing structure.