Trait SizeDesc

pub trait SizeDesc {
    // Required method
    fn in_pixels<T>(&self, parent: &T) -> i32
       where T: HasDimension;
}
Expand description

The trait that describes a size, it may be a relative size which the size is determined by the parent size, e.g., 10% of the parent width

Required Methods§

fn in_pixels<T>(&self, parent: &T) -> i32
where T: HasDimension,

Convert the size into the number of pixels

  • parent: The reference to the parent container of this size
  • returns: The number of pixels

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl SizeDesc for f32

§

fn in_pixels<D>(&self, _parent: &D) -> i32
where D: HasDimension,

§

impl SizeDesc for f64

§

fn in_pixels<D>(&self, _parent: &D) -> i32
where D: HasDimension,

§

impl SizeDesc for i32

§

fn in_pixels<D>(&self, _parent: &D) -> i32
where D: HasDimension,

§

impl SizeDesc for u32

§

fn in_pixels<D>(&self, _parent: &D) -> i32
where D: HasDimension,

Implementors§