@@ -172,7 +172,7 @@ impl ArcStr {
172
172
/// UTF-8 text.
173
173
///
174
174
/// This function returns `None` if memory allocation fails, see
175
- /// [`ArcStr::build_unchecked `] for a version which calls
175
+ /// [`ArcStr::init_with_unchecked `] for a version which calls
176
176
/// [`handle_alloc_error`](alloc::alloc::handle_alloc_error).
177
177
///
178
178
/// # Safety
@@ -185,14 +185,14 @@ impl ArcStr {
185
185
/// # use arcstr::ArcStr;
186
186
/// # use core::mem::MaybeUninit;
187
187
/// let arcstr = unsafe {
188
- /// ArcStr::try_build_unchecked (10, |s: &mut [MaybeUninit<u8>]| {
188
+ /// ArcStr::try_init_with_unchecked (10, |s: &mut [MaybeUninit<u8>]| {
189
189
/// s.fill(MaybeUninit::new(b'a'));
190
190
/// }).unwrap()
191
191
/// };
192
192
/// assert_eq!(arcstr, "aaaaaaaaaa")
193
193
/// ```
194
194
#[ inline]
195
- pub unsafe fn try_build_unchecked < F > ( n : usize , initializer : F ) -> Option < Self >
195
+ pub unsafe fn try_init_with_unchecked < F > ( n : usize , initializer : F ) -> Option < Self >
196
196
where
197
197
F : FnOnce ( & mut [ MaybeUninit < u8 > ] ) ,
198
198
{
@@ -208,7 +208,7 @@ impl ArcStr {
208
208
///
209
209
/// This function calls
210
210
/// [`handle_alloc_error`](alloc::alloc::handle_alloc_error) if memory
211
- /// allocation fails, see [`ArcStr::try_build_unchecked `] for a version
211
+ /// allocation fails, see [`ArcStr::try_init_with_unchecked `] for a version
212
212
/// which returns `None`
213
213
///
214
214
/// # Safety
@@ -221,14 +221,14 @@ impl ArcStr {
221
221
/// # use arcstr::ArcStr;
222
222
/// # use core::mem::MaybeUninit;
223
223
/// let arcstr = unsafe {
224
- /// ArcStr::build_unchecked (10, |s: &mut [MaybeUninit<u8>]| {
224
+ /// ArcStr::init_with_unchecked (10, |s: &mut [MaybeUninit<u8>]| {
225
225
/// s.fill(MaybeUninit::new(b'a'));
226
226
/// })
227
227
/// };
228
228
/// assert_eq!(arcstr, "aaaaaaaaaa")
229
229
/// ```
230
230
#[ inline]
231
- pub unsafe fn build_unchecked < F > ( n : usize , initializer : F ) -> Self
231
+ pub unsafe fn init_with_unchecked < F > ( n : usize , initializer : F ) -> Self
232
232
where
233
233
F : FnOnce ( & mut [ MaybeUninit < u8 > ] ) ,
234
234
{
@@ -246,7 +246,7 @@ impl ArcStr {
246
246
/// Note: This function is provided with a zeroed buffer, and performs UTF-8
247
247
/// validation after calling the initializer. While both of these are fast
248
248
/// operations, some high-performance use cases will be better off using
249
- /// [`ArcStr::try_build_unchecked `] as the building block.
249
+ /// [`ArcStr::try_init_with_unchecked `] as the building block.
250
250
///
251
251
/// # Errors
252
252
/// The provided `initializer` callback must initialize the provided buffer
@@ -257,7 +257,7 @@ impl ArcStr {
257
257
/// ```
258
258
/// # use arcstr::ArcStr;
259
259
///
260
- /// let s = ArcStr::build (5, |slice| {
260
+ /// let s = ArcStr::init_with (5, |slice| {
261
261
/// slice
262
262
/// .iter_mut()
263
263
/// .zip(b'0'..b'5')
@@ -266,7 +266,7 @@ impl ArcStr {
266
266
/// assert_eq!(s, "01234");
267
267
/// ```
268
268
#[ inline]
269
- pub fn build < F > ( n : usize , initializer : F ) -> Result < Self , core:: str:: Utf8Error >
269
+ pub fn init_with < F > ( n : usize , initializer : F ) -> Result < Self , core:: str:: Utf8Error >
270
270
where
271
271
F : FnOnce ( & mut [ u8 ] ) ,
272
272
{
0 commit comments