-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is similar to allocating slices, but for string slices. Because string slices are a strange beast and none of the other methods can be used *directly*. It could be done at the caller side, but then the user would need to use `unsafe` which might be unacceptable in business-logic applications or crates (or be content with the needless check for utf8 which is already guaranteed to be valid).
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,4 +219,12 @@ quickcheck! { | |
allocated.push(range); | ||
} | ||
} | ||
|
||
fn alloc_strs(allocs: Vec<String>) -> () { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vorner
Author
Contributor
|
||
let b = Bump::new(); | ||
let allocated: Vec<&str> = allocs.iter().map(|s| b.alloc_str(s) as &_).collect(); | ||
for (val, alloc) in allocs.into_iter().zip(allocated) { | ||
assert_eq!(val, alloc); | ||
} | ||
} | ||
} |
why
-> ()
?