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
|
||||
/target
|
||||
/target/*
|
||||
/Cargo.lock
|
||||
@ -1,8 +1,5 @@
|
||||
[package]
|
||||
name = "untitled"
|
||||
version = "0.1.0"
|
||||
name = "source_stream_0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lib]
|
||||
15
src/lib.rs
15
src/lib.rs
@ -4,7 +4,7 @@ pub trait Predicate<C> {
|
||||
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 {
|
||||
return self(chr);
|
||||
}
|
||||
@ -30,15 +30,4 @@ pub trait SourceStream<C, P: Pos, CS: CollectedSubstring<C>> {
|
||||
|
||||
fn pos(&mut self) -> P;
|
||||
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