From a1b7269cf9ff0b3310298d30bd31c690fd54ade3 Mon Sep 17 00:00:00 2001 From: Arnaud Rebts Date: Fri, 10 Dec 2021 15:52:42 +0100 Subject: [PATCH] Allow creating index using binary representation While building an alternative import tool for rethinkdb using Rust, I found myself trying to create index using the binary representation, as exported by the official export tool. However, the current implementation always wrap everything in a `Func` so that didn't work, this PR is an attempt to fix that. There's probably a better way to do this, but I'm not sure how. --- reql/src/cmd/index_create.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/reql/src/cmd/index_create.rs b/reql/src/cmd/index_create.rs index 5086a49c..6576e0af 100644 --- a/reql/src/cmd/index_create.rs +++ b/reql/src/cmd/index_create.rs @@ -47,9 +47,8 @@ where R: Into, { fn arg(self) -> cmd::Arg { - let Args((name, query)) = self; - let func = Func::row(query); - Args((name, func)).arg() + let Args((name, func)) = self; + name.arg().with_arg(func) } } @@ -79,8 +78,7 @@ where R: Into, { fn arg(self) -> cmd::Arg { - let Args((name, query, opts)) = self; - let Func(func) = Func::row(query); + let Args((name, func, opts)) = self; name.arg().with_arg(func).with_opts(opts) } }