Add try_seek to seek when possible

Signed-off-by: trivernis <trivernis@protonmail.com>
master
trivernis 3 years ago
parent 89a866cb92
commit 0c003fe278
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,6 +1,6 @@
[package]
name = "charred"
version = "0.3.4"
version = "0.3.5"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"
license-file = "LICENSE"

@ -118,6 +118,13 @@ impl CharTapeMachine {
}
}
/// Seeks one character and returns
/// if it seeked or an error occurred
#[inline]
pub fn try_seek(&mut self) -> bool {
self.seek_one().is_ok()
}
/// Seeks any character of the given group until none is encountered anymore
pub fn seek_any(&mut self, chars: &[char]) -> TapeResult<()> {
while self.check_any(chars) {

Loading…
Cancel
Save