linq 0.0.1-preview

Linq query in Rust.
Documentation

Linq in Rust

Codacy Badge Average time to resolve an issue Percentage of issues still open

Linq query in Rust (created by macros).

This project is under development!

Quick Start

This is an example:

use linq::linq;

fn try_linq(){
    let x = 1..100;

    let mut y: Vec<i32> = x.clone().filter(|p| p <= &5).collect();
    y.sort_by_key(|t| -t);
    let y: Vec<i32> = y.into_iter().map(|t| t * 2).collect();

    let e: Vec<i32> =
        linq!(from p; in x.clone(); where p <= &5; orderby -p; select p * 2).collect();
    
    assert_eq!(e, y);
}

If you are familier with LINQ in C#, you will find this easy to use.

Linq Keywords

  • from
  • in
  • select
  • where
  • orderby

Query Operators

All italic items mean they are not in roadmap. Happy for your suggestions.

  • where => filter
  • select => map
  • select_many
  • skip => skip
  • skip_while => skip_while
  • take => take
  • take_while => take_while
  • join
  • group_join
  • concate => chain
  • order_by
  • order_by_descending
  • then_by
  • then_by_descending
  • reverse => rev
  • group_by
  • distinct
  • union
  • intersect
  • except
  • first => next
  • single
  • element_at => nth
  • all => all
  • any => any
  • contains
  • count => count
  • sum
  • min
  • max
  • average
  • aggregate

Development

We need more unit-test samples. If you have any ideas, open issues to tell us.

$ cargo test