pub struct PtySize {
pub rows: u16,
pub cols: u16,
pub pixel_width: u16,
pub pixel_height: u16,
}Expand description
PTY character-grid and optional pixel dimensions.
Self::new guarantees at least one row and column. Public fields and
deserialization bypass that invariant; portable conversion clamps them again.
Pixel values are passed through exactly, with zero conventionally meaning
unavailable/unspecified rather than one pixel.
§Examples
use ailloli_ui_terminal_pty::PtySize;
assert_eq!(PtySize::new(24, 80, 800, 600).cols, 80);
assert_eq!(PtySize::new(0, 0, 0, 0).rows, 1);Fields§
§rows: u16Character-cell rows; constructor-valid range is 1..=u16::MAX.
cols: u16Character-cell columns; constructor-valid range is 1..=u16::MAX.
pixel_width: u16Total pixel width, or zero when unspecified.
pixel_height: u16Total pixel height, or zero when unspecified.
Implementations§
Source§impl PtySize
impl PtySize
Sourcepub const fn new(
rows: u16,
cols: u16,
pixel_width: u16,
pixel_height: u16,
) -> Self
pub const fn new( rows: u16, cols: u16, pixel_width: u16, pixel_height: u16, ) -> Self
Creates dimensions, independently replacing zero rows/columns with one.
Pixel dimensions, including zero, are unchanged.
§Examples
use ailloli_ui_terminal_pty::PtySize;
let size = PtySize::new(0, 0, 20, 30);
assert_eq!((size.rows, size.cols, size.pixel_width, size.pixel_height), (1, 1, 20, 30));Trait Implementations§
Source§impl<'de> Deserialize<'de> for PtySize
impl<'de> Deserialize<'de> for PtySize
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for PtySize
impl Eq for PtySize
impl StructuralPartialEq for PtySize
Auto Trait Implementations§
impl Freeze for PtySize
impl RefUnwindSafe for PtySize
impl Send for PtySize
impl Sync for PtySize
impl Unpin for PtySize
impl UnwindSafe for PtySize
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.