Struct rect_packer::Packer[][src]

pub struct Packer { /* fields omitted */ }

Packer is the main structure in this crate. It holds packing context.

Implementations

impl Packer[src]

pub fn new(config: Config) -> Packer[src]

Create new empty Packer with the provided parameters.

pub fn config(&self) -> Config[src]

Get config that this packer was created with.

pub fn pack(
    &mut self,
    width: i32,
    height: i32,
    allow_rotation: bool
) -> Option<Rect>
[src]

Pack new rectangle. Returns position of the newly added rectangle. If there is not enough space returns None. If it returns None you can still try to add smaller rectangles.

allow_rotation - allow 90° rotation of the input rectangle. You can detect whether rectangle was rotated by comparing returned width and height with the supplied ones.

pub fn can_pack(&self, width: i32, height: i32, allow_rotation: bool) -> bool[src]

Check if rectangle with the specified size can be added.

Trait Implementations

impl Clone for Packer[src]

Auto Trait Implementations

impl RefUnwindSafe for Packer

impl Send for Packer

impl Sync for Packer

impl Unpin for Packer

impl UnwindSafe for Packer

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.