[−][src]Struct nines::Layout
Describe a layout to render with. You'll probably start with a:
use nines::*; let layout = Layout { src: Dimensions { outer: Rect::xywh(0, 0, 3, 3), inner: Rect::xywh(1, 1, 1, 1), }, dst: Dimensions { outer: Rect::xywh(0, 0, 5, 4), inner: Rect::xywh(1, 1, 3, 2), }, style: Style::default(), // stretch }; let mut rects = Vec::new(); layout.validate().unwrap().each_dst_src(|dst, src|{ rects.push((*dst, *src)); }); assert_eq!(rects[0].0, Rect::xywh(0, 0, 1, 1)); assert_eq!(rects[1].0, Rect::xywh(1, 0, 3, 1)); // ... assert_eq!(rects[0].1, Rect::xywh(0, 0, 1, 1)); assert_eq!(rects[1].1, Rect::xywh(1, 0, 1, 1)); // ...
Fields
dst: Dst
src: Src
style: Style
Methods
impl<S: Scalar> Layout<Dimensions<S>, Dimensions<S>>
[src]
pub fn validate(
&self
) -> Result<Layout<ValidDimensions<S>, ValidDimensions<S>>, Error>
[src]
&self
) -> Result<Layout<ValidDimensions<S>, ValidDimensions<S>>, Error>
Validate that dst and src contain valid (non-negative sized, non-NAN) dimensions.
impl<S: Scalar> Layout<ValidDimensions<S>, ValidDimensions<S>>
[src]
pub fn each_dst_src(
&self,
each_dst_src: impl FnMut(&ValidRect<S>, &ValidRect<S>)
)
[src]
&self,
each_dst_src: impl FnMut(&ValidRect<S>, &ValidRect<S>)
)
Enumerate the destination and source rectangles for a layout.
Trait Implementations
impl<S: Scalar> TryFrom<Layout<Dimensions<S>, Dimensions<S>>> for Layout<ValidDimensions<S>, ValidDimensions<S>>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(
value: Layout<Dimensions<S>, Dimensions<S>>
) -> Result<Layout<ValidDimensions<S>, ValidDimensions<S>>, Self::Error>
[src]
value: Layout<Dimensions<S>, Dimensions<S>>
) -> Result<Layout<ValidDimensions<S>, ValidDimensions<S>>, Self::Error>
Auto Trait Implementations
impl<Dst, Src> Send for Layout<Dst, Src> where
Dst: Send,
Src: Send,
Dst: Send,
Src: Send,
impl<Dst, Src> Sync for Layout<Dst, Src> where
Dst: Sync,
Src: Sync,
Dst: Sync,
Src: Sync,
impl<Dst, Src> Unpin for Layout<Dst, Src> where
Dst: Unpin,
Src: Unpin,
Dst: Unpin,
Src: Unpin,
impl<Dst, Src> UnwindSafe for Layout<Dst, Src> where
Dst: UnwindSafe,
Src: UnwindSafe,
Dst: UnwindSafe,
Src: UnwindSafe,
impl<Dst, Src> RefUnwindSafe for Layout<Dst, Src> where
Dst: RefUnwindSafe,
Src: RefUnwindSafe,
Dst: RefUnwindSafe,
Src: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,