{"id":21986052,"url":"https://github.com/tamschi/cervine","last_synced_at":"2025-07-05T12:35:00.982Z","repository":{"id":41966844,"uuid":"279567958","full_name":"Tamschi/cervine","owner":"Tamschi","description":"A slightly more flexible Cow; to T: Borrow\u003cR\u003e as alloc::borrow::Cow is to B: ToOwned.","archived":false,"fork":false,"pushed_at":"2023-01-05T18:00:49.000Z","size":57,"stargazers_count":7,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-30T08:11:51.714Z","etag":null,"topics":["copy-on-write","data-structures","serde-support"],"latest_commit_sha":null,"homepage":"https://lib.rs/crates/cervine","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tamschi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-14T11:36:19.000Z","updated_at":"2024-12-13T20:21:37.000Z","dependencies_parsed_at":"2023-02-04T09:15:50.029Z","dependency_job_id":null,"html_url":"https://github.com/Tamschi/cervine","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tamschi%2Fcervine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tamschi%2Fcervine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tamschi%2Fcervine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tamschi%2Fcervine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tamschi","download_url":"https://codeload.github.com/Tamschi/cervine/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666336,"owners_count":21624295,"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":["copy-on-write","data-structures","serde-support"],"created_at":"2024-11-29T18:16:55.851Z","updated_at":"2025-04-30T08:11:51.881Z","avatar_url":"https://github.com/Tamschi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cervine\n\n[![Lib.rs](https://img.shields.io/badge/Lib.rs-*-84f)](https://lib.rs/crates/cervine)\n[![Crates.io](https://img.shields.io/crates/v/cervine)](https://crates.io/crates/cervine)\n[![Docs.rs](https://docs.rs/cervine/badge.svg)](https://docs.rs/crates/cervine)\n\n![Rust 1.42.0](https://img.shields.io/static/v1?logo=Rust\u0026label=\u0026message=1.42.0\u0026color=grey)\n[![CI](https://github.com/Tamschi/cervine/workflows/CI/badge.svg?branch=develop)](https://github.com/Tamschi/cervine/actions?query=workflow%3ACI+branch%3Adevelop)\n![Crates.io - License](https://img.shields.io/crates/l/cervine/0.0.6)\n\n[![GitHub](https://img.shields.io/static/v1?logo=GitHub\u0026label=\u0026message=%20\u0026color=grey)](https://github.com/Tamschi/cervine)\n[![open issues](https://img.shields.io/github/issues-raw/Tamschi/cervine)](https://github.com/Tamschi/cervine/issues)\n[![open pull requests](https://img.shields.io/github/issues-pr-raw/Tamschi/cervine)](https://github.com/Tamschi/cervine/pulls)\n[![crev reviews](https://web.crev.dev/rust-reviews/badge/crev_count/cervine.svg)](https://web.crev.dev/rust-reviews/crate/cervine/)\n\nA slightly more flexible clone-on-write smart pointer; roughly to [`T: Borrow\u003cR\u003e`] as [`alloc::borrow::Cow`] is to [`B: ToOwned`].\n\nThe owned and reference types can be chosen independently, which means for example [smartstring]'s [`String`] can be used in the owned variant instead of [`alloc`'s].\n\n[Serde] support is optional via the `\"serde\"` feature and `no_std`-compatible.  \nNote that deserialisation currently always happens by value and [`serde::Serialize`] is looked up only on the reference type. This may change in a major version upgrade, likely only after [specialization] becomes available.\n\n[`T: Borrow\u003cR\u003e`]: https://doc.rust-lang.org/stable/alloc/borrow/trait.Borrow.html\n[`alloc::borrow::Cow`]: https://doc.rust-lang.org/stable/alloc/borrow/enum.Cow.html\n[`B: ToOwned`]: https://doc.rust-lang.org/stable/alloc/borrow/trait.ToOwned.html\n\n[smartstring]: https://lib.rs/crates/smartstring\n[`String`]: https://docs.rs/smartstring/0.2.3/smartstring/alias/type.String.html\n[`alloc`'s]: https://doc.rust-lang.org/stable/alloc/string/struct.String.html\n\n[Serde]: https://lib.rs/crates/serde\n[`serde::Serialize`]: https://docs.rs/serde/1.0.115/serde/trait.Serialize.html\n[specialization]: https://github.com/rust-lang/rust/issues/31844\n\n## Installation\n\nPlease use [cargo-edit](https://crates.io/crates/cargo-edit) to always add the latest version of this library:\n\n```cmd\ncargo add cervine\n```\n\n## Examples\n\nSame type (`T = R = [bool; 2]`):\n\n```rust\nuse cervine::Cow;\nuse rand::prelude::*;\nuse std::borrow::Borrow as _;\n\nlet data = [true, false];\nlet mut cow = Cow::Borrowed(\u0026data);\n\nif thread_rng().gen() {\n  cow = Cow::Owned([false, true]);\n}\n\nlet array_ref: \u0026[bool; 2] = cow.borrow();\n```\n\nDifferent types (`T = String` and `R = str`):\n\n```rust\nuse cervine::Cow;\nuse rand::prelude::*;\nuse smartstring::alias::String;\n\nlet mut cow = Cow::Borrowed(\"borrowed\");\n\nif thread_rng().gen() {\n  cow = Cow::Owned(String::from(\"owned\"));\n}\n\nlet str_ref: \u0026str = cow.as_ref();\n```\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n## [Code of Conduct](CODE_OF_CONDUCT.md)\n\n## [Changelog](CHANGELOG.md)\n\n## Versioning\n\n`cervine` strictly follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) with the following exceptions:\n\n* The minor version will not reset to 0 on major version changes (except for v1).  \nConsider it the global feature level.\n* The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).  \nConsider it the global patch level.\n\nThis includes the Rust version requirement specified above.  \nEarlier Rust versions may be compatible, but this can change with minor or patch releases.\n\nWhich versions are affected by features and patches can be determined from the respective headings in [CHANGELOG.md](CHANGELOG.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamschi%2Fcervine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftamschi%2Fcervine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamschi%2Fcervine/lists"}