{"id":20887945,"url":"https://github.com/canop/umask","last_synced_at":"2025-07-15T18:35:32.559Z","repository":{"id":34999619,"uuid":"195229747","full_name":"Canop/umask","owner":"Canop","description":"A utility to deal with unix access permission modes","archived":false,"fork":false,"pushed_at":"2023-11-06T12:36:40.000Z","size":26,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T19:46:21.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Canop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-04T11:33:20.000Z","updated_at":"2024-10-23T18:42:04.000Z","dependencies_parsed_at":"2023-11-06T13:42:46.990Z","dependency_job_id":"6da97f96-f81c-4780-842c-0c9a70f5a7c6","html_url":"https://github.com/Canop/umask","commit_stats":{"total_commits":28,"total_committers":7,"mean_commits":4.0,"dds":0.3214285714285714,"last_synced_commit":"6118f89067ec782118507ecf82ae2b56941d500f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Canop/umask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fumask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fumask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fumask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fumask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Canop","download_url":"https://codeload.github.com/Canop/umask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fumask/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265451501,"owners_count":23767771,"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":[],"created_at":"2024-11-18T08:23:26.510Z","updated_at":"2025-07-15T18:35:32.536Z","avatar_url":"https://github.com/Canop.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MIT][s2]][l2] [![Latest Version][s1]][l1] [![docs][s3]][l3] [![Chat on Miaou][s4]][l4]\n\n[s1]: https://img.shields.io/crates/v/umask.svg\n[l1]: https://crates.io/crates/umask\n\n[s2]: https://img.shields.io/badge/license-MIT-blue.svg\n[l2]: LICENSE\n\n[s3]: https://docs.rs/umask/badge.svg\n[l3]: https://docs.rs/umask/\n\n[s4]: https://miaou.dystroy.org/static/shields/room.svg\n[l4]: https://miaou.dystroy.org/3\n\n# umask\n\nA light utility helping with unix mode representation, with strong types to avoid misusing constants.\n\nThe Mode struct implements `Display` and prints as `\"rwxrwxrwx\"`\n\n### Import\n\nIn Cargo.toml:\n\n    umask = \"'2.0\"\n\n\n### Usage\n\n```rust\nuse umask::*;\n\n// You can build from a number:\nassert_eq!(\"rw-r--r--\", Mode::from(0b110100100).to_string());\nassert_eq!(\"rw-r--r--\", Mode::from(0o644).to_string());\n\n// You may use `|` to combine class permissions:\nlet mu = Mode::from(0o640);\nlet mo = Mode::from(0o044);\nassert_eq!(\"rw-r--r--\", (mu | mo).to_string());\nassert_eq!(\"---r-----\", (mu \u0026 mo).to_string());\n\n// You can use more semantic constructs:\nlet m = Mode::all()\n    .without(ALL_EXEC);\nassert_eq!(\"rw-rw-rw-\", m.to_string());\nlet mut m = Mode::new()\n    .with_class_perm(ALL, READ)\n    .with_class_perm(USER, WRITE);\nassert_eq!(\"rw-r--r--\", m.to_string());\n// (semantic functions can be used in const declarations)\n\n// Or\nm |= ALL_EXEC;\nassert_eq!(\"rwxr-xr-x\", m.to_string());\nlet m = ALL_READ | USER_WRITE;\nassert_eq!(\"rw-r--r--\", m.to_string());\n\n// Displaying the mode can be done with the `Display`\n// implementation but also bit per bit for more control\nassert_eq!(\n    m.to_string().chars().next().unwrap(), // first char: 'r' or '-'\n    if m.has(USER_READ) { 'r' } else { '-' },\n);\n\n// The `Display` implementation shows the extra permission bits\n// (setuid, setgid and sticky):\nlet mut m = Mode::all()\n    .with_extra(STICKY)\n    .with_extra(SETUID)\n    .with_extra(SETGID);\nassert_eq!(\"rwsrwsrwt\", m.to_string());\n\n// But you can remove those bits for display if you want the\n// sometimes more familiar 'x' for execution:\nassert_eq!(\"rwxrwxrwx\", m.without_any_extra().to_string());\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fumask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanop%2Fumask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fumask/lists"}