create_parser

Function create_parser 

Source
pub fn create_parser(platform: Platform) -> Box<dyn Parser>
Expand description

Creates a parser for the specified platform with default configuration.

This is the primary factory function for creating parsers dynamically. The returned parser loads the entire file into memory, which is suitable for files up to ~500MB.

For larger files, use create_streaming_parser instead.

§Examples

use chatpack::parser::{Platform, create_parser};

let parser = create_parser(Platform::Telegram);
assert_eq!(parser.name(), "Telegram");
assert_eq!(parser.platform(), Platform::Telegram);

§Panics

Panics if the corresponding feature is not enabled. Enable features in Cargo.toml:

[dependencies]
chatpack = { version = "0.5", features = ["telegram"] }