Skip to content

Commit fd1e421

Browse files
authored
Merge pull request #27 from cgzones/const
Declare constructor const
2 parents 66415c3 + 078b117 commit fd1e421

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct NonEmptyString(String);
3535
impl NonEmptyString {
3636
/// Attempts to create a new `NonEmptyString`.
3737
/// If the given `string` is empty, `Err` is returned, containing the original `String`, `Ok` otherwise.
38-
pub fn new(string: String) -> Result<Self, String> {
38+
pub const fn new(string: String) -> Result<Self, String> {
3939
if string.is_empty() {
4040
Err(string)
4141
} else {

0 commit comments

Comments
 (0)