Fix in Predicate trait and build file
This commit is contained in:
parent
525ba5d370
commit
730742639d
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/.idea
|
/.idea
|
||||||
/target
|
/target/*
|
||||||
|
/Cargo.lock
|
||||||
@ -1,8 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "untitled"
|
name = "source_stream_0"
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
13
src/lib.rs
13
src/lib.rs
@ -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);
|
||||||
}
|
}
|
||||||
@ -31,14 +31,3 @@ 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;
|
|
||||||
// }
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user