Make send_set_from helper

This commit is contained in:
Richard Feldman 2019-11-30 22:14:31 -05:00
parent 4e6fcd0eb0
commit fde17405f5

View file

@ -6,7 +6,7 @@ use roc::can::expr::Expr;
use roc::can::problem::Problem; use roc::can::problem::Problem;
use roc::can::symbol::Symbol; use roc::can::symbol::Symbol;
use roc::can::Output; use roc::can::Output;
use roc::collections::{ImMap, MutMap}; use roc::collections::{ImMap, MutMap, SendSet};
use roc::ident::Ident; use roc::ident::Ident;
use roc::parse; use roc::parse;
use roc::parse::ast::{self, Attempting}; use roc::parse::ast::{self, Attempting};
@ -110,6 +110,21 @@ where
answer answer
} }
#[allow(dead_code)]
pub fn send_set_from<V, I>(elems: I) -> SendSet<V>
where
I: IntoIterator<Item = V>,
V: Hash + Eq + Clone,
{
let mut answer = SendSet::default();
for elem in elems {
answer.insert(elem);
}
answer
}
#[allow(dead_code)] #[allow(dead_code)]
pub fn fixtures_dir<'a>() -> PathBuf { pub fn fixtures_dir<'a>() -> PathBuf {
Path::new("tests").join("fixtures").join("build") Path::new("tests").join("fixtures").join("build")