DiscordParser

Struct DiscordParser 

Source
pub struct DiscordParser { /* private fields */ }
Expand description

Parser for Discord exports (from DiscordChatExporter). Supports JSON, TXT, and CSV formats.

§Example

use chatpack::parsers::DiscordParser;
use chatpack::parser::Parser;

let parser = DiscordParser::new();
let messages = parser.parse("discord_export.json".as_ref())?;

Implementations§

Source§

impl DiscordParser

Source

pub fn new() -> Self

Creates a new parser with default configuration.

Source

pub fn with_config(config: DiscordConfig) -> Self

Creates a parser with custom configuration.

Source

pub fn with_streaming() -> Self

Creates a parser optimized for streaming large files.

Source

pub fn config(&self) -> &DiscordConfig

Returns the current configuration.

Trait Implementations§

Source§

impl Default for DiscordParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Parser for DiscordParser

Source§

fn name(&self) -> &'static str

Returns the human-readable name of this parser. Read more
Source§

fn platform(&self) -> Platform

Returns the platform this parser handles.
Source§

fn parse(&self, path: &Path) -> Result<Vec<Message>, ChatpackError>

Parses a chat export file and returns all messages. Read more
Source§

fn parse_str(&self, content: &str) -> Result<Vec<Message>, ChatpackError>

Parses chat content from a string. Read more
Source§

fn stream( &self, path: &Path, ) -> Result<Box<dyn Iterator<Item = Result<Message, ChatpackError>> + Send>, ChatpackError>

Streams messages from a file for memory-efficient processing. Read more
Source§

fn supports_streaming(&self) -> bool

Returns whether this parser supports native streaming. Read more
Source§

fn recommended_buffer_size(&self) -> usize

Returns the recommended buffer size for streaming. Read more
Source§

fn parse_file(&self, path: &str) -> Result<Vec<Message>, ChatpackError>

Parses a chat export file (convenience method accepting &str path). Read more
Source§

fn stream_file( &self, path: &str, ) -> Result<Box<dyn Iterator<Item = Result<Message, ChatpackError>> + Send>, ChatpackError>

Streams messages (convenience method accepting &str path).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.