mit-pdos/noria

insert_all method not found in `noria::table::Table`

anandijain opened this issue · 7 comments

I am probably doing something dumb, but I am trying to use the insert_all function, but it doesn't seem to exist.

// schema not needed for mre //
let mut votes = db.table("votes").await.unwrap();
let noria_recs: Vec<Vec<DataType>> = ...
votes.insert_all(noria_recs).await.unwrap();

gives: no method named insert_all found for struct noria::table::Table in the current scope: method not found in noria::table::Table

The definition for insert_all is

pub fn insert_all<I, V>(&mut self, i: I) -> Result<(), TableError> 
where    
I: IntoIterator<Item = V>,   
V: Into<Vec<DataType>>, 

which I believe a Vec impls IntoIterator.

I think a code snippet in the docs would be helpful

-- versions --
My Cargo.toml has noria = "0.5.0"
rustc 1.45.0-nightly (47c3158c3 2020-06-04)

Ah, you are looking at some very outdated documentation. If that's still linked from somewhere, we should remove that. Unfortunately, docs.rs also can't build the docs at the moment (see #153), so to see the actual docs you'll want to clone the git repository and then do:

$ cargo doc --lib -p noria

thank you, I need to get better at reading docs w cargo.
I just pulled and cargo doc --lib -p noria but I get:

 Documenting noria v0.5.0 (/home//programming/clones/noria/noria)
error[E0432]: unresolved import `tokio::task_local`
   --> noria/src/lib.rs:229:5
    |
229 | use tokio::task_local;
    |     ^^^^^^^^^^^^^^^^^ no `task_local` in the root

error: cannot determine resolution for the macro `task_local`
   --> noria/src/lib.rs:250:1
    |
250 | task_local! {
    | ^^^^^^^^^^

Huh, interesting. Can you try a cargo update?

after cargo update and rerunning cargo doc --lib -p noria gives:

...
Documenting tower-limit v0.3.1
   Checking mysql_common v0.22.1
error[E0277]: the trait bound `(): core::future::future::Future` is not satisfied
  --> /home//.cargo/git/checkouts/tokio-tower-98a883543a8cb142/346858d/src/multiplex/client.rs:96:5
   |
96 |     type Future = impl Future<Output = Result<Self::Response, Self::Error>> + Send;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::future::future::Future` is not implemented for `()`
   |
   = note: the return type of a function must have a statically known size
...
3 more futures errors
...
error: Could not document `tokio-tower`.

Ah, man, yeah, that's #153, which in turn is rust-lang/rust#65863. Unfortunately not much I can do about that. I think for now you're stuck with having to look at noria/src/table.rs yourself and look at the public methods then :'(

idk why i didn't think of that,
ty

perform_all makes a lot of sense, rather than having a separate function for each TableOperation