{"id":19787031,"url":"https://github.com/tomboddaert/mut-str","last_synced_at":"2025-10-26T12:41:01.155Z","repository":{"id":196923322,"uuid":"697021972","full_name":"tomBoddaert/mut-str","owner":"tomBoddaert","description":"A toolkit for working with mutable string slices (\u0026mut str).","archived":false,"fork":false,"pushed_at":"2024-07-27T13:31:42.000Z","size":69,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T23:34:55.532Z","etag":null,"topics":["mutability","rust","string","strings"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/mut-str","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomBoddaert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE_Apache-2.0","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":"2023-09-26T22:30:16.000Z","updated_at":"2024-11-19T01:38:08.000Z","dependencies_parsed_at":"2024-07-27T14:57:40.522Z","dependency_job_id":null,"html_url":"https://github.com/tomBoddaert/mut-str","commit_stats":null,"previous_names":["tomboddaert/mut-str"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomBoddaert/mut-str","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomBoddaert%2Fmut-str","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomBoddaert%2Fmut-str/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomBoddaert%2Fmut-str/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomBoddaert%2Fmut-str/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomBoddaert","download_url":"https://codeload.github.com/tomBoddaert/mut-str/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomBoddaert%2Fmut-str/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281107100,"owners_count":26444787,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["mutability","rust","string","strings"],"created_at":"2024-11-12T06:20:41.092Z","updated_at":"2025-10-26T12:41:01.126Z","avatar_url":"https://github.com/tomBoddaert.png","language":"Rust","readme":"# `mut-str`\n\nA toolkit for working with mutable string slices (`\u0026mut str`), and immutable ones too!\n\nPretty much all you can do safely in the standard library with mutable string slices is make them lower or upper case.\nThis package allows for splitting and slicing by character index (rather than byte index), replacing strings and using references to characters.\n\nAll functions on string slices are available either at the package root or as methods on the `StrExt` trait.\n\n```sh\ncargo add mut-str\n```\n\n## Example\n\n``` rust\nuse mut_str::StrExt;\n\nlet mut welcome = Box::\u003cstr\u003e::from(\"Hello, World!\");\n\n// Split by character index\nlet (l, r) = welcome.char_split_at_mut(7).unwrap();\nassert_eq!(l, \"Hello, \");\nassert_eq!(r, \"World!\");\n\n// Replace string slices\nl.replace_with(\"mut-str\").unwrap();\nassert_eq!(l, \"mut-str\");\n\n// Replace with padding\nlet sub = r.replace_with_pad_left_char(\"👑!\", ' ').unwrap();\nassert_eq!(sub, \"👑!\");\nassert_eq!(r, \" 👑!\");\n\nassert_eq!(\u0026*welcome, \"mut-str 👑!\");\n\n// Get character references\nlet crown = welcome.get_char_mut(8).unwrap();\nassert_eq!(crown, '👑');\n\n// Mutate characters\ncrown.replace('🌍').unwrap();\nassert_eq!(crown, '🌍');\n\n// Slice by character index\nlet l = welcome.char_slice_mut(..7).unwrap();\nl.replace_with_pad_left_space(\"👋\").unwrap();\n\nassert_eq!(\u0026*welcome, \"   👋 🌍!\");\n```\n\n## Links\n[Latest documentation](https://docs.rs/mut-str/latest/mut_str/)  \n[Examples](/examples/)\n\n[`mut-str` on crates.io](https://crates.io/crates/mut-str)  \n[`mut-str` on GitHub](https://github.com/tomBoddaert/mut-str)\n\n# Features\n- `alloc` (enabled by default) adds implementations that require the `alloc` library.\n- `std` (enabled by default, requires `alloc`) adds implementations specific to the standard library.\n- `nightly` (requires rust [nightly](https://rust-lang.github.io/rustup/concepts/channels.html)) see [below](#nightly-changes).\n\nTo make this package `no-std` compatible, disable the `std` feature.  \n```sh\ncargo add mut-str --no-default-features\n```\n```sh\ncargo add mut-str --no-default-features --features=alloc\n```\n\n## Nightly Changes\n- Uses the [`extern_types`](https://rust-lang.github.io/rfcs/1861-extern-types.html) feature to fix pointer provenance issues.\n- Implements [`Error`](https://doc.rust-lang.org/stable/core/error/trait.Error.html) for errors without [`std`](#features) being enabled.\n\n# License\n\n[`mut-str`](https://github.com/tomBoddaert/mut-str) is dual-licensed under either the [Apache License Version 2.0](/LICENSE_Apache-2.0) or [MIT license](/LICENSE_MIT) at your option.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomboddaert%2Fmut-str","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomboddaert%2Fmut-str","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomboddaert%2Fmut-str/lists"}