Download packages/tauri-plugins/plugins/nfc/src/models.rs from echodict/readest: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/datasets/echodict/readest/resolve/main/packages/tauri-plugins/plugins/nfc/src/models.rs
- Command line
-
hf download hf://datasets/echodict/readest/packages/tauri-plugins/plugins/nfc/src/models.rs
-
curl -L -o models.rs https://huggingface.co/datasets/echodict/readest/resolve/main/packages/tauri-plugins/plugins/nfc/src/models.rs
2.63 kB
| // Copyright 2019-2023 Tauri Programme within The Commons Conservancy | |
| // SPDX-License-Identifier: Apache-2.0 | |
| // SPDX-License-Identifier: MIT | |
| use serde::{Deserialize, Serialize, Serializer}; | |
| use std::fmt::Display; | |
| pub struct ScanRequest { | |
| pub kind: ScanKind, | |
| pub keep_session_alive: bool, | |
| } | |
| pub struct NfcRecord { | |
| pub format: NFCTypeNameFormat, | |
| pub kind: Vec<u8>, | |
| pub id: Vec<u8>, | |
| pub payload: Vec<u8>, | |
| } | |
| pub enum NFCTypeNameFormat { | |
| Empty = 0, | |
| NfcWellKnown = 1, | |
| Media = 2, | |
| AbsoluteURI = 3, | |
| NfcExternal = 4, | |
| Unknown = 5, | |
| Unchanged = 6, | |
| } | |
| pub struct NfcTagRecord { | |
| pub tnf: NFCTypeNameFormat, | |
| pub kind: Vec<u8>, | |
| pub id: Vec<u8>, | |
| pub payload: Vec<u8>, | |
| } | |
| pub struct NfcTag { | |
| pub id: String, | |
| pub kind: String, | |
| pub records: Vec<NfcTagRecord>, | |
| } | |
| pub struct ScanResponse { | |
| pub tag: NfcTag, | |
| } | |
| pub struct UriFilter { | |
| scheme: Option<String>, | |
| host: Option<String>, | |
| path_prefix: Option<String>, | |
| } | |
| pub enum TechKind { | |
| IsoDep, | |
| MifareClassic, | |
| MifareUltralight, | |
| Ndef, | |
| NdefFormatable, | |
| NfcA, | |
| NfcB, | |
| NfcBarcode, | |
| NfcF, | |
| NfcV, | |
| } | |
| impl Display for TechKind { | |
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | |
| write!( | |
| f, | |
| "{}", | |
| match self { | |
| Self::IsoDep => "IsoDep", | |
| Self::MifareClassic => "MifareClassic", | |
| Self::MifareUltralight => "MifareUltralight", | |
| Self::Ndef => "Ndef", | |
| Self::NdefFormatable => "NdefFormatable", | |
| Self::NfcA => "NfcA", | |
| Self::NfcB => "NfcB", | |
| Self::NfcBarcode => "NfcBarcode", | |
| Self::NfcF => "NfcF", | |
| Self::NfcV => "NfcV", | |
| } | |
| ) | |
| } | |
| } | |
| impl Serialize for TechKind { | |
| fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | |
| where | |
| S: Serializer, | |
| { | |
| serializer.serialize_str(&self.to_string()) | |
| } | |
| } | |
| pub enum ScanKind { | |
| Ndef { | |
| mime_type: Option<String>, | |
| uri: Option<UriFilter>, | |
| tech_list: Option<Vec<Vec<TechKind>>>, | |
| }, | |
| Tag { | |
| mime_type: Option<String>, | |
| uri: Option<UriFilter>, | |
| }, | |
| } | |