{"id":16340739,"url":"https://github.com/casey/position","last_synced_at":"2025-05-08T00:53:43.519Z","repository":{"id":62442816,"uuid":"178280424","full_name":"casey/position","owner":"casey","description":"☞ Source position objects for Rust","archived":false,"fork":false,"pushed_at":"2019-03-29T06:51:53.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T00:53:33.819Z","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":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-28T20:51:10.000Z","updated_at":"2019-03-30T09:30:33.000Z","dependencies_parsed_at":"2022-11-01T22:02:50.077Z","dependency_job_id":null,"html_url":"https://github.com/casey/position","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fposition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fposition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fposition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fposition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casey","download_url":"https://codeload.github.com/casey/position/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978739,"owners_count":21834915,"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-10-10T23:57:42.212Z","updated_at":"2025-05-08T00:53:43.495Z","avatar_url":"https://github.com/casey.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# position\n\n[![crates.io](https://img.shields.io/crates/v/position.svg)](https://crates.io/crates/position) [![docs](https://docs.rs/position/badge.svg)](http://docs.rs/position)\n\n`position` provides a `Position` struct, representing a source code position,\nas well as a convenient `here!()` macro for creating a position corresponding\nto the location where `here!()` was invoked:\n\n```rust\nuse position::{here, Position};\nlet p: Position = here!();\nassert_eq!(p.file(), \"src/lib.rs\");\nassert_eq!(p.line(), 5);\nassert_eq!(p.column(), 19);\nassert_eq!(p.module_path(), \"rust_out\");\nassert_eq!(p.to_string(), \"src/lib.rs:5:19\");\n```\n\nIf `position` is compiled with the `location` feature, on by default, `Position`\nimplements `oi::Location`, so it can be used with `oi::ErrAt::err_at`:\n\n```rust\n# #[cfg(feature = \"location\")]\n# {\nuse std::{io, fs::File};\nuse oi::ErrAt;\nuse position::{here, Position};\n\nlet result: oi::Result\u003cFile, io::Error, Position\u003e =\n  File::open(\"foo.txt\").err_at(here!());\n\nassert_eq!(\n  result.unwrap_err().to_string(),\n  \"src/lib.rs:11:32: No such file or directory (os error 2)\",\n);\n# }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasey%2Fposition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasey%2Fposition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasey%2Fposition/lists"}