我一整天都在研究以下代码,(这是围栏)
/// The rule that moves state from one to another.
///
/// `S` - the type parameter of state.
///
/// `T` - the type parameter of input symbol.
#[deriving(PartialEq, Eq, Hash)]
pub struct Rule<S, T> {
pub state: S,
pub symbol: Option<T>,
pub next_state: S
}
impl<S: PartialEq, T: PartialEq> Rule<S, T> {
/// determine whether the rule applies to the given state and symbol
pub fn apply_to(&self, state: &S, symbol: &Option<T>) -> bool {
self.state …Run Code Online (Sandbox Code Playgroud) rust ×1