[][src]Union high_mem_utils::CatchSeq

pub union CatchSeq<'a, T> {
    // some fields omitted
}
Deprecated since 0.2.5:

Catch has implementations for serve the same functionality

An union slice that can be leaked or sealed(owned),useful when you want to give temporal global access to a particular sequence.

Methods

impl<'a, T> CatchSeq<'a, T>[src]

pub fn new(a: Vec<T>) -> Self[src]

Creates a new CatchSeq with a leak, you can lately get the underlying sequence and consume the CatchSeq with the seal method.

pub fn leaked(&self) -> &&'a mut [T][src]

Returns a a reference to the leaked field,as the only safe ways for construct this union returns a leaked one,for warranty never transmute stack to heap data,this method does not use transmute implicitly.

pub fn seal(self) -> Vec<T>[src]

Consumes the Catch and gets the inner Vec, preventing the memory leak.

This does a call to transmute but,as the only safe ways for construct this union returns a leaked one,this never trigger undefined behavior by itself.

pub fn leak(self) -> &'a mut [T][src]

Consumes the CatchSeq and returns a mutable reference pointing to leaked data.

pub unsafe fn from_leaked(leaked: &'a mut [T]) -> Self[src]

Creates a new CatchSeq from a &mut [T],without checking if the referent is in the heap.

Safety

This function should only be used with data returned by the leak method from a safely constructed CatchSeq or with data returned by Vec::leak otherwise this will trigger undefined behavior if the seal method is called.

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for CatchSeq<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for CatchSeq<'a, T> where
    T: Send

impl<'a, T> Sync for CatchSeq<'a, T> where
    T: Sync

impl<'a, T> Unpin for CatchSeq<'a, T>

impl<'a, T> !UnwindSafe for CatchSeq<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.