项目作者: matthiasbeyer

项目描述 :
Build filters for Iterator::filter() using the builder pattern
高级语言: Rust
项目地址: git://github.com/matthiasbeyer/filters.git
创建时间: 2016-08-10T10:45:01Z
项目社区:https://github.com/matthiasbeyer/filters

开源协议:Mozilla Public License 2.0

下载


filters

A library crate to build predicates and filter.

Documentation.

Examples explain it best:

  1. use filters::filter::Filter;
  2. let not_eq_to_one = |&a: &usize| { a != 1 };
  3. let not_eq_to_two = |&a: &usize| { a != 2 };
  4. let not_eq_to_three = |&a: &usize| { a != 3 };
  5. let a = not_eq_to_one.and(not_eq_to_two).and(not_eq_to_three);
  6. assert_eq!(a.filter(&21), true);

For more examples have a look at the tests in ./src/filters.rs.

License

  1. filters - A crate to build predicates/filters with the builder pattern
  2. Copyright (C) 2016 Matthias Beyer
  3. This Source Code Form is subject to the terms of the Mozilla Public
  4. License, v. 2.0. If a copy of the MPL was not distributed with this
  5. file, You can obtain one at http://mozilla.org/MPL/2.0/.

For more information and the full license text, see
the LICENSE file.