Struct libwebp::boxed::WebpBox

source ·
pub struct WebpBox<T: ?Sized> { /* private fields */ }
Expand description

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();

Implementations§

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.

Turns WebpBox into a raw pointer without freeing anything.

Trait Implementations§

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.