pub struct LightLevel(f32);Expand description
The level of light intensity from 0-100.
Tuple Fields§
§0: f32Implementations§
Source§impl LightLevel
impl LightLevel
const ZERO: f32 = 0.0
fn value(&self) -> f32
Sourcepub fn from_fraction(fraction: f32) -> Self
pub fn from_fraction(fraction: f32) -> Self
Given a value between 0.0 and 1, this normalizes LightLevel accordingly to 0-100.
Sourcepub fn as_fraction(&self) -> f32
pub fn as_fraction(&self) -> f32
Returns the level as a value between 0.0-1
Sourcepub fn as_10_base(&self) -> i16
pub fn as_10_base(&self) -> i16
Instead of 0-100, this returns a value between 0-10.
Usefull for e.g. /sys/class/backlight/lm3630a_led/color that accepts
a value between 0-10.
Sourcepub fn as_10_base_inverted(&self) -> i16
pub fn as_10_base_inverted(&self) -> i16
Similar to Self::as_10_base but instead of 10 being max, 0 is max.
Trait Implementations§
Source§impl Clone for LightLevel
impl Clone for LightLevel
Source§fn clone(&self) -> LightLevel
fn clone(&self) -> LightLevel
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 LightLevel
impl Debug for LightLevel
Source§impl Default for LightLevel
The default implementation reutrns 1%, so that the screen can be seen
if the device happens to be turned on in a dark place.
impl Default for LightLevel
The default implementation reutrns 1%, so that the screen can be seen if the device happens to be turned on in a dark place.
Source§impl<'de> Deserialize<'de> for LightLevel
impl<'de> Deserialize<'de> for LightLevel
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
Source§impl Display for LightLevel
impl Display for LightLevel
Source§impl From<LightLevel> for String
impl From<LightLevel> for String
Source§fn from(value: LightLevel) -> Self
fn from(value: LightLevel) -> Self
Converts to this type from the input type.
Source§impl From<LightLevel> for f32
impl From<LightLevel> for f32
Source§fn from(value: LightLevel) -> Self
fn from(value: LightLevel) -> Self
Converts to this type from the input type.
Source§impl From<LightLevel> for i16
impl From<LightLevel> for i16
Source§fn from(value: LightLevel) -> Self
fn from(value: LightLevel) -> Self
Converts to this type from the input type.
Source§impl From<LightLevel> for c_int
impl From<LightLevel> for c_int
Source§fn from(value: LightLevel) -> Self
fn from(value: LightLevel) -> Self
Converts to this type from the input type.
Source§impl From<f32> for LightLevel
impl From<f32> for LightLevel
Source§impl PartialEq<f32> for LightLevel
impl PartialEq<f32> for LightLevel
Source§impl PartialEq for LightLevel
impl PartialEq for LightLevel
Source§impl PartialOrd<f32> for LightLevel
impl PartialOrd<f32> for LightLevel
Source§impl PartialOrd for LightLevel
impl PartialOrd for LightLevel
Source§impl Serialize for LightLevel
impl Serialize for LightLevel
Source§impl Sub<f32> for LightLevel
impl Sub<f32> for LightLevel
impl Copy for LightLevel
impl StructuralPartialEq for LightLevel
Auto Trait Implementations§
impl Freeze for LightLevel
impl RefUnwindSafe for LightLevel
impl Send for LightLevel
impl Sync for LightLevel
impl Unpin for LightLevel
impl UnsafeUnpin for LightLevel
impl UnwindSafe for LightLevel
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.