Skip to content

Commit 992d656

Browse files
committed
Expose SimpleNonZeroPointer trait
I can't believe I missed this... Release v0.1.6 Boy I'm incrementing the patch version a lot....
1 parent 65f48f3 commit 992d656

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "static-reflect"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
edition = "2018"
55
description = "Static type information, giving a form of compile-time reflection"
66
license = "MIT"

src/core.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Implementations of [StaticReflect] for core types (for `#![no_std]`)
22
use crate::StaticReflect;
3-
use crate::types::{TypeInfo};
3+
use crate::types::{TypeInfo, SimpleNonZeroPointer};
44
use std::mem::{self, ManuallyDrop};
55
use core::ptr::NonNull;
66

@@ -64,12 +64,6 @@ unsafe impl <T> StaticReflect for *const T {
6464
const TYPE_INFO: TypeInfo<'static> = TypeInfo::Pointer;
6565
}
6666

67-
/// A non-zero pointer type, where optional types
68-
/// are guaranteed to use the nullable representation
69-
///
70-
/// If `T: SimpleNonZeroPointer` -> `sizeof(Option<T>) == sizeof(T) && repr(Option<T>) == repr(T)`
71-
pub unsafe trait SimpleNonZeroPointer: StaticReflect {}
72-
7367
unsafe impl <T> SimpleNonZeroPointer for NonNull<T> {}
7468
unsafe impl <T> StaticReflect for NonNull<T> {
7569
const TYPE_INFO: TypeInfo<'static> = TypeInfo::Pointer;

src/types.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ use zerogc_derive::{unsafe_gc_impl};
1313
#[cfg(feature = "builtins")]
1414
use crate::builtins::{AsmSlice, AsmStr};
1515

16+
/// A non-zero pointer type, where optional types
17+
/// are guaranteed to use the nullable representation
18+
///
19+
/// If `T: SimpleNonZeroPointer` -> `sizeof(Option<T>) == sizeof(T) && repr(Option<T>) == repr(T)`
20+
pub unsafe trait SimpleNonZeroPointer: StaticReflect {}
21+
1622
/// An integer size, named in the style of C/Java
1723
///
1824
/// Although named after their C equivalents,

0 commit comments

Comments
 (0)