#[repr(C)]pub struct PulseWidth { /* private fields */ }
Available on crate feature
firmware
only.Expand description
The pulse width.
Implementations§
Source§impl PulseWidth
impl PulseWidth
Sourcepub const fn new(pulse_width: u32) -> Self
pub const fn new(pulse_width: u32) -> Self
Creates a new PulseWidth
.
Note that the period depends on the firmware version, so it is recommended to use PulseWidth::from_duty
instead.
Sourcepub fn from_duty(duty: f32) -> Result<Self, PulseWidthError>
pub fn from_duty(duty: f32) -> Result<Self, PulseWidthError>
Creates a new PulseWidth
from duty ratio.
Sourcepub fn pulse_width<T>(self, period: u32) -> Result<T, PulseWidthError>
pub fn pulse_width<T>(self, period: u32) -> Result<T, PulseWidthError>
Returns the pulse width.
Trait Implementations§
Source§impl Clone for PulseWidth
impl Clone for PulseWidth
Source§fn clone(&self) -> PulseWidth
fn clone(&self) -> PulseWidth
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 PulseWidth
impl Debug for PulseWidth
Source§impl PartialEq for PulseWidth
impl PartialEq for PulseWidth
Source§impl PartialOrd for PulseWidth
impl PartialOrd for PulseWidth
impl Copy for PulseWidth
impl StructuralPartialEq for PulseWidth
Auto Trait Implementations§
impl Freeze for PulseWidth
impl RefUnwindSafe for PulseWidth
impl Send for PulseWidth
impl Sync for PulseWidth
impl Unpin for PulseWidth
impl UnwindSafe for PulseWidth
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.