Fix in Predicate trait and build file

This commit is contained in:
Andrew Golovashevich 2025-11-09 15:13:13 +03:00
parent 525ba5d370
commit 730742639d
3 changed files with 5 additions and 18 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
/.idea /.idea
/target /target/*
/Cargo.lock

View File

@ -1,8 +1,5 @@
[package] [package]
name = "untitled" name = "source_stream_0"
version = "0.1.0"
edition = "2024" edition = "2024"
[dependencies]
[lib] [lib]

View File

@ -4,7 +4,7 @@ pub trait Predicate<C> {
fn check(&mut self, chr: C) -> bool; fn check(&mut self, chr: C) -> bool;
} }
impl<C> Predicate<C> for fn(C) -> bool { impl<C, F: FnMut(C) -> bool> Predicate<C> for F {
fn check(&mut self, chr: C) -> bool { fn check(&mut self, chr: C) -> bool {
return self(chr); return self(chr);
} }
@ -30,15 +30,4 @@ pub trait SourceStream<C, P: Pos, CS: CollectedSubstring<C>> {
fn pos(&mut self) -> P; fn pos(&mut self) -> P;
fn currentChar(&mut self) -> C; fn currentChar(&mut self) -> C;
} }
//
// fn sandbox<P: Pos, CS: CollectedSubstring<char>>(ctx: &mut impl SourceStream<char, P, CS>) {
// let x = "1324";
// let y = ['a'];
// ctx.collect(|c: &char| -> bool {
// return true;
// }).compareKeyword(&y);
//
// return;
// }