File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -1485,9 +1485,24 @@ fn as_c_str<T>(s: str, f: fn(*libc::c_char) -> T) -> T unsafe {
1485
1485
as_buf ( s) { |buf| f ( buf as * libc:: c_char ) }
1486
1486
}
1487
1487
1488
- #[ doc = "Allocate more memory for a string, up to `nn` + 1 bytes" ]
1489
- fn reserve ( & ss: str , nn : uint ) {
1490
- rustrt:: str_reserve_shared ( ss, nn) ;
1488
+ #[ doc = "
1489
+ Reserves capacity for exactly `n` bytes in the given string, not including
1490
+ the null terminator.
1491
+
1492
+ Assuming single-byte characters, the resulting string will be large
1493
+ enough to hold a string of length `n`. To account for the null terminator,
1494
+ the underlying buffer will have the size `n` + 1.
1495
+
1496
+ If the capacity for `s` is already equal to or greater than the requested
1497
+ capacity, then no action is taken.
1498
+
1499
+ # Arguments
1500
+
1501
+ * s - A string
1502
+ * n - The number of bytes to reserve space for
1503
+ " ]
1504
+ fn reserve ( & s: str , n : uint ) {
1505
+ rustrt:: str_reserve_shared ( s, n) ;
1491
1506
}
1492
1507
1493
1508
#[ doc = "Unsafe operations" ]
You can’t perform that action at this time.
0 commit comments