{"id":25649521,"url":"https://github.com/yonatan-reicher/functionality","last_synced_at":"2025-02-23T14:22:28.026Z","repository":{"id":278981862,"uuid":"937393148","full_name":"yonatan-reicher/functionality","owner":"yonatan-reicher","description":"Rust |\u003e functional programing = 💖","archived":false,"fork":false,"pushed_at":"2025-02-22T23:55:55.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T00:37:00.329Z","etag":null,"topics":["functional-programming","pipes","rust","trait"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/functionality","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yonatan-reicher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-22T23:51:01.000Z","updated_at":"2025-02-22T23:58:45.000Z","dependencies_parsed_at":"2025-02-23T00:47:04.174Z","dependency_job_id":null,"html_url":"https://github.com/yonatan-reicher/functionality","commit_stats":null,"previous_names":["yonatan-reicher/functionality"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonatan-reicher%2Ffunctionality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonatan-reicher%2Ffunctionality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonatan-reicher%2Ffunctionality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonatan-reicher%2Ffunctionality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yonatan-reicher","download_url":"https://codeload.github.com/yonatan-reicher/functionality/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240325145,"owners_count":19783620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional-programming","pipes","rust","trait"],"created_at":"2025-02-23T14:22:27.121Z","updated_at":"2025-02-23T14:22:27.887Z","avatar_url":"https://github.com/yonatan-reicher.png","language":"Rust","readme":"# Functionality\n\n[![Test](https://github.com/yonatan-reicher/functionality/workflows/Test/badge.svg)](https://github.com/yonatan-reicher/functionality/actions?query=workflow%3ATest)\n[![Crates.io Version](https://img.shields.io/crates/v/functionality?logo=rust)](https://crates.io/crates/functionality)\n\nAdds support for chaining functions in a functional way.\n\n## Pipe\n\nThe following 9 methods are added to all types:\n\n|       pipe syntax      |  traditional syntax equivalent |\n|:----------------------:|:------------------------------:|\n| `x.pipe(f)`            | `f(x)`                         |\n| `x.pipe_ref(f)`        | `f(\u0026x)`                        |\n| `x.pipe_mut(f)`        | `f(\u0026mut x)`                    |\n| `x.pipe_as_ref(f)`     | `f(x.as_ref())`                |\n| `x.pipe_as_mut(f)`     | `f(x.as_mut())`                |\n| `x.pipe_deref(f)`      | `f(\u0026x)`                        |\n| `x.pipe_deref_mut(f)`  | `f(\u0026mut x)`                    |\n| `x.pipe_borrow(f)`     | `f(x.borrow())`                |\n| `x.pipe_borrow_mut(f)` | `f(x.borrow_mut())`            |\n\nThese are imported directly from [the pipe-trait crate](https://github.com/KSXGitHub/pipe-trait).\n\n### Example\n\n```rust\nuse functionality::prelude::*;\n\nlet inc = |x| x + 1;\nlet double = |x| x + x;\nlet square = |x| x * x;\nlet a = (123i32).pipe(inc).pipe(double).pipe(square);\nlet b = square(double(inc(123i32)));\nassert_eq!(a, b);\n```\n\n## Mutate\n\nThe method `.mutate(..)` is also added to all types.\n\n### Example\n\n```rust\nuse functionality::prelude::*;\n\nlet sorted = vec![3, 2, 1].mutate(|v| v.sort());\nassert_eq!(sorted, vec![1, 2, 3]);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonatan-reicher%2Ffunctionality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyonatan-reicher%2Ffunctionality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonatan-reicher%2Ffunctionality/lists"}