mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
formatting for Defs
This commit is contained in:
parent
2ae804790a
commit
d72ebf4b74
7 changed files with 57 additions and 25 deletions
|
@ -345,6 +345,15 @@ pub struct Defs<'a> {
|
|||
pub value_defs: std::vec::Vec<ValueDef<'a>>,
|
||||
}
|
||||
|
||||
impl<'a> Defs<'a> {
|
||||
pub fn defs(&self) -> impl Iterator<Item = Result<&TypeDef<'a>, &ValueDef<'a>>> {
|
||||
self.tags.iter().map(|tag| match tag.split() {
|
||||
Ok(type_index) => Ok(&self.type_defs[type_index.index()]),
|
||||
Err(value_index) => Err(&self.value_defs[value_index.index()]),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Def<'a> {
|
||||
Type(TypeDef<'a>),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue