pub fn from_value(v: Value) -> Self {
        match v {
            Value::List(mut v, _, false) => {
                if v.len() == 2 && is_mark(&v[1]) {
                    match &v[0] {
                        Value::Map(map) => {
                            return CallArgs(
                                map.iter()
                                    .map(|(k, v)| {
                                        (
                                            match k {
                                                Value::Null => None,
                                                Value::Literal(s, _) => {
                                                    Some(s.clone())
                                                }
                                                _x => None, // TODO return Err(Error::bad_value("string", &x)),
                                            },
                                            v.clone(),
                                        )
                                    })
                                    .collect(),
                            );
                        }
                        Value::List(list, ..) => {
                            return CallArgs(
                                list.iter()
                                    .map(|v| (None, v.clone()))
                                    .collect(),
                            );
                        }
                        _ => (),
                    }
                }
                if let Some(last) = v.pop() {
                    if let Value::List(
                        vv,
                        Some(ListSeparator::Space),
                        false,
                    ) = &last
                    {
                        match &vv[..] {
                            [Value::List(vv, _, _), Value::Literal(mark, Quotes::None)]
                                if mark == "..." =>
                            {
                                v.extend(vv.iter().cloned());
                            }
                            _ => {
                                v.push(last);
                            }
                        }
                    } else {
                        v.push(last);
                    }
                }
                CallArgs(v.into_iter().map(|v| (None, v)).collect())
            }
            Value::Null => CallArgs(vec![]),
            v => CallArgs(vec![(None, v)]),
        }
    }
/// Create args from a Value.
///
/// The value may be a list of arguments or a single argument.
/// There is also special recognition of a list ending in an
/// unquoted "..." string, makring a varargs argument list.
Create args from a Value.
The value may be a list of arguments or a single argument.
There is also special recognition of a list ending in an
unquoted "..." string, makring a varargs argument list.
Create args from a Value . The value may be a list of arguments or a single argument . There is also special recognition of a list ending in an unquoted " ... " string makring a varargs argument list .
pub fn from_value(v: Value) -> Self {
        match v {
            Value::List(mut v, _, false) => {
                if v.len() == 2 && is_mark(&v[1]) {
                    match &v[0] {
                        Value::Map(map) => {
                            return CallArgs(
                                map.iter()
                                    .map(|(k, v)| {
                                        (
                                            match k {
                                                Value::Null => None,
                                                Value::Literal(s, _) => {
                                                    Some(s.clone())
                                                }
                                                _x => None, // TODO return Err(Error::bad_value("string", &x)),
                                            },
                                            v.clone(),
                                        )
                                    })
                                    .collect(),
                            );
                        }
                        Value::List(list, ..) => {
                            return CallArgs(
                                list.iter()
                                    .map(|v| (None, v.clone()))
                                    .collect(),
                            );
                        }
                        _ => (),
                    }
                }
                if let Some(last) = v.pop() {
                    if let Value::List(
                        vv,
                        Some(ListSeparator::Space),
                        false,
                    ) = &last
                    {
                        match &vv[..] {
                            [Value::List(vv, _, _), Value::Literal(mark, Quotes::None)]
                                if mark == "..." =>
                            {
                                v.extend(vv.iter().cloned());
                            }
                            _ => {
                                v.push(last);
                            }
                        }
                    } else {
                        v.push(last);
                    }
                }
                CallArgs(v.into_iter().map(|v| (None, v)).collect())
            }
            Value::Null => CallArgs(vec![]),
            v => CallArgs(vec![(None, v)]),
        }
    }
pub fn from_value ( v : Value ) -> Self { match v { Value :: List ( mut v , _ , false ) => { if v . len ( ) == 2 && is_mark ( & v [ 1 ] ) { match & v [ 0 ] { Value :: Map ( map ) => { return CallArgs ( map . iter ( ) . map ( | ( k , v ) | { ( match k { Value :: Null => None , Value :: Literal ( s , _ ) => { Some ( s . clone ( ) ) } _x => None , // TODO return Err(Error::bad_value("string", &x)), } , v . clone ( ) , ) } ) . collect ( ) , ) ; } Value :: List ( list , .. ) => { return CallArgs ( list . iter ( ) . map ( | v | ( None , v . clone ( ) ) ) . collect ( ) , ) ; } _ => ( ) , } } if let Some ( last ) = v . pop ( ) { if let Value :: List ( vv , Some ( ListSeparator :: Space ) , false , ) = & last { match & vv [ .. ] { [ Value :: List ( vv , _ , _ ) , Value :: Literal ( mark , Quotes :: None ) ] if mark == " " => { v . extend ( vv . iter ( ) . cloned ( ) ) ; } _ => { v . push ( last ) ; } } } else { v . push ( last ) ; } } CallArgs ( v . into_iter ( ) . map ( | v | ( None , v ) ) . collect ( ) ) } Value :: Null => CallArgs ( vec ! [ ] ) , v => CallArgs ( vec ! [ ( None v ) ] ) , } }
Create args from a Value.
Create args from a Value .
v
Value