Skip to content

Commit 01b6d66

Browse files
committed
Rename GStrPtr to GStringPtr
Since this is an owned type this is more consistent.
1 parent e842054 commit 01b6d66

File tree

3 files changed

+81
-78
lines changed

3 files changed

+81
-78
lines changed

glib/src/collections/strv.rs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::{ffi::c_char, fmt, marker::PhantomData, mem, ptr};
44

5-
use crate::{translate::*, GStr, GStrPtr, GString};
5+
use crate::{translate::*, GStr, GString, GStringPtr};
66

77
// rustdoc-stripper-ignore-next
88
/// Minimum size of the `StrV` allocation.
@@ -100,25 +100,25 @@ impl Default for StrV {
100100
}
101101
}
102102

103-
impl AsRef<[GStrPtr]> for StrV {
103+
impl AsRef<[GStringPtr]> for StrV {
104104
#[inline]
105-
fn as_ref(&self) -> &[GStrPtr] {
105+
fn as_ref(&self) -> &[GStringPtr] {
106106
self.as_slice()
107107
}
108108
}
109109

110-
impl std::borrow::Borrow<[GStrPtr]> for StrV {
110+
impl std::borrow::Borrow<[GStringPtr]> for StrV {
111111
#[inline]
112-
fn borrow(&self) -> &[GStrPtr] {
112+
fn borrow(&self) -> &[GStringPtr] {
113113
self.as_slice()
114114
}
115115
}
116116

117117
impl std::ops::Deref for StrV {
118-
type Target = [GStrPtr];
118+
type Target = [GStringPtr];
119119

120120
#[inline]
121-
fn deref(&self) -> &[GStrPtr] {
121+
fn deref(&self) -> &[GStringPtr] {
122122
self.as_slice()
123123
}
124124
}
@@ -160,8 +160,8 @@ impl std::iter::FromIterator<GString> for StrV {
160160
}
161161

162162
impl<'a> std::iter::IntoIterator for &'a StrV {
163-
type Item = &'a GStrPtr;
164-
type IntoIter = std::slice::Iter<'a, GStrPtr>;
163+
type Item = &'a GStringPtr;
164+
type IntoIter = std::slice::Iter<'a, GStringPtr>;
165165

166166
#[inline]
167167
fn into_iter(self) -> Self::IntoIter {
@@ -201,12 +201,12 @@ impl IntoIter {
201201
// rustdoc-stripper-ignore-next
202202
/// Returns the remaining items as slice.
203203
#[inline]
204-
pub fn as_slice(&self) -> &[GStrPtr] {
204+
pub fn as_slice(&self) -> &[GStringPtr] {
205205
unsafe {
206206
if self.len == 0 {
207207
&[]
208208
} else {
209-
std::slice::from_raw_parts(self.idx.as_ptr() as *const GStrPtr, self.len)
209+
std::slice::from_raw_parts(self.idx.as_ptr() as *const GStringPtr, self.len)
210210
}
211211
}
212212
}
@@ -407,7 +407,7 @@ impl StrV {
407407
// rustdoc-stripper-ignore-next
408408
/// Borrows a C array.
409409
#[inline]
410-
pub unsafe fn from_glib_borrow<'a>(ptr: *const *const c_char) -> &'a [GStrPtr] {
410+
pub unsafe fn from_glib_borrow<'a>(ptr: *const *const c_char) -> &'a [GStringPtr] {
411411
let mut len = 0;
412412
if !ptr.is_null() {
413413
while !(*ptr.add(len)).is_null() {
@@ -420,13 +420,16 @@ impl StrV {
420420
// rustdoc-stripper-ignore-next
421421
/// Borrows a C array.
422422
#[inline]
423-
pub unsafe fn from_glib_borrow_num<'a>(ptr: *const *const c_char, len: usize) -> &'a [GStrPtr] {
423+
pub unsafe fn from_glib_borrow_num<'a>(
424+
ptr: *const *const c_char,
425+
len: usize,
426+
) -> &'a [GStringPtr] {
424427
debug_assert!(!ptr.is_null() || len == 0);
425428

426429
if len == 0 {
427430
&[]
428431
} else {
429-
std::slice::from_raw_parts(ptr as *const GStrPtr, len)
432+
std::slice::from_raw_parts(ptr as *const GStringPtr, len)
430433
}
431434
}
432435

@@ -675,14 +678,14 @@ impl StrV {
675678
}
676679

677680
// rustdoc-stripper-ignore-next
678-
/// Borrows this slice as a `&[GStrPtr]`.
681+
/// Borrows this slice as a `&[GStringPtr]`.
679682
#[inline]
680-
pub fn as_slice(&self) -> &[GStrPtr] {
683+
pub fn as_slice(&self) -> &[GStringPtr] {
681684
unsafe {
682685
if self.len == 0 {
683686
&[]
684687
} else {
685-
std::slice::from_raw_parts(self.ptr.as_ptr() as *const GStrPtr, self.len)
688+
std::slice::from_raw_parts(self.ptr.as_ptr() as *const GStringPtr, self.len)
686689
}
687690
}
688691
}
@@ -948,7 +951,7 @@ impl crate::StaticType for StrV {
948951
}
949952
}
950953

951-
impl<'a> crate::StaticType for &'a [GStrPtr] {
954+
impl<'a> crate::StaticType for &'a [GStringPtr] {
952955
#[inline]
953956
fn static_type() -> crate::Type {
954957
<Vec<String>>::static_type()
@@ -968,7 +971,7 @@ unsafe impl<'a> crate::value::FromValue<'a> for StrV {
968971
}
969972
}
970973

971-
unsafe impl<'a> crate::value::FromValue<'a> for &'a [GStrPtr] {
974+
unsafe impl<'a> crate::value::FromValue<'a> for &'a [GStringPtr] {
972975
type Checker = crate::value::GenericValueTypeChecker<Self>;
973976

974977
unsafe fn from_value(value: &'a crate::value::Value) -> Self {

0 commit comments

Comments
 (0)