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
impl DiscordParser
Sourcepub fn with_config(config: DiscordConfig) -> Self
pub fn with_config(config: DiscordConfig) -> Self
Creates a parser with custom configuration.
Sourcepub fn with_streaming() -> Self
pub fn with_streaming() -> Self
Creates a parser optimized for streaming large files.
Sourcepub fn config(&self) -> &DiscordConfig
pub fn config(&self) -> &DiscordConfig
Returns the current configuration.
Trait Implementations§
Source§impl Default for DiscordParser
impl Default for DiscordParser
Source§impl Parser for DiscordParser
impl Parser for DiscordParser
Source§fn parse(&self, path: &Path) -> Result<Vec<Message>, ChatpackError>
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>
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>
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
fn supports_streaming(&self) -> bool
Returns whether this parser supports native streaming. Read more
Source§fn recommended_buffer_size(&self) -> usize
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>
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>
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§
impl Freeze for DiscordParser
impl RefUnwindSafe for DiscordParser
impl Send for DiscordParser
impl Sync for DiscordParser
impl Unpin for DiscordParser
impl UnwindSafe for DiscordParser
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
Mutably borrows from an owned value. Read more