pub struct ScaledPixels(/* private fields */);Expand description
Represents scaled pixels that take into account the device’s scale factor.
ScaledPixels are used to ensure that UI elements appear at the correct size on devices
with different pixel densities. When a device has a higher scale factor (such as Retina displays),
a single logical pixel may correspond to multiple physical pixels. By using ScaledPixels,
dimensions and positions can be specified in a way that scales appropriately across different
display resolutions.
Implementations§
Source§impl ScaledPixels
impl ScaledPixels
Sourcepub fn floor(&self) -> Self
pub fn floor(&self) -> Self
Floors the ScaledPixels value to the nearest whole number.
§Returns
Returns a new ScaledPixels instance with the floored value.
Trait Implementations§
Source§impl Add for ScaledPixels
impl Add for ScaledPixels
Source§type Output = ScaledPixels
type Output = ScaledPixels
The resulting type after applying the
+ operator.Source§fn add(self, rhs: ScaledPixels) -> ScaledPixels
fn add(self, rhs: ScaledPixels) -> ScaledPixels
Performs the
+ operation. Read moreSource§impl AddAssign for ScaledPixels
impl AddAssign for ScaledPixels
Source§fn add_assign(&mut self, rhs: ScaledPixels)
fn add_assign(&mut self, rhs: ScaledPixels)
Performs the
+= operation. Read moreSource§impl Clone for ScaledPixels
impl Clone for ScaledPixels
Source§fn clone(&self) -> ScaledPixels
fn clone(&self) -> ScaledPixels
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScaledPixels
impl Debug for ScaledPixels
Source§impl Default for ScaledPixels
impl Default for ScaledPixels
Source§fn default() -> ScaledPixels
fn default() -> ScaledPixels
Returns the “default value” for a type. Read more
Source§impl<__RhsT> Div<__RhsT> for ScaledPixels
impl<__RhsT> Div<__RhsT> for ScaledPixels
Source§type Output = ScaledPixels
type Output = ScaledPixels
The resulting type after applying the
/ operator.Source§fn div(self, rhs: __RhsT) -> ScaledPixels
fn div(self, rhs: __RhsT) -> ScaledPixels
Performs the
/ operation. Read moreSource§impl Div for ScaledPixels
impl Div for ScaledPixels
Source§impl<__RhsT> DivAssign<__RhsT> for ScaledPixels
impl<__RhsT> DivAssign<__RhsT> for ScaledPixels
Source§fn div_assign(&mut self, rhs: __RhsT)
fn div_assign(&mut self, rhs: __RhsT)
Performs the
/= operation. Read moreSource§impl DivAssign for ScaledPixels
impl DivAssign for ScaledPixels
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl From<DevicePixels> for ScaledPixels
impl From<DevicePixels> for ScaledPixels
Source§fn from(device: DevicePixels) -> Self
fn from(device: DevicePixels) -> Self
Converts to this type from the input type.
Source§impl From<ScaledPixels> for DevicePixels
impl From<ScaledPixels> for DevicePixels
Source§fn from(scaled: ScaledPixels) -> Self
fn from(scaled: ScaledPixels) -> Self
Converts to this type from the input type.
Source§impl From<ScaledPixels> for f64
impl From<ScaledPixels> for f64
Source§fn from(scaled_pixels: ScaledPixels) -> Self
fn from(scaled_pixels: ScaledPixels) -> Self
Converts to this type from the input type.
Source§impl From<ScaledPixels> for u32
impl From<ScaledPixels> for u32
Source§fn from(pixels: ScaledPixels) -> Self
fn from(pixels: ScaledPixels) -> Self
Converts to this type from the input type.
Source§impl From<f32> for ScaledPixels
impl From<f32> for ScaledPixels
Source§impl Half for ScaledPixels
impl Half for ScaledPixels
Source§impl IsZero for ScaledPixels
impl IsZero for ScaledPixels
Source§impl Mul<ScaledPixels> for f32
impl Mul<ScaledPixels> for f32
Source§type Output = ScaledPixels
type Output = ScaledPixels
The resulting type after applying the
* operator.Source§impl Mul<ScaledPixels> for usize
impl Mul<ScaledPixels> for usize
Source§type Output = ScaledPixels
type Output = ScaledPixels
The resulting type after applying the
* operator.Source§fn mul(self, rhs: ScaledPixels) -> ScaledPixels
fn mul(self, rhs: ScaledPixels) -> ScaledPixels
Performs the
* operation. Read moreSource§impl Mul<f32> for ScaledPixels
impl Mul<f32> for ScaledPixels
Source§impl Mul<usize> for ScaledPixels
impl Mul<usize> for ScaledPixels
Source§impl MulAssign<f32> for ScaledPixels
impl MulAssign<f32> for ScaledPixels
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreSource§impl Negate for ScaledPixels
impl Negate for ScaledPixels
Source§impl Ord for ScaledPixels
impl Ord for ScaledPixels
Source§impl PartialEq for ScaledPixels
impl PartialEq for ScaledPixels
Source§impl PartialOrd for ScaledPixels
impl PartialOrd for ScaledPixels
Source§impl Rem for ScaledPixels
impl Rem for ScaledPixels
Source§impl RemAssign for ScaledPixels
impl RemAssign for ScaledPixels
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the
%= operation. Read moreSource§impl Sub for ScaledPixels
impl Sub for ScaledPixels
Source§type Output = ScaledPixels
type Output = ScaledPixels
The resulting type after applying the
- operator.Source§fn sub(self, rhs: ScaledPixels) -> ScaledPixels
fn sub(self, rhs: ScaledPixels) -> ScaledPixels
Performs the
- operation. Read moreSource§impl SubAssign for ScaledPixels
impl SubAssign for ScaledPixels
Source§fn sub_assign(&mut self, rhs: ScaledPixels)
fn sub_assign(&mut self, rhs: ScaledPixels)
Performs the
-= operation. Read moreimpl Copy for ScaledPixels
impl Eq for ScaledPixels
impl StructuralPartialEq for ScaledPixels
Auto Trait Implementations§
impl Freeze for ScaledPixels
impl RefUnwindSafe for ScaledPixels
impl Send for ScaledPixels
impl Sync for ScaledPixels
impl Unpin for ScaledPixels
impl UnwindSafe for ScaledPixels
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<K> MapSeekTarget<K> for Kwhere
K: Ord,
impl<K> MapSeekTarget<K> for Kwhere
K: Ord,
fn cmp_cursor(&self, cursor_location: &K) -> Ordering
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().