pub fn parse<'a, S>(input: S) -> Result<Vec<Namespace>>
    where
        S: Into<Cow<'a, str>>,
    {
        input
            .into()
            .split('.')
            .flat_map(|s| s.split_terminator(']'))
            .map(|v| {
                if let Some(idx) = v.find('[') {
                    Ok(Namespace::Array {
                        id: v[..idx].to_string(),
                        index: v[idx + 1..].parse()?,
                    })
                } else {
                    Ok(Namespace::Object { id: v.to_string() })
                }
            })
            .collect()
    }
/// parse takes an ordinary namespaced string eg. `object.nested[0][1].nested.field` and
/// turns it into a usable namespace object for use in transformations.
///
/// **NOTE:** This parser assumes `[` or `]` in the namespace denotes an array, if this is not true
///       you will have to manually create your own namespace; the backend transformer handles
///       the distinction, just the parser has no way of knowing the difference.
///
parse takes an ordinary namespaced string eg. `object.nested[0][1].nested.field` and
turns it into a usable namespace object for use in transformations.

This parser assumes `[` or `]` in the namespace denotes an array, if this is not true
you will have to manually create your own namespace; the backend transformer handles
the distinction, just the parser has no way of knowing the difference.
parse takes an ordinary namespaced string eg . ` object . nested [ 0 ] [ 1 ] . nested . field ` and turns it into a usable namespace object for use in transformations . This parser assumes ` [ ` or ` ] ` in the namespace denotes an array if this is not true you will have to manually create your own namespace ; the backend transformer handles the distinction just the parser has no way of knowing the difference .
pub fn parse<'a, S>(input: S) -> Result<Vec<Namespace>>
    where
        S: Into<Cow<'a, str>>,
    {
        input
            .into()
            .split('.')
            .flat_map(|s| s.split_terminator(']'))
            .map(|v| {
                if let Some(idx) = v.find('[') {
                    Ok(Namespace::Array {
                        id: v[..idx].to_string(),
                        index: v[idx + 1..].parse()?,
                    })
                } else {
                    Ok(Namespace::Object { id: v.to_string() })
                }
            })
            .collect()
    }
pub fn parse < ' a , S > ( input : S ) -> Result < Vec < Namespace > > where S : Into < Cow < ' a , str > > , { input . into ( ) . split ( '.' ) . flat_map ( | s | s . split_terminator ( ']' ) ) . map ( | v | { if let Some ( idx ) = v . find ( '[' ) { Ok ( Namespace :: Array { id : v [ .. idx ] . to_string ( ) , index : v [ idx + 1 .. ] . parse ( ) ? , } ) } else { Ok ( Namespace :: Object { id : v . to_string ( ) } ) } } ) . collect ( ) }
parse takes an ordinary namespaced string eg.
parse takes an ordinary namespaced string eg .
input
S
input
S