1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
/*!
* lemmeknow can be used for identifying mysterious text
* or to analyze hard-coded strings from captured network packets, malwares, or just about anything.
*
* # Usage
*
* If you want to use it as a library and do not want to pretty print output as table
* then set `default-features=false` in your `Cargo.toml`:
*
* ```toml
* [dependencies]
* lemmeknow = { version = "0.7", default-features = false }
* ```
*
* OR by using github repository:
*
* ```toml
* [dependencies]
* lemmeknow = { git = "https://github.com/swanandx/lemmeknow", default-features = false }
* ```
*
* # Example:
*
* Let us say we want to identify a text and then get the output as pretty JSON
*
* ```rust
* use lemmeknow::Identifier;
* let identifier = Identifier::default();
* let result = identifier.identify("UC11L3JDgDQMyH8iolKkVZ4w");
* let result_in_json = Identifier::to_json(&result);
* println!("{result_in_json}");
* ```
*
* If you want to work with bytes, i.e. `[u8]` use [`bytes::Identifier`]
*
* ```rust
* use lemmeknow::bytes::Identifier;
* let identifier = Identifier::default();
* let result = identifier.identify(b"UC11L3JDgDQMyH8iolKkVZ4w");
* let result_in_json = Identifier::to_json(&result);
* println!("{result_in_json}");
* ```
*
* */
pub mod identifier;
pub use self::identifier::bytes;
pub use self::identifier::Identifier;
pub use self::identifier::Match;
use serde::Serialize;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "cli")]
pub mod output;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "cli")]
pub use self::output::PrintMode;
// TODO: Try not to use String
/// structure for parsing data from JSON file.
#[derive(Serialize, Debug, Clone)]
pub struct Data {
pub name: &'static str,
pub regex: &'static str,
boundaryless: &'static str,
pub plural_name: bool,
pub description: Option<&'static str>,
pub rarity: f32,
pub url: Option<&'static str>,
pub tags: &'static [&'static str],
}
// this is DATA
include!(concat!(env!("OUT_DIR"), "/regex_data.rs"));
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}