pub fn len_closure(mut params: Vec<Box<dyn Value>>, _ctx: LockableContext) -> ValueResult {
    if params.len() == 1 {
        let first = params.remove(0);
        let type_name = first.get_type_name();
        match type_name {
            "list" => {
                let first = first.downcast::<ListValue>().unwrap();
                IntegerValue::boxed(first.values.len() as i64)
            }
            "dict" => {
                let first = first.downcast::<DictValue>().unwrap();
                IntegerValue::boxed(first.values.len() as i64)
            }
            _ => {
                CashError::InvalidArguments(type_name.to_owned(), "List or Dict".to_owned()).boxed()
            }
        }
    } else {
        CashError::InvalidParameterCount(params.len(), 1).boxed()
    }
}
/// Takes exactly 1 param
/// first: a list/dict
Takes exactly 1 param
first: a list/dict
Takes exactly 1 param first : a list / dict
pub fn len_closure(mut params: Vec<Box<dyn Value>>, _ctx: LockableContext) -> ValueResult {
    if params.len() == 1 {
        let first = params.remove(0);
        let type_name = first.get_type_name();
        match type_name {
            "list" => {
                let first = first.downcast::<ListValue>().unwrap();
                IntegerValue::boxed(first.values.len() as i64)
            }
            "dict" => {
                let first = first.downcast::<DictValue>().unwrap();
                IntegerValue::boxed(first.values.len() as i64)
            }
            _ => {
                CashError::InvalidArguments(type_name.to_owned(), "List or Dict".to_owned()).boxed()
            }
        }
    } else {
        CashError::InvalidParameterCount(params.len(), 1).boxed()
    }
}
pub fn len_closure ( mut params : Vec < Box < dyn Value > > , _ctx : LockableContext ) -> ValueResult { if params . len ( ) == 1 { let first = params . remove ( 0 ) ; let type_name = first . get_type_name ( ) ; match type_name { " " => { let first = first . downcast :: < ListValue > ( ) . unwrap ( ) ; IntegerValue :: boxed ( first . values . len ( ) as i64 ) } " " => { let first = first . downcast :: < DictValue > ( ) . unwrap ( ) ; IntegerValue :: boxed ( first . values . len ( ) as i64 ) } _ => { CashError :: InvalidArguments ( type_name . to_owned ( ) , " " . to_owned ( ) ) . boxed ( ) } } } else { CashError :: InvalidParameterCount ( params . len ( ) , 1 ) . boxed ( ) } }
Takes exactly 1 param
first: a list/dict
Takes exactly 1 param first : a list / dict
params
Vec<Box<dyn Value>>
_ctx
LockableContext
params
Vec<Box<dyn Value>>
_ctx
LockableContext