I have a tokenizer superclass that can tokenize on an arbitrary string _string. I want to implement some "simple" tokenizers that can tokenize on common delimiters like space, newline, etc.
I have the following code:
api.rs
pub struct StringTokenizer { _string: &'static str }
The first subclass I'm trying to implement is a space tokenizer, so _string will be " ".
I tried to following:
simple.rs
use api::StringTokenizer;
impl StringTokenizer for SpaceTokenizer {
let _string = " ";
}
and got the following error:
error: expected one of
const,extern,fn,pub,type,unsafe, or}, foundlet
How can I give _string the value of " " in the subclass of StringTokenizer?