10
submitted 1 year ago* (last edited 1 year ago) by RoundSparrow@lemmy.ml to c/rust@programming.dev

Help! I want to divorce ReadFn from ListFN - bypassing the Queries mutual closure behavior so I can better isolate some logic. My need is to get an independent ListFn...

fn queries_<'a>() -> Queries<
  impl ReadFn<'a, PostView, (PostId, Option, bool)>,
  impl ListFn<'a, PostView, PostQuery<'a>>,
> {

Context: https://github.com/LemmyNet/lemmy/blob/main/crates/db_views/src/post_view.rs

For sake of clarity... I'm not wanting to break the whole Queries joined closure marriage project-wide, just this one source file I want to be able to copy/paste this code twice and have just a single closure for ListFn.

Thank you.

you are viewing a single comment's thread
view the rest of the comments
[-] Vorpal@programming.dev 2 points 1 year ago

Oh, this seems to be specific to the SQL framework you use after looking into it. I thought it was a general rust question about function parameters, sorry. Unfortunately I'm not familiar with that sql framework (or any other, I'm an embedded developer, not a web dev).

Hope you find someone who knows diesel, and sorry again I couldn't help you.

this post was submitted on 21 Aug 2023
10 points (91.7% liked)

Rust

5754 readers
28 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS