File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,30 @@ impl ByteStr {
6868 ByteStr :: from_bytes ( bytes. as_ref ( ) )
6969 }
7070
71+ /// Returns the same string as `&ByteStr`.
72+ ///
73+ /// This method is redundant when used directly on `&ByteStr`, but
74+ /// it helps dereferencing other `ByteString`-like types,
75+ /// for example `Box<ByteStr>` or `Arc<ByteStr>`.
76+ #[ inline]
77+ // #[unstable(feature = "str_as_str", issue = "130366")]
78+ #[ unstable( feature = "bstr" , issue = "134915" ) ]
79+ pub const fn as_byte_str ( & self ) -> & ByteStr {
80+ self
81+ }
82+
83+ /// Returns the same string as `&mut ByteStr`.
84+ ///
85+ /// This method is redundant when used directly on `&mut ByteStr`, but
86+ /// it helps dereferencing other `ByteString`-like types,
87+ /// for example `Box<ByteStr>` or `MutexGuard<ByteStr>`.
88+ #[ inline]
89+ // #[unstable(feature = "str_as_str", issue = "130366")]
90+ #[ unstable( feature = "bstr" , issue = "134915" ) ]
91+ pub const fn as_mut_byte_str ( & mut self ) -> & mut ByteStr {
92+ self
93+ }
94+
7195 #[ doc( hidden) ]
7296 #[ unstable( feature = "bstr_internals" , issue = "none" ) ]
7397 #[ inline]
You can’t perform that action at this time.
0 commit comments