Neaten up stdlib code (#1017)
This commit is contained in:
@ -31,7 +31,7 @@ pub struct StdLib {
|
|||||||
|
|
||||||
impl StdLib {
|
impl StdLib {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let internal_fns: Vec<Box<(dyn crate::docs::StdLibFn)>> = vec![
|
let internal_fns: [Box<dyn crate::docs::StdLibFn>; 55] = [
|
||||||
Box::new(Show),
|
Box::new(Show),
|
||||||
Box::new(LegLen),
|
Box::new(LegLen),
|
||||||
Box::new(LegAngX),
|
Box::new(LegAngX),
|
||||||
@ -88,11 +88,10 @@ impl StdLib {
|
|||||||
Box::new(crate::std::math::Log10),
|
Box::new(crate::std::math::Log10),
|
||||||
Box::new(crate::std::math::Ln),
|
Box::new(crate::std::math::Ln),
|
||||||
];
|
];
|
||||||
|
let fns = internal_fns
|
||||||
let mut fns = HashMap::new();
|
.into_iter()
|
||||||
for internal_fn in &internal_fns {
|
.map(|internal_fn| (internal_fn.name(), internal_fn))
|
||||||
fns.insert(internal_fn.name().to_string(), internal_fn.clone());
|
.collect();
|
||||||
}
|
|
||||||
|
|
||||||
Self { fns }
|
Self { fns }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user