@@ -64,7 +64,7 @@ impl GStr {
64
64
/// This function is the equivalent of [`GStr::to_bytes`] except that it will retain the
65
65
/// trailing nul terminator instead of chopping it off.
66
66
#[ inline]
67
- pub fn to_bytes_with_nul ( & self ) -> & [ u8 ] {
67
+ pub fn as_bytes_with_nul ( & self ) -> & [ u8 ] {
68
68
self . 0 . as_bytes ( )
69
69
}
70
70
// rustdoc-stripper-ignore-next
@@ -73,7 +73,7 @@ impl GStr {
73
73
/// The returned slice will **not** contain the trailing nul terminator that this GLib
74
74
/// string has.
75
75
#[ inline]
76
- pub fn to_bytes ( & self ) -> & [ u8 ] {
76
+ pub fn as_bytes ( & self ) -> & [ u8 ] {
77
77
self . as_str ( ) . as_bytes ( )
78
78
}
79
79
// rustdoc-stripper-ignore-next
@@ -102,7 +102,7 @@ impl GStr {
102
102
/// Converts this GLib string to a C string slice.
103
103
#[ inline]
104
104
pub fn as_c_str ( & self ) -> & CStr {
105
- unsafe { CStr :: from_bytes_with_nul_unchecked ( self . to_bytes_with_nul ( ) ) }
105
+ unsafe { CStr :: from_bytes_with_nul_unchecked ( self . as_bytes_with_nul ( ) ) }
106
106
}
107
107
}
108
108
@@ -119,7 +119,7 @@ impl GStr {
119
119
/// use glib::{gstr, GStr, GString};
120
120
///
121
121
/// const MY_STRING: &GStr = gstr!("Hello");
122
- /// assert_eq!(MY_STRING.to_bytes_with_nul ()[5], 0u8);
122
+ /// assert_eq!(MY_STRING.as_bytes_with_nul ()[5], 0u8);
123
123
/// let owned: GString = MY_STRING.to_owned();
124
124
/// assert_eq!(MY_STRING, owned);
125
125
/// # }
@@ -248,7 +248,7 @@ impl AsRef<Path> for GStr {
248
248
249
249
impl AsRef < [ u8 ] > for GStr {
250
250
fn as_ref ( & self ) -> & [ u8 ] {
251
- self . to_bytes ( )
251
+ self . as_bytes ( )
252
252
}
253
253
}
254
254
0 commit comments