pub struct Dimension(/* private fields */);Expand description
A dimension such as 16dp, held in Android’s complex-number encoding,
so decoded values re-encode exactly.
Implementations§
Source§impl Dimension
impl Dimension
Sourcepub fn new(value: f32, unit: DimensionUnit) -> Result<Self, LiteralError>
pub fn new(value: f32, unit: DimensionUnit) -> Result<Self, LiteralError>
Encodes value in unit, which must be finite and below 2^23 in magnitude.
pub fn value(self) -> f32
Sourcepub fn unit(self) -> Option<DimensionUnit>
pub fn unit(self) -> Option<DimensionUnit>
The unit, or None for a unit code Android does not define.
Trait Implementations§
impl Copy for Dimension
impl Eq for Dimension
Source§impl FromStr for Dimension
impl FromStr for Dimension
Source§fn from_str(text: &str) -> Result<Self, LiteralError>
fn from_str(text: &str) -> Result<Self, LiteralError>
Parses <number><unit>, accepting dip as an alias of dp.
Source§type Err = LiteralError
type Err = LiteralError
The associated error which can be returned from parsing.
impl StructuralPartialEq for Dimension
Auto Trait Implementations§
impl Freeze for Dimension
impl RefUnwindSafe for Dimension
impl Send for Dimension
impl Sync for Dimension
impl Unpin for Dimension
impl UnsafeUnpin for Dimension
impl UnwindSafe for Dimension
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> CustomError for T
impl<T> CustomError 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.