[−][src]Struct fafreplay::scfa::ParserBuilder
Methods
impl ParserBuilder
[src]
pub fn new() -> ParserBuilder
[src]
Initialize with default options
pub fn build(self) -> Parser
[src]
Creates a new Parser
by moving the internal ParserOptions
and consuming self.
Example
use fafreplay::scfa::*; let parser = ParserBuilder::new() .commands(&[ replay_command::ADVANCE, replay_command::VERIFY_CHECKSUM, replay_command::END_GAME ]) .build();
pub fn build_clone(&self) -> Parser
[src]
Creates a new Parser
by cloning the internal ParserOptions
. Useful when constructing
many parsers with similar options.
Example
use fafreplay::scfa::*; let mut builder = ParserBuilder::new() .commands(&[ replay_command::ADVANCE, replay_command::END_GAME ]); // Can only count game ticks let tick_parser = builder.build_clone(); let builder = builder.command(replay_command::VERIFY_CHECKSUM); // Can count game ticks and detect desyncs let desync_parser = builder.build_clone(); let builder = builder.command(replay_command::LUA_SIM_CALLBACK); // Can count game ticks, detect desyncs, and extract chat messages let message_parser = builder.build();
pub fn command(self, command: u8) -> ParserBuilder
[src]
Add a command to the ParserOptions
.
pub fn commands(self, commands: &[u8]) -> ParserBuilder
[src]
Add multiple commands to the ParserOptions
.
pub fn commands_all(self) -> ParserBuilder
[src]
Add all supported commands to the ParserOptions
.
pub fn commands_default(self) -> ParserBuilder
[src]
Add the default set of commands to the ParserOptions
.
Default commands are ADVANCE
, SET_COMMAND_SOURCE
, COMMAND_SOURCE_TERMINATED
,
VERIFY_CHECKSUM
, and END_GAME
pub fn limit(self, limit: Option<usize>) -> ParserBuilder
[src]
Set a limit on the number of commands to parse. This only applies to commands in the
ParserOptions.commands
field.
pub fn save_commands(self, save_commands: bool) -> ParserBuilder
[src]
Whether or not to store the parsed commands in the parsed ReplayBody
. When set to false,
Replay.body.commands.len()
will always be 0
.
Auto Trait Implementations
impl Send for ParserBuilder
impl Unpin for ParserBuilder
impl Sync for ParserBuilder
impl UnwindSafe for ParserBuilder
impl RefUnwindSafe for ParserBuilder
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,