File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -550,11 +550,15 @@ impl OsString {
550
550
OsStr :: from_inner_mut ( self . inner . leak ( ) )
551
551
}
552
552
553
- /// Provides plumbing to core `Vec::truncate`.
554
- /// More well behaving alternative to allowing outer types
555
- /// full mutable access to the core `Vec`.
553
+ /// Truncate the the `OsString` to the specified length.
554
+ ///
555
+ /// # Panics
556
+ /// Panics if `len` does not lie on a valid `OsStr` boundary
557
+ /// (as described in [`OsStr::slice_encoded_bytes`]).
556
558
#[ inline]
557
- pub ( crate ) fn truncate ( & mut self , len : usize ) {
559
+ #[ unstable( feature = "os_string_truncate" , issue = "133262" ) ]
560
+ pub fn truncate ( & mut self , len : usize ) {
561
+ self . as_os_str ( ) . inner . check_public_boundary ( len) ;
558
562
self . inner . truncate ( len) ;
559
563
}
560
564
You can’t perform that action at this time.
0 commit comments