pub struct Dimensions { /* private fields */ }Expand description
A (width, height) pair in pixels.
Lives alongside the rest of the frame primitives because the same
pair shows up everywhere a video stream is described — the coded
dimensions of a VideoFrame, the coded_* parameters a backend
adapter takes when opening a decoder, the per-plane layout helpers
in a WebCodecs adapter, etc. Passing it as a single struct rather
than two separate u32 arguments removes a long-running footgun
(silent argument swap) and gives a natural place to hang helpers
like Self::is_zero or Display.
u32 width / height matches WebCodecs’ coded_width /
coded_height typing in web_sys and FFmpeg’s
AVCodecContext::width / height. 65535×65535 (the smaller u16
packing some adjacent crates use) covers every realistic
resolution; the u32 choice here keeps the public API plug-
compatible with both adapter typings.
Implementations§
Source§impl Dimensions
impl Dimensions
Sourcepub const fn new(width: u32, height: u32) -> Dimensions
pub const fn new(width: u32, height: u32) -> Dimensions
Constructs a Dimensions with the specified width and height
in pixels.
Sourcepub const fn with_width(self, width: u32) -> Dimensions
pub const fn with_width(self, width: u32) -> Dimensions
Sets the width (consuming builder).
Sourcepub const fn set_width(&mut self, width: u32) -> &mut Dimensions
pub const fn set_width(&mut self, width: u32) -> &mut Dimensions
Sets the width in place.
Sourcepub const fn with_height(self, height: u32) -> Dimensions
pub const fn with_height(self, height: u32) -> Dimensions
Sets the height (consuming builder).
Sourcepub const fn set_height(&mut self, height: u32) -> &mut Dimensions
pub const fn set_height(&mut self, height: u32) -> &mut Dimensions
Sets the height in place.
Trait Implementations§
Source§impl Clone for Dimensions
impl Clone for Dimensions
Source§fn clone(&self) -> Dimensions
fn clone(&self) -> Dimensions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Dimensions
Source§impl Debug for Dimensions
impl Debug for Dimensions
Source§impl Default for Dimensions
impl Default for Dimensions
Source§fn default() -> Dimensions
fn default() -> Dimensions
Source§impl Display for Dimensions
impl Display for Dimensions
impl Eq for Dimensions
Source§impl Hash for Dimensions
impl Hash for Dimensions
Source§impl PartialEq for Dimensions
impl PartialEq for Dimensions
Source§fn eq(&self, other: &Dimensions) -> bool
fn eq(&self, other: &Dimensions) -> bool
self and other values to be equal, and is used by ==.