pub struct NfcEffects<'a, 'b, S: AppState> { /* private fields */ }Expand description
Convenience builder for standard NFC host capabilities.
Implementations§
Source§impl<'a, 'b, S: AppState> NfcEffects<'a, 'b, S>
impl<'a, 'b, S: AppState> NfcEffects<'a, 'b, S>
Sourcepub fn availability(self) -> EffectBuilder<'a, 'b, S>
pub fn availability(self) -> EffectBuilder<'a, 'b, S>
Queries whether NFC is supported, enabled, and which NFC modes are available.
Use this before showing scan/write controls so the UI can distinguish a missing NFC chip from a disabled adapter or unsupported operation.
Sourcepub fn scan_tag(self, request: NfcScanRequest) -> EffectBuilder<'a, 'b, S>
pub fn scan_tag(self, request: NfcScanRequest) -> EffectBuilder<'a, 'b, S>
Starts a one-shot NFC scan session.
request declares allowed technologies, optional user-facing prompt text,
timeout, and whether multiple records should be collected. The success
action receives an NfcTag when the host reads a compatible tag.
Sourcepub fn write_tag(self, request: NfcWriteRequest) -> EffectBuilder<'a, 'b, S>
pub fn write_tag(self, request: NfcWriteRequest) -> EffectBuilder<'a, 'b, S>
Starts an NFC tag write session.
request.records contains the portable NDEF-like records to write. Hosts
may require the user to tap a writable tag after the operation starts and
may reject read-only or incompatible tags.
Sourcepub fn emulate_tag(
self,
request: NfcEmulationRequest,
) -> EffectBuilder<'a, 'b, S>
pub fn emulate_tag( self, request: NfcEmulationRequest, ) -> EffectBuilder<'a, 'b, S>
Requests host NFC card emulation for the supplied records.
Use this only on platforms and devices that support card emulation for the product scenario. Many hosts support scanning but not emulation.
Sourcepub fn cancel_session(self) -> EffectBuilder<'a, 'b, S>
pub fn cancel_session(self) -> EffectBuilder<'a, 'b, S>
Cancels the active NFC session, if one is running.
Use this when the user dismisses the screen that started scanning, writing, or emulation. Hosts may return success when no session is active.
Auto Trait Implementations§
impl<'a, 'b, S> Freeze for NfcEffects<'a, 'b, S>
impl<'a, 'b, S> !RefUnwindSafe for NfcEffects<'a, 'b, S>
impl<'a, 'b, S> Send for NfcEffects<'a, 'b, S>
impl<'a, 'b, S> Sync for NfcEffects<'a, 'b, S>
impl<'a, 'b, S> Unpin for NfcEffects<'a, 'b, S>
impl<'a, 'b, S> UnsafeUnpin for NfcEffects<'a, 'b, S>
impl<'a, 'b, S> !UnwindSafe for NfcEffects<'a, 'b, S>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.