mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 12:50:49 +01:00
optimize subjectid
This commit is contained in:
parent
a27d1a8f6b
commit
4819e4c105
4 changed files with 31 additions and 18 deletions
|
|
@ -1,9 +1,8 @@
|
|||
use crate::common::Team;
|
||||
use crate::common::{split_once, Team};
|
||||
use crate::{Error, Result};
|
||||
use crate::{SubjectError, SubjectId};
|
||||
use chrono::{NaiveDate, NaiveDateTime};
|
||||
use logos::{Lexer, Logos};
|
||||
use memchr::memchr;
|
||||
use nom::{IResult, Needed};
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::num::ParseIntError;
|
||||
|
|
@ -136,11 +135,6 @@ pub fn subject_parser(input: &str) -> Result<(&str, RawSubject)> {
|
|||
}
|
||||
}
|
||||
|
||||
fn split_once(input: &str, delim: u8, offset: usize) -> Result<(&str, &str)> {
|
||||
let end = memchr(delim, input.as_bytes()).ok_or(Error::Incomplete)?;
|
||||
Ok((&input[..end], &input[(end + offset)..]))
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Logos)]
|
||||
pub enum RawEventType {
|
||||
#[token(r#"joined"#)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue