Impl string conversion traits for CommandString#1137
Impl string conversion traits for CommandString#1137apoelstra merged 1 commit intorust-bitcoin:masterfrom
CommandString#1137Conversation
|
I'm tempted to just drop the existing Yes, this would be a breaking change in a single major rev, but it's so slight (since we have explicitly covered all the common examples of |
|
I did consider it however if we ever want to provide I was also thinking about removing the method instead of deprecating/ Chose deprecation because it is nicer to people. I'd only keep it for one release - we could remove it from |
59bd618 to
6fc0e9c
Compare
|
Added |
|
Ok, I understand. I thought the |
After MSRV bump `try_from` usually refers to `TryFrom` method but
`CommandString` used inherent one making it confusing and non-idiomatic.
This implements `FromStr` and `TryFrom<{stringly type}>` for
`CommandString` and deprecates the inherent method in favor of those.
To keep the code using `&'static str` efficient it provides
`try_from_static` inherent method that only converts from
`&'static str`.
Closes rust-bitcoin#1135
6fc0e9c to
405be52
Compare
tcharding
left a comment
There was a problem hiding this comment.
Super anal nits, sorry :) Totally fine to leave till another day, I'm due to do more docs cleanups at some stage soon anyways.
| /// Returns an error if and only if the string is | ||
| /// larger than 12 characters in length. |
There was a problem hiding this comment.
| /// Returns an error if and only if the string is | |
| /// larger than 12 characters in length. | |
| /// Returns an error if, and only if, the string is larger than 12 characters in length. |
| Self::try_from_static_cow(s.into()) | ||
| } | ||
|
|
||
| /// Convert `&'static str` to `CommandString` |
There was a problem hiding this comment.
| /// Convert `&'static str` to `CommandString` | |
| /// Converts `&'static str` to a `CommandString`. |
…or `CommandString` 405be52 Impl string conversion traits for `CommandString` (Martin Habovstiak) Pull request description: After MSRV bump `try_from` usually refers to `TryFrom` method but `CommandString` used inherent one making it confusing and non-idiomatic. This implements `FromStr` and `TryFrom<{stringly type}>` for `CommandString` and deprecates the inherent method in favor of those. To keep the code using `&'static str` efficient it provides `try_from_static` inherent method that only converts from `&'static str`. Closes #1135 ACKs for top commit: sanket1729: utACK 405be52 tcharding: ACK 405be52 Tree-SHA512: 754fc960a4bc5c096cccf47b85a620e33fcf863f3c57ea113eae91cd34006168113dd1efc47231e79e6e237e2fc412890cc9e8a72d4cfc633bfebbecdc4610e6
110b5d8 Bump version to v0.29.0 (Tobin C. Harding) Pull request description: Add changelog notes and bump the version number to v0.29.0. ## Notes I attempted to go through all the PRs since last release, please sing out if you had a PR merged that is not mentioned and you would like it mentioned. The changelog notes can be changed or improved, please do not take me writing them to imply I know exactly what goes on round here - I just made an effort to save others having to do it. ## TODO - [x] merge all 'required' PRs - #1131 - #1137 - #1129 - #1151 - #1165 (add release notes still) - [x] Ensure all green from the CI run on: rust-bitcoin/rust-miniscript#450 - [ ] Carry out (and improve) the #1106 ACKs for top commit: tcharding: ACK 110b5d8 Kixunil: ACK 110b5d8 apoelstra: ACK 110b5d8 sanket1729: reACK 110b5d8 Tree-SHA512: d00c70534476794c01cd694ea9a23affef947c4f913b14344405272bc99cc00763f1ac755cc677e7afbd3dbef573d786251c9093d5dbafd76ee0cf86ca3b0ebd
After MSRV bump
try_fromusually refers toTryFrommethod butCommandStringused inherent one making it confusing and non-idiomatic.This implements
FromStrandTryFrom<{stringly type}>forCommandStringand deprecates the inherent method in favor of those.To keep the code using
&'static strefficient it providestry_from_staticinherent method that only converts from&'static str.Closes #1135