diff options
Diffstat (limited to 'font/src/ft/fc')
-rw-r--r-- | font/src/ft/fc/char_set.rs | 12 | ||||
-rw-r--r-- | font/src/ft/fc/config.rs | 10 | ||||
-rw-r--r-- | font/src/ft/fc/font_set.rs | 13 | ||||
-rw-r--r-- | font/src/ft/fc/object_set.rs | 12 | ||||
-rw-r--r-- | font/src/ft/fc/pattern.rs | 12 |
5 files changed, 29 insertions, 30 deletions
diff --git a/font/src/ft/fc/char_set.rs b/font/src/ft/fc/char_set.rs index 9d71fea4..310fa189 100644 --- a/font/src/ft/fc/char_set.rs +++ b/font/src/ft/fc/char_set.rs @@ -11,18 +11,16 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -use std::ptr::NonNull; - use foreign_types::ForeignTypeRef; use super::ffi::FcCharSetCreate; use super::ffi::{FcCharSet, FcCharSetAddChar, FcCharSetDestroy}; foreign_type! { - pub type CharSet { - type CType = FcCharSet; - fn drop = FcCharSetDestroy; - } + type CType = FcCharSet; + fn drop = FcCharSetDestroy; + pub struct CharSet; + pub struct CharSetRef; } impl CharSet { @@ -33,7 +31,7 @@ impl CharSet { impl Default for CharSet { fn default() -> Self { - CharSet(unsafe { NonNull::new(FcCharSetCreate()).unwrap() }) + CharSet(unsafe { FcCharSetCreate() }) } } diff --git a/font/src/ft/fc/config.rs b/font/src/ft/fc/config.rs index cc3b5e52..12ec2844 100644 --- a/font/src/ft/fc/config.rs +++ b/font/src/ft/fc/config.rs @@ -17,10 +17,12 @@ use super::ffi::{FcConfig, FcConfigDestroy, FcConfigGetCurrent, FcConfigGetFonts use super::{FontSetRef, SetName}; foreign_type! { - pub type Config { - type CType = FcConfig; - fn drop = FcConfigDestroy; - } + type CType = FcConfig; + fn drop = FcConfigDestroy; + /// Wraps an FcConfig instance (owned) + pub struct Config; + /// Wraps an FcConfig reference (borrowed) + pub struct ConfigRef; } impl Config { diff --git a/font/src/ft/fc/font_set.rs b/font/src/ft/fc/font_set.rs index e280201b..aeb34371 100644 --- a/font/src/ft/fc/font_set.rs +++ b/font/src/ft/fc/font_set.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. use std::ops::Deref; -use std::ptr::NonNull; use foreign_types::{ForeignType, ForeignTypeRef}; @@ -21,10 +20,12 @@ use super::{ConfigRef, ObjectSetRef, PatternRef}; use super::ffi::{FcFontSet, FcFontSetDestroy, FcFontSetList}; foreign_type! { - pub type FontSet { - type CType = FcFontSet; - fn drop = FcFontSetDestroy; - } + type CType = FcFontSet; + fn drop = FcFontSetDestroy; + /// Wraps an FcFontSet instance (owned) + pub struct FontSet; + /// Wraps an FcFontSet reference (borrowed) + pub struct FontSetRef; } impl FontSet { @@ -43,7 +44,7 @@ impl FontSet { objects.as_ptr(), ) }; - FontSet(NonNull::new(raw).unwrap()) + FontSet(raw) } } diff --git a/font/src/ft/fc/object_set.rs b/font/src/ft/fc/object_set.rs index 4ec15feb..2494b582 100644 --- a/font/src/ft/fc/object_set.rs +++ b/font/src/ft/fc/object_set.rs @@ -11,18 +11,16 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -use std::ptr::NonNull; - use libc::c_char; use super::ffi::{FcObjectSet, FcObjectSetAdd, FcObjectSetCreate, FcObjectSetDestroy}; use foreign_types::ForeignTypeRef; foreign_type! { - pub type ObjectSet { - type CType = FcObjectSet; - fn drop = FcObjectSetDestroy; - } + type CType = FcObjectSet; + fn drop = FcObjectSetDestroy; + pub struct ObjectSet; + pub struct ObjectSetRef; } impl ObjectSet { @@ -33,7 +31,7 @@ impl ObjectSet { impl Default for ObjectSet { fn default() -> Self { - ObjectSet(unsafe { NonNull::new(FcObjectSetCreate()).unwrap() }) + ObjectSet(unsafe { FcObjectSetCreate() }) } } diff --git a/font/src/ft/fc/pattern.rs b/font/src/ft/fc/pattern.rs index b6eceed8..84187aa3 100644 --- a/font/src/ft/fc/pattern.rs +++ b/font/src/ft/fc/pattern.rs @@ -15,7 +15,7 @@ use std::ffi::{CStr, CString}; use std::fmt; use std::mem; use std::path::PathBuf; -use std::ptr::{self, NonNull}; +use std::ptr; use std::str; use foreign_types::{ForeignType, ForeignTypeRef}; @@ -326,10 +326,10 @@ impl_derived_property_iter! { } foreign_type! { - pub type Pattern { - type CType = FcPattern; - fn drop = FcPatternDestroy; - } + type CType = FcPattern; + fn drop = FcPatternDestroy; + pub struct Pattern; + pub struct PatternRef; } macro_rules! string_accessor { @@ -360,7 +360,7 @@ impl Pattern { impl Default for Pattern { fn default() -> Self { - Pattern(unsafe { NonNull::new(FcPatternCreate()).unwrap() }) + Pattern(unsafe { FcPatternCreate() }) } } |