pub struct DrawCall<IsAbsolute> { /* private fields */ }Implementations§
Source§impl<T> DrawCall<T>
impl<T> DrawCall<T>
Sourcepub fn new(pos: Pair<Pos>, kind: DrawCallKind) -> Self
pub fn new(pos: Pair<Pos>, kind: DrawCallKind) -> Self
Examples found in repository?
More examples
examples/01_hello_world.rs (lines 21-24)
19fn view(_model: &Model, area: &mut Area) {
20 area.push_all(vec![
21 DrawCall::new(
22 Pair::fill(0),
23 DrawCallKind::SetStyle(ContentStyle::new().magenta().bold()),
24 ),
25 DrawCall::new(
26 Pair::fill(0),
27 DrawCallKind::PrintLine("hello world! :3".limit_size(area.size())),
28 ),
29 ]);
30}examples/04_counter.rs (lines 33-36)
30fn center(style: ContentStyle, text: String) -> Element {
31 Box::new(move |area| {
32 area.push_all(vec![
33 DrawCall::new(
34 area.center_rect(text.rect()).pos,
35 DrawCallKind::SetStyle(style),
36 ),
37 DrawCall::new(
38 area.center_rect(text.rect()).pos,
39 DrawCallKind::PrintLine(text.limit_size(area.size())),
40 ),
41 ]);
42 })
43}examples/02_centered.rs (line 24)
15fn view(_model: &Model, area: &mut Area) {
16 let text_0 = "this text is centered!".limit_size(area.size());
17 let text_1 = "try resizing the window ^.^".limit_size(area.size());
18
19 // `center_size` returns a position in the center of the `Area` according to a passed in size.
20 let pos_0 = area.center_rect(text_0.rect()).pos;
21 let pos_1 = area.center_rect(text_1.rect()).pos.map_y(|y| y + 1);
22
23 area.push_all(vec![
24 DrawCall::new(pos_0, DrawCallKind::PrintLine(text_0)),
25 DrawCall::new(pos_1, DrawCallKind::PrintLine(text_1)),
26 ]);
27}pub fn pos(&self) -> Pair<Pos>
pub fn kind(&self) -> &DrawCallKind
pub fn rect(&self) -> Rect
pub fn size(&self) -> Pair<Size>
Source§impl DrawCall<NonAbsolute>
impl DrawCall<NonAbsolute>
Trait Implementations§
impl<IsAbsolute: Eq> Eq for DrawCall<IsAbsolute>
impl<IsAbsolute> StructuralPartialEq for DrawCall<IsAbsolute>
Auto Trait Implementations§
impl<IsAbsolute> Freeze for DrawCall<IsAbsolute>
impl<IsAbsolute> RefUnwindSafe for DrawCall<IsAbsolute>where
IsAbsolute: RefUnwindSafe,
impl<IsAbsolute> Send for DrawCall<IsAbsolute>where
IsAbsolute: Send,
impl<IsAbsolute> Sync for DrawCall<IsAbsolute>where
IsAbsolute: Sync,
impl<IsAbsolute> Unpin for DrawCall<IsAbsolute>where
IsAbsolute: Unpin,
impl<IsAbsolute> UnwindSafe for DrawCall<IsAbsolute>where
IsAbsolute: UnwindSafe,
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