fn function_from_name(name: &str) -> Result<&'static dyn Function, Error> {
    use functions::{array, codec, debug, ops, rand, string};

    Ok(match name {
        "rand.regex" => &rand::Regex,
        "rand.range" => &rand::Range,
        "rand.range_inclusive" => &rand::RangeInclusive,
        "rand.uniform" => &rand::Uniform,
        "rand.uniform_inclusive" => &rand::UniformInclusive,
        "rand.zipf" => &rand::Zipf,
        "rand.log_normal" => &rand::LogNormal,
        "rand.bool" => &rand::Bool,
        "rand.finite_f32" => &rand::FiniteF32,
        "rand.finite_f64" => &rand::FiniteF64,
        "rand.u31_timestamp" => &rand::U31Timestamp,
        "rand.shuffle" => &rand::Shuffle,
        "rand.uuid" => &rand::Uuid,
        "greatest" => &ops::GREATEST,
        "least" => &ops::LEAST,
        "round" => &ops::Round,
        "div" => &ops::Div,
        "mod" => &ops::Mod,
        "char_length" | "character_length" => &string::CharLength,
        "octet_length" => &string::OctetLength,
        "coalesce" => &ops::Coalesce,
        "generate_series" => &array::GenerateSeries,
        "debug.panic" => &debug::Panic,
        "from_hex" => &codec::DECODE_HEX,
        "to_hex" => &codec::ENCODE_HEX,
        "from_base64" | "from_base64url" => &codec::DECODE_BASE64,
        "to_base64" => &codec::ENCODE_BASE64,
        "to_base64url" => &codec::ENCODE_BASE64URL,
        _ => return Err(Error::UnknownFunction),
    })
}
/// Obtains a function from its name.
Obtains a function from its name.
Obtains a function from its name .
fn function_from_name(name: &str) -> Result<&'static dyn Function, Error> {
    use functions::{array, codec, debug, ops, rand, string};
    Ok(match name {
        "rand.regex" => &rand::Regex,
        "rand.range" => &rand::Range,
        "rand.range_inclusive" => &rand::RangeInclusive,
        "rand.uniform" => &rand::Uniform,
        "rand.uniform_inclusive" => &rand::UniformInclusive,
        "rand.zipf" => &rand::Zipf,
        "rand.log_normal" => &rand::LogNormal,
        "rand.bool" => &rand::Bool,
        "rand.finite_f32" => &rand::FiniteF32,
        "rand.finite_f64" => &rand::FiniteF64,
        "rand.u31_timestamp" => &rand::U31Timestamp,
        "rand.shuffle" => &rand::Shuffle,
        "rand.uuid" => &rand::Uuid,
        "greatest" => &ops::GREATEST,
        "least" => &ops::LEAST,
        "round" => &ops::Round,
        "div" => &ops::Div,
        "mod" => &ops::Mod,
        "char_length" | "character_length" => &string::CharLength,
        "octet_length" => &string::OctetLength,
        "coalesce" => &ops::Coalesce,
        "generate_series" => &array::GenerateSeries,
        "debug.panic" => &debug::Panic,
        "from_hex" => &codec::DECODE_HEX,
        "to_hex" => &codec::ENCODE_HEX,
        "from_base64" | "from_base64url" => &codec::DECODE_BASE64,
        "to_base64" => &codec::ENCODE_BASE64,
        "to_base64url" => &codec::ENCODE_BASE64URL,
        _ => return Err(Error::UnknownFunction),
    })
}
fn function_from_name ( name : & str ) -> Result < & ' static dyn Function , Error > { use functions :: { array , codec , debug , ops , rand , string } ; Ok ( match name { " " => & rand :: Regex , " " => & rand :: Range , " " => & rand :: RangeInclusive , " " => & rand :: Uniform , " " => & rand :: UniformInclusive , " " => & rand :: Zipf , " " => & rand :: LogNormal , " " => & rand :: Bool , " " => & rand :: FiniteF32 , " " => & rand :: FiniteF64 , " " => & rand :: U31Timestamp , " " => & rand :: Shuffle , " " => & rand :: Uuid , " " => & ops :: GREATEST , " " => & ops :: LEAST , " " => & ops :: Round , " " => & ops :: Div , " " => & ops :: Mod , " " | " " => & string :: CharLength , " " => & string :: OctetLength , " " => & ops :: Coalesce , " " => & array :: GenerateSeries , " " => & debug :: Panic , " " => & codec :: DECODE_HEX , " " => & codec :: ENCODE_HEX , " " | " " => & codec :: DECODE_BASE64 , " " => & codec :: ENCODE_BASE64 , " " => & codec :: ENCODE_BASE64URL , _ => return Err ( Error :: UnknownFunction ) , } ) }
Obtains a function from its name.
Obtains a function from its name .
name
&str
name
&str