[][src]Struct libwebp::boxed::WebpBox

pub struct WebpBox<T: ?Sized> { /* fields omitted */ }

A safe RAII wrapper for WebPFree.

WebpBox is much like Box, except what function is used for freeing.

Example

The main usecase is as a return value from libwebp.

use libwebp::WebPEncodeRGBA;

let buf: &[u8];
// This variable has the type of `WebpBox<[u8]>`.
let data = WebPEncodeRGBA(buf, 2, 2, 8, 75.0).unwrap();

Methods

impl<T: ?Sized> WebpBox<T>[src]

pub unsafe fn from_raw(raw: *mut T) -> WebpBox<T>[src]

Creates WebpBox from a raw pointer.

Safety

  • raw must be non-null.
  • raw must be well-aligned.
  • The pointee must be valid as T.
  • The pointee must be exclusively accessible.
  • raw must be freeable via WebPFree.

pub fn into_raw(b: WebpBox<T>) -> *mut T[src]

Turns WebpBox into a raw pointer without freeing anything.

Trait Implementations

impl<T: Debug + ?Sized> Debug for WebpBox<T>[src]

impl<T: ?Sized> Deref for WebpBox<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: ?Sized> DerefMut for WebpBox<T>[src]

impl<T: ?Sized> Drop for WebpBox<T>[src]

impl<T: ?Sized + RefUnwindSafe> RefUnwindSafe for WebpBox<T>[src]

impl<T: ?Sized + Send> Send for WebpBox<T>[src]

impl<T: ?Sized + Sync> Sync for WebpBox<T>[src]

impl<T: ?Sized + UnwindSafe> UnwindSafe for WebpBox<T>[src]

Auto Trait Implementations

impl<T: ?Sized> Unpin for WebpBox<T> where
    T: Unpin

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.