NLinker icon

Why does it compile?

NLinker | PRO | 09/23/21 12:41:45 PM UTC | 0 ⭐ | 8524 👁️ | Never ⏰ | []
Rust |

940 B

|

None

|

0 👍

/

0 👎

// TODO make an MRE for it
 
fn build_tree(
    rep: &[u8],
    i: &mut usize,
    parent: Option<&String>,
    tree: &mut ViewTree<String, Custom>,
) -> Option<()> {
    let acceptable = b"( ,)";
    let mut is_gathering = true;
    let mut buf = String::with_capacity(3);
    let mut node = parent;
    while *i < rep.len() {
        let x = rep[*i];
        if is_gathering {
            if x.is_ascii_alphanumeric() {
                buf.push(x as char);
                *i += 1;
            } else if acceptable.contains(&x) {
                tree.add_child_node(buf.clone(), parent, Custom {
                    state: State::Pending,
                    name: format!("{}_payload", buf)
                });
                node = Some(&buf);
                buf.clear();
                is_gathering = false;
            } else {
                return None;
            }
        } else  {
 
        }
    }
    Some(())
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎