pub struct Layout {
pub id: usize,
pub bin: Bin,
pub placed_items: SlotMap<PItemKey, PlacedItem>,
/* private fields */
}
Expand description
Fields§
§id: usize
The unique identifier of the layout, used only to match with a LayoutSnapshot.
bin: Bin
The bin used for this layout
placed_items: SlotMap<PItemKey, PlacedItem>
How the items are placed in the bin
Implementations§
Source§impl Layout
impl Layout
pub fn new(id: usize, bin: Bin) -> Self
pub fn from_snapshot(ls: &LayoutSnapshot) -> Self
pub fn change_bin(&mut self, bin: Bin)
pub fn create_snapshot(&mut self) -> LayoutSnapshot
pub fn restore(&mut self, layout_snapshot: &LayoutSnapshot)
pub fn clone_with_id(&self, id: usize) -> Self
pub fn place_item( &mut self, item: &Item, d_transformation: DTransformation, ) -> PItemKey
pub fn remove_item(&mut self, pk: PItemKey, commit_instant: bool) -> PlacedItem
pub fn placed_items(&self) -> &SlotMap<PItemKey, PlacedItem>
Sourcepub fn usage(&self) -> fsize
pub fn usage(&self) -> fsize
Returns the usage of the bin with the items placed. It is the ratio of the area of the items placed to the area of the bin.
pub fn id(&self) -> usize
Sourcepub fn flush_changes(&mut self)
pub fn flush_changes(&mut self)
Makes sure that the collision detection engine is completely updated with the changes made to the layout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more