pub enum ChargerType {
None,
Usb,
ChargingDownstreamPort,
DedicatedChargingPort,
Special500mA,
Special1000mA,
}
Expand description
The type of charger that has been detected
Variants§
None
Nothing attached
Usb
USB cable attached
ChargingDownstreamPort
USB BC1.1 compatible charging downstream port
DedicatedChargingPort
USB BC1.1 dedicated charging port
Special500mA
Special charger: 500mA max
Special1000mA
Special charger: 1A max
Implementations§
Source§impl ChargerType
impl ChargerType
Sourcepub fn can_charge(self) -> bool
pub fn can_charge(self) -> bool
Can the attached port provide charge?
Sourcepub fn current_limit(self) -> u16
pub fn current_limit(self) -> u16
Indicates a (conservative) current limit for the attached port
Usb
ports can provide up to 500mA after negotiation. ChargingDownstreamPort
and
DedicatedChargingPort
may provide up to 5A, but are not required to and may
reduce voltage or shutdown if their current limit is exceeded. A DedicatedChargingPort
is allowed to have a current limit as low as 500mA.
Trait Implementations§
Source§impl Clone for ChargerType
impl Clone for ChargerType
Source§fn clone(&self) -> ChargerType
fn clone(&self) -> ChargerType
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 ChargerType
impl Debug for ChargerType
Source§impl Default for ChargerType
impl Default for ChargerType
Source§fn default() -> ChargerType
fn default() -> ChargerType
Returns the “default value” for a type. Read more
Source§impl Hash for ChargerType
impl Hash for ChargerType
Source§impl Ord for ChargerType
impl Ord for ChargerType
Source§fn cmp(&self, other: &ChargerType) -> Ordering
fn cmp(&self, other: &ChargerType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ChargerType
impl PartialEq for ChargerType
Source§impl PartialOrd for ChargerType
impl PartialOrd for ChargerType
Source§impl Specifier for ChargerType
impl Specifier for ChargerType
Source§type InOut = ChargerType
type InOut = ChargerType
The interface type of the specifier. Read more
Source§fn into_bytes(input: Self::InOut) -> Result<Self::Bytes, OutOfBounds>
fn into_bytes(input: Self::InOut) -> Result<Self::Bytes, OutOfBounds>
Converts some bytes into the in-out type. Read more
Source§fn from_bytes(
bytes: Self::Bytes,
) -> Result<Self::InOut, InvalidBitPattern<Self::Bytes>>
fn from_bytes( bytes: Self::Bytes, ) -> Result<Self::InOut, InvalidBitPattern<Self::Bytes>>
Converts the given bytes into the in-out type. Read more
impl Copy for ChargerType
impl Eq for ChargerType
impl StructuralPartialEq for ChargerType
Auto Trait Implementations§
impl Freeze for ChargerType
impl RefUnwindSafe for ChargerType
impl Send for ChargerType
impl Sync for ChargerType
impl Unpin for ChargerType
impl UnwindSafe for ChargerType
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