Struct yksom::vm::objects::ThinObj [−][src]
#[repr(C)]pub struct ThinObj { /* fields omitted */ }
A narrow pointer to #trait_id.
Implementations
impl ThinObj
[src]
pub fn new<U: Send>(obj: U) -> Gc<Self> where
*const U: CoerceUnsized<*const dyn Obj + 'static>,
U: Obj + 'static,
[src]
*const U: CoerceUnsized<*const dyn Obj + 'static>,
U: Obj + 'static,
Create a new narrow pointer to U: #trait_id
.
pub unsafe fn new_from_layout<U: Obj + 'static, F>(
layout: Layout,
init: F
) -> Gc<Self> where
F: FnOnce(*mut U),
[src]
layout: Layout,
init: F
) -> Gc<Self> where
F: FnOnce(*mut U),
Create a narrow pointer to U: #trait_id
. layout
must be at least big enough for
an object of type U
(but may optionally be bigger) and must have at least the
same alignment that U requires (but may optionally have a bigger alignment).
initwill be called with a pointer to uninitialised memory into which a fully initialised object of type
U*must* be written. After
initcompletes, the object will be considered fully initialised: failure to fully initialise it causes undefined behaviour. Note that if additional memory was requested beyond that needed to store
Uthen that extra memory does not have to be initialised after
init` completes.
pub fn as_gc(&self) -> Gc<dyn Obj>
[src]
pub unsafe fn recover_gc<T: Obj>(o: Gc<T>) -> Gc<ThinObj>
[src]
Convert a downcasted narrow trait object back into a normal narrow trait object.
This will lead to undefined behaviour if o
was not originally a narrow trait
object.
pub fn downcast<U: Obj>(&self) -> Option<Gc<U>>
[src]
Try casting this narrow trait object to a concrete struct type
U
, returning Some(...)
if this narrow trait object has
stored an object of type U
or None
otherwise.
Trait Implementations
impl Deref for ThinObj
[src]
type Target = dyn Obj
The resulting type after dereferencing.
fn deref(&self) -> &(dyn Obj + 'static)
[src]
impl Send for ThinObj
[src]
Auto Trait Implementations
impl !NoTrace for ThinObj
impl RefUnwindSafe for ThinObj
impl !Sync for ThinObj
impl Unpin for ThinObj
impl UnwindSafe for ThinObj
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,