valkyrie-ast 0.0.5

Strong typed abstract syntax tree of valkyrie language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use core::fmt::{Display, Formatter};

pub fn comma_terms<T: Display>(f: &mut Formatter<'_>, input: &[T]) -> core::fmt::Result {
    let mut terms = input.iter();
    match terms.next() {
        Some(term) => Display::fmt(term, f)?,
        None => return Ok(()),
    }
    for term in terms {
        write!(f, ", {}", term)?;
    }
    Ok(())
}