1 unstable release
Uses new Rust 2024
new 0.1.0 | Apr 19, 2025 |
---|
#363 in #string
66 downloads per month
4KB
Rust's .push_str()
method for String
does not return the resulting value. This crate fixes that by providing a new trait method for String. Just import this crate, then call .append_and_return()
on a String like so.
use appendreturn::AppendReturn;
let original_value = String::from("Hello");
let additional_value = " world!!";
let combined_value = original_value.append_and_return(additional_value);
assert_eq!(combined_value, String::from("Hello world!!"));
appendreturn
This crate is for anyone who is annoyed with the fact that Rust's .push_str()
method for String
does not return the resulting value.
This crate is here for you. Hope this helps. ❤️
License
This software is dedicated into the public domain. See UNLICENSE for details.
Example Usage
use appendreturn::AppendReturn;
let original_value = String::from("Hello");
let additional_value = " world!!";
let combined_value = original_value.append_and_return(additional_value);
assert_eq!(combined_value, String::from("Hello world!!"));