pub type Any<D> = OptionalRef<AnyInternal<D>>;
Aliased Type§
pub struct Any<D> { /* private fields */ }
Implementations§
Source§impl<D: Dealloc> Any<D>
impl<D: Dealloc> Any<D>
pub fn is<T: AnyCast<D>>(&self) -> bool
Sourcepub fn move_from<T: AnyCast<D>>(t: T) -> Self
pub fn move_from<T: AnyCast<D>>(t: T) -> Self
T
should have the same allocator as Any
.
use nanvm_lib::{js::{any::Any, js_string::JsStringRef}, mem::{manager::Dealloc, ref_::Ref}};
fn dummy<A: Dealloc>(s: JsStringRef<A>) -> Any<A> {
Any::move_from(s)
}
ⓘ
use nanvm_lib::{js::{any::Any, js_string::JsStringRef}, mem::{manager::Dealloc, ref_::Ref}};
fn dummy<A: Dealloc, B: Dealloc>(s: JsStringRef<A>) -> Any<B> {
Any::move_from(s)
}
pub fn try_move<T: AnyCast<D>>(self) -> Result<T, ()>
pub fn get_type(&self) -> Type
Sourcepub fn try_ref<T: RefCast<D>>(&self) -> Result<&Block<T, D>, ()>
pub fn try_ref<T: RefCast<D>>(&self) -> Result<&Block<T, D>, ()>
T
should have the same allocator as Any
.
use nanvm_lib::{js::{any::Any, js_string::JsStringRef}, mem::{manager::Dealloc, ref_::Ref}};
fn dummy<A: Dealloc>(a: Any<A>) -> JsStringRef<A> {
a.try_move().unwrap()
}
ⓘ
use nanvm_lib::{js::{any::Any, js_string::JsStringRef}, mem::{manager::Dealloc, ref_::Ref}};
fn dummy<A: Dealloc, B: Dealloc>(a: Any<A>) -> JsStringRef, B> {
a.try_move().unwrap()
}