Skip to content

Commit b6142eb

Browse files
committed
Fix #195
1 parent 1f8812c commit b6142eb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

phper/src/classes.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ enum InnerClassEntry {
278278
/// module
279279
/// }
280280
/// ```
281-
pub struct StateClass<T> {
281+
pub struct StateClass<T: ?Sized> {
282282
inner: Rc<RefCell<InnerClassEntry>>,
283283
_p: PhantomData<T>,
284284
}
285285

286-
impl StateClass<()> {
286+
impl StateClass<[()]> {
287287
/// Create from name, which will be looked up from globals.
288288
pub fn from_name(name: impl Into<String>) -> Self {
289289
Self {
@@ -293,7 +293,7 @@ impl StateClass<()> {
293293
}
294294
}
295295

296-
impl<T> StateClass<T> {
296+
impl<T: ?Sized> StateClass<T> {
297297
fn null() -> Self {
298298
Self {
299299
inner: Rc::new(RefCell::new(InnerClassEntry::Ptr(null()))),
@@ -324,7 +324,9 @@ impl<T> StateClass<T> {
324324
}
325325
}
326326
}
327+
}
327328

329+
impl<T: 'static> StateClass<T> {
328330
/// Create the object from class and call `__construct` with arguments.
329331
///
330332
/// If the `__construct` is private, or protected and the called scope isn't
@@ -605,7 +607,7 @@ impl<T: 'static> ClassEntity<T> {
605607
/// module
606608
/// }
607609
/// ```
608-
pub fn extends<S: 'static>(&mut self, parent: StateClass<S>) {
610+
pub fn extends<S: ?Sized>(&mut self, parent: StateClass<S>) {
609611
self.parent = Some(unsafe { transmute::<StateClass<S>, StateClass<()>>(parent) });
610612
}
611613

0 commit comments

Comments
 (0)