Skip to main content

WorkerData

Trait WorkerData 

Source
pub trait WorkerData:
    Send
    + Sized
    + 'static {
    // Required methods
    fn into_bytes(self) -> Vec<u8> ⓘ;
    fn from_bytes(bytes: Vec<u8>) -> Self;
}
Expand description

Data a WorkerJob takes or returns. It crosses to the worker and back as bytes: a Web Worker has a memory of its own, so nothing that points into the page’s memory can cross.

Required Methods§

Source

fn into_bytes(self) -> Vec<u8> ⓘ

The bytes from_bytes reads the value back from.

Source

fn from_bytes(bytes: Vec<u8>) -> Self

The value into_bytes wrote as bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WorkerData for ()

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(_: Vec<u8>) -> Self

Source§

impl WorkerData for String

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for Vec<u8>

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for f32

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for f64

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for i8

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for i16

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for i32

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for i64

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for u8

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for u16

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for u32

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Source§

impl WorkerData for u64

Source§

fn into_bytes(self) -> Vec<u8> ⓘ

Source§

fn from_bytes(bytes: Vec<u8>) -> Self

Implementors§