pub struct Haptics<R: Runtime>(/* private fields */);Expand description
Access to the haptics APIs.
Implementations§
Source§impl<R: Runtime> Haptics<R>
impl<R: Runtime> Haptics<R>
Sourcepub fn vibrate(&self, duration: u32) -> Result<()>
pub fn vibrate(&self, duration: u32) -> Result<()>
Triggers a vibration for duration milliseconds.
On iOS this plays a continuous Core Haptics
pattern when the device supports it, falling back to the system alert vibration
otherwise. On Android it uses Vibrator.
§Errors
Returns Error::PluginInvoke if the underlying Android or
iOS plugin invocation fails.
Sourcepub fn impact_feedback(&self, style: ImpactFeedbackStyle) -> Result<()>
pub fn impact_feedback(&self, style: ImpactFeedbackStyle) -> Result<()>
Triggers an impact-feedback haptic with the given ImpactFeedbackStyle.
§Errors
Returns Error::PluginInvoke if the underlying Android or
iOS plugin invocation fails.
Sourcepub fn notification_feedback(
&self,
type: NotificationFeedbackType,
) -> Result<()>
pub fn notification_feedback( &self, type: NotificationFeedbackType, ) -> Result<()>
Triggers a notification-feedback haptic for the given NotificationFeedbackType.
§Errors
Returns Error::PluginInvoke if the underlying Android or
iOS plugin invocation fails.
Sourcepub fn selection_feedback(&self) -> Result<()>
pub fn selection_feedback(&self) -> Result<()>
Triggers a haptic indicating that a selection changed, e.g. when the value of a picker control changes.
§Errors
Returns Error::PluginInvoke if the underlying Android or
iOS plugin invocation fails.