summaryrefslogtreecommitdiff
path: root/font
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-06-08 16:01:14 +0000
committerGitHub <noreply@github.com>2019-06-08 16:01:14 +0000
commit4cd55acd7820a7358f9175c106c91e0945fb15b2 (patch)
tree9e4e8383e73406524ccb2d28e666e9c2a77bbbd0 /font
parent527dc8f564823d3dd01f79f22614271c7f3bc518 (diff)
downloadalacritty-4cd55acd7820a7358f9175c106c91e0945fb15b2.tar.gz
alacritty-4cd55acd7820a7358f9175c106c91e0945fb15b2.zip
Bump minimum supported Rust version to 1.32.0
Diffstat (limited to 'font')
-rw-r--r--font/Cargo.toml2
-rw-r--r--font/src/ft/fc/char_set.rs12
-rw-r--r--font/src/ft/fc/config.rs10
-rw-r--r--font/src/ft/fc/font_set.rs13
-rw-r--r--font/src/ft/fc/object_set.rs12
-rw-r--r--font/src/ft/fc/pattern.rs12
6 files changed, 31 insertions, 30 deletions
diff --git a/font/Cargo.toml b/font/Cargo.toml
index e5515a8e..2159f7d6 100644
--- a/font/Cargo.toml
+++ b/font/Cargo.toml
@@ -8,7 +8,7 @@ license = "Apache-2.0"
[dependencies]
euclid = "0.19.2"
libc = "0.2"
-foreign-types = "0.3"
+foreign-types = "0.4"
log = "0.4"
[target.'cfg(not(any(target_os = "macos", windows)))'.dependencies]
diff --git a/font/src/ft/fc/char_set.rs b/font/src/ft/fc/char_set.rs
index 310fa189..9d71fea4 100644
--- a/font/src/ft/fc/char_set.rs
+++ b/font/src/ft/fc/char_set.rs
@@ -11,16 +11,18 @@
// 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! {
- type CType = FcCharSet;
- fn drop = FcCharSetDestroy;
- pub struct CharSet;
- pub struct CharSetRef;
+ pub type CharSet {
+ type CType = FcCharSet;
+ fn drop = FcCharSetDestroy;
+ }
}
impl CharSet {
@@ -31,7 +33,7 @@ impl CharSet {
impl Default for CharSet {
fn default() -> Self {
- CharSet(unsafe { FcCharSetCreate() })
+ CharSet(unsafe { NonNull::new(FcCharSetCreate()).unwrap() })
}
}
diff --git a/font/src/ft/fc/config.rs b/font/src/ft/fc/config.rs
index 12ec2844..cc3b5e52 100644
--- a/font/src/ft/fc/config.rs
+++ b/font/src/ft/fc/config.rs
@@ -17,12 +17,10 @@ use super::ffi::{FcConfig, FcConfigDestroy, FcConfigGetCurrent, FcConfigGetFonts
use super::{FontSetRef, SetName};
foreign_type! {
- type CType = FcConfig;
- fn drop = FcConfigDestroy;
- /// Wraps an FcConfig instance (owned)
- pub struct Config;
- /// Wraps an FcConfig reference (borrowed)
- pub struct ConfigRef;
+ pub type Config {
+ type CType = FcConfig;
+ fn drop = FcConfigDestroy;
+ }
}
impl Config {
diff --git a/font/src/ft/fc/font_set.rs b/font/src/ft/fc/font_set.rs
index aeb34371..e280201b 100644
--- a/font/src/ft/fc/font_set.rs
+++ b/font/src/ft/fc/font_set.rs
@@ -12,6 +12,7 @@
// 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};
@@ -20,12 +21,10 @@ use super::{ConfigRef, ObjectSetRef, PatternRef};
use super::ffi::{FcFontSet, FcFontSetDestroy, FcFontSetList};
foreign_type! {
- type CType = FcFontSet;
- fn drop = FcFontSetDestroy;
- /// Wraps an FcFontSet instance (owned)
- pub struct FontSet;
- /// Wraps an FcFontSet reference (borrowed)
- pub struct FontSetRef;
+ pub type FontSet {
+ type CType = FcFontSet;
+ fn drop = FcFontSetDestroy;
+ }
}
impl FontSet {
@@ -44,7 +43,7 @@ impl FontSet {
objects.as_ptr(),
)
};
- FontSet(raw)
+ FontSet(NonNull::new(raw).unwrap())
}
}
diff --git a/font/src/ft/fc/object_set.rs b/font/src/ft/fc/object_set.rs
index 2494b582..4ec15feb 100644
--- a/font/src/ft/fc/object_set.rs
+++ b/font/src/ft/fc/object_set.rs
@@ -11,16 +11,18 @@
// 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! {
- type CType = FcObjectSet;
- fn drop = FcObjectSetDestroy;
- pub struct ObjectSet;
- pub struct ObjectSetRef;
+ pub type ObjectSet {
+ type CType = FcObjectSet;
+ fn drop = FcObjectSetDestroy;
+ }
}
impl ObjectSet {
@@ -31,7 +33,7 @@ impl ObjectSet {
impl Default for ObjectSet {
fn default() -> Self {
- ObjectSet(unsafe { FcObjectSetCreate() })
+ ObjectSet(unsafe { NonNull::new(FcObjectSetCreate()).unwrap() })
}
}
diff --git a/font/src/ft/fc/pattern.rs b/font/src/ft/fc/pattern.rs
index 84187aa3..b6eceed8 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;
+use std::ptr::{self, NonNull};
use std::str;
use foreign_types::{ForeignType, ForeignTypeRef};
@@ -326,10 +326,10 @@ impl_derived_property_iter! {
}
foreign_type! {
- type CType = FcPattern;
- fn drop = FcPatternDestroy;
- pub struct Pattern;
- pub struct PatternRef;
+ pub type Pattern {
+ type CType = FcPattern;
+ fn drop = FcPatternDestroy;
+ }
}
macro_rules! string_accessor {
@@ -360,7 +360,7 @@ impl Pattern {
impl Default for Pattern {
fn default() -> Self {
- Pattern(unsafe { FcPatternCreate() })
+ Pattern(unsafe { NonNull::new(FcPatternCreate()).unwrap() })
}
}