#[non_exhaustive]pub struct BoxPlace {
pub frame: Rect,
pub text_x: i32,
pub text_y: i32,
pub narration: NarrationAlign,
}Expand description
Where a text box goes on the console. Build it with BoxPlace::new:
a struct literal doesn’t compile outside this crate, so a new field
never breaks a game (ADR-0039).
ⓘ
use shuyi_ui::dialogue::text_box::glyph::{BoxPlace, NarrationAlign};
use shuyi_ui::frame::glyph_buffer::Rect;
const PLACE: BoxPlace = BoxPlace {
frame: Rect::new(0, 18, 48, 6),
text_x: 2,
text_y: 19,
narration: NarrationAlign::Centred,
};Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.frame: RectThe box, border included, when it holds one page.
text_x: i32The column the text starts at.
text_y: i32The row of the text’s first line.
narration: NarrationAlignWhere narration sits: NarrationAlign::Centred or from text_x.
Implementations§
Source§impl BoxPlace
impl BoxPlace
Sourcepub const fn new(frame: Rect, text_x: i32, text_y: i32) -> Self
pub const fn new(frame: Rect, text_x: i32, text_y: i32) -> Self
A box at frame whose text starts at column text_x on row
text_y, with narration Centred
(with_narration changes it).
Sourcepub const fn with_narration(self, narration: NarrationAlign) -> Self
pub const fn with_narration(self, narration: NarrationAlign) -> Self
The place with narration set as narration says: usable in a
const item.
Trait Implementations§
impl Copy for BoxPlace
impl Eq for BoxPlace
impl StructuralPartialEq for BoxPlace
Auto Trait Implementations§
impl Freeze for BoxPlace
impl RefUnwindSafe for BoxPlace
impl Send for BoxPlace
impl Sync for BoxPlace
impl Unpin for BoxPlace
impl UnsafeUnpin for BoxPlace
impl UnwindSafe for BoxPlace
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