Skip to content

Instantly share code, notes, and snippets.

let mut characters: Vec<Actor> = vec![...];
// what works, but then I lost ownership of `characters`
for (mut a, mut b) in characters.into_iter().tuple_combinations::<(Actor, Actor)>() {
mutating_thing(a, b);
}
// what I want, but rustc complains that IterMut does not implement Cloned
for (&mut a, &mut b) in characters.iter_mut().tuple_combinations::<(&mut Actor, &mut Actor)>() {
mutating_thing(a, b);
ERROR:
gql_1 | TypeError: Cannot read property 'type' of undefined
gql_1 | at app.use.postgraphile.appendPlugins.schema (/main.js:24:71)
gql_1 | at SchemaBuilder.applyHooks (/node_modules/graphile-build/node8plus/SchemaBuilder.js:157:20)
gql_1 | at SchemaBuilder.buildSchema (/node_modules/graphile-build/node8plus/SchemaBuilder.js:209:36)
gql_1 | at triggerChange (/node_modules/graphile-build/node8plus/SchemaBuilder.js:231:31)
gql_1 | at handleChange (/node_modules/graphile-build-pg/node8plus/plugins/PgIntrospectionPlugin.js:496:7)
gql_1 | at processTicksAndRejections (internal/process/next_tick.js:81:5)
gql_1 | Recoverable error occurred:
# Note that the author of the toplevel post is bob and the comment is joe
$ http 'localhost:3000/post?select=*,author(*)'
[
{
"author": {
"id": 1,
"name": "bob"
},
"id": 4,
"message": "top level post",
@tom95
tom95 / a.diff
Last active January 8, 2017 09:41
diff --git a/app/assets/javascripts/events.js b/app/assets/javascripts/events.js
index 1766725..6068559 100644
--- a/app/assets/javascripts/events.js
+++ b/app/assets/javascripts/events.js
@@ -25,4 +25,11 @@ function addEventDatePicker() {
function removeEventDatePicker(button) {
$(button).parent('div').remove();
-}
\ No newline at end of file