pub struct Ectoplasm(_);
Expand description
You know you are in the Ghost Realm™ when ectoplasm oozes all around you…
Unforgeable token which can thus only be constructed by
materialize!
-ing a Ghost<Ectoplasm>
.
This provides an impossible to misuse
.materialize()
method.
use ::ghosts::vestibule::*;
let casper = ghost!({
let inside_a_ghost: Ectoplasm = materialize!(Ghost);
// …
});
Implementations
sourceimpl Ectoplasm
impl Ectoplasm
sourcepub fn materialize<T>(self, _: Ghost<T>) -> T
pub fn materialize<T>(self, _: Ghost<T>) -> T
Equivalent to materialize()
, but for it being impossible to
misuse.
use ::ghosts::vestibule::*;
fn ghost_ok_or<T, Err> (
inside_a_ghost: Ectoplasm,
g: Ghost<Option<T>>,
err: Err,
) -> Result<T, Err>
{
inside_a_ghost.materialize(g).ok_or(err)
}
let casper = ghost!({
let ectoplasm = materialize!(Ghost);
let none = ghost!(None::<()>);
let _: i32 = match ghost_ok_or(ectoplasm, none, 42) {
| Ok(_unreachable) => unreachable!(),
| Err(err) => err,
};
});
Trait Implementations
sourceimpl Ord for Ectoplasm
impl Ord for Ectoplasm
sourceimpl PartialOrd<Ectoplasm> for Ectoplasm
impl PartialOrd<Ectoplasm> for Ectoplasm
sourcefn partial_cmp(&self, other: &Ectoplasm) -> Option<Ordering>
fn partial_cmp(&self, other: &Ectoplasm) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Ectoplasm
impl Eq for Ectoplasm
impl StructuralEq for Ectoplasm
impl StructuralPartialEq for Ectoplasm
Auto Trait Implementations
impl RefUnwindSafe for Ectoplasm
impl Send for Ectoplasm
impl Sync for Ectoplasm
impl Unpin for Ectoplasm
impl UnwindSafe for Ectoplasm
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more