1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

Merge pull request #21 from krakow10/split_at

Use split_at in EntitiesIter
This commit is contained in:
Robin Appelman 2025-03-02 18:28:45 +01:00 committed by GitHub
commit d8f3018106
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,12 +35,11 @@ impl<'a> Iterator for EntitiesIter<'a> {
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
let start = self.buf.find('{')?; let start = self.buf.find('{')?;
let end = start + self.buf[start..].find('}')?; let slice = &self.buf[start..];
let end = slice.find('}')?;
let out = &self.buf[start..end + 1]; let (out, rest) = slice.split_at(end + 1);
self.buf = &self.buf[end + 1..];
self.buf = rest;
Some(RawEntity { buf: out }) Some(RawEntity { buf: out })
} }
} }