Skip to content

Commit

Permalink
feat: add RC TypeInfo (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvolveArt authored Jun 21, 2023
1 parent 1d5ce77 commit 18d3191
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::prelude::{
Range,
RangeInclusive,
},
rc::Rc,
string::String,
sync::Arc,
time::Duration,
Expand Down Expand Up @@ -299,6 +300,17 @@ where
}
}

impl<T> TypeInfo for Rc<T>
where
T: TypeInfo + ?Sized + 'static,
{
type Identity = T;

fn type_info() -> Type {
Self::Identity::type_info()
}
}

impl<T> TypeInfo for Arc<T>
where
T: TypeInfo + ?Sized + 'static,
Expand Down
2 changes: 2 additions & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cfg_if! {
sync,
time,
vec,
rc
};
} else {
pub use alloc::{
Expand All @@ -50,6 +51,7 @@ cfg_if! {
string,
sync,
vec,
rc
};

pub use core::{
Expand Down

0 comments on commit 18d3191

Please sign in to comment.