remove unneeded module prefix

This commit is contained in:
Guy Korland 2019-05-14 14:19:01 +03:00
parent b49d95d5db
commit 5cff83ebbb

View File

@ -211,11 +211,11 @@ pub use select::Selector;
/// assert_eq!(json, ret);
/// ```
pub fn compile<'a>(path: &'a str) -> impl FnMut(&Value) -> result::Result<Value, String> + 'a {
let mut selector = select::Selector::new();
let mut selector = Selector::new();
let _ = selector.path(path);
let mut selector = Box::new(selector);
move |json| {
let s: &mut select::Selector = selector.borrow_mut();
let s: &mut Selector = selector.borrow_mut();
let _ = s.value(&json);
s.select_to_value()
}
@ -256,11 +256,11 @@ pub fn compile<'a>(path: &'a str) -> impl FnMut(&Value) -> result::Result<Value,
/// assert_eq!(json, ret);
/// ```
pub fn selector<'a>(json: &Value) -> impl FnMut(&'a str) -> result::Result<Value, String> {
let mut selector = select::Selector::new();
let mut selector = Selector::new();
let _ = selector.value(json.into());
let mut selector = Box::new(selector);
move |path: &'a str| {
let s: &mut select::Selector = selector.borrow_mut();
let s: &mut Selector = selector.borrow_mut();
s.path(path)?.select_to_value()
}
}
@ -309,7 +309,7 @@ pub fn selector<'a>(json: &Value) -> impl FnMut(&'a str) -> result::Result<Value
/// assert_eq!(json, ret);
/// ```
pub fn selector_as<T: serde::de::DeserializeOwned>(json: &Value) -> impl FnMut(&str) -> result::Result<T, String> {
let mut selector = select::Selector::new();
let mut selector = Selector::new();
let _ = selector.value(json.into());
move |path: &str| {
selector.path(path)?.select_to()
@ -348,7 +348,7 @@ pub fn reader<'a>(json: &Value) -> impl FnMut(&'a str) -> result::Result<Value,
/// assert_eq!(json, ret);
/// ```
pub fn select(json: &Value, path: &str) -> result::Result<Value, String> {
let mut selector = select::Selector::new();
let mut selector = Selector::new();
selector.path(path)?.value(json.into())?.select_to_value()
}
@ -386,7 +386,7 @@ pub fn select_str(json: &str, path: &str) -> result::Result<String, String> {
/// assert_eq!(ret, r#"[{"name":"친구3","age":30},{"name":"친구1","age":20}]"#);
/// ```
pub fn select_as_str(json: &str, path: &str) -> result::Result<String, String> {
select::Selector::new()
Selector::new()
.path(path)?
.value_from_str(json)?
.select_to_str()
@ -431,7 +431,7 @@ pub fn select_as_str(json: &str, path: &str) -> result::Result<String, String> {
/// assert_eq!(person, ret);
/// ```
pub fn select_as<T: serde::de::DeserializeOwned>(json: &str, path: &str) -> result::Result<T, String> {
select::Selector::new()
Selector::new()
.path(path)?
.value_from_str(json)?
.select_to()