Serializable

Trait Serializable 

Source
pub(crate) trait Serializable: DomObject + MarkedAsSerializableInIdl
where Self: Sized,
{ type Index: Copy + Eq + Hash; type Data; // Required methods fn serialize(&self) -> Result<(NamespaceIndex<Self::Index>, Self::Data), ()>; fn deserialize( owner: &GlobalScope, serialized: Self::Data, can_gc: CanGc, ) -> Result<DomRoot<Self>, ()> where Self: Sized; fn serialized_storage<'a>( data: StructuredData<'a, '_>, ) -> &'a mut Option<FxHashMap<NamespaceIndex<Self::Index>, Self::Data>>; }
Expand description

Interface for serializable platform objects. https://html.spec.whatwg.org/multipage/#serializable

Required Associated Types§

Required Methods§

Source

fn serialize(&self) -> Result<(NamespaceIndex<Self::Index>, Self::Data), ()>

Source

fn deserialize( owner: &GlobalScope, serialized: Self::Data, can_gc: CanGc, ) -> Result<DomRoot<Self>, ()>
where Self: Sized,

Source

fn serialized_storage<'a>( data: StructuredData<'a, '_>, ) -> &'a mut Option<FxHashMap<NamespaceIndex<Self::Index>, Self::Data>>

Returns the field of [StructuredDataReader]/[StructuredDataWriter] that should be used to read/store serialized instances of this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Serializable for Blob

Source§

impl Serializable for ImageBitmap

Source§

impl Serializable for ImageData

Source§

impl Serializable for DOMException

Source§

impl Serializable for DOMMatrix

Source§

impl Serializable for DOMMatrixReadOnly

Source§

impl Serializable for DOMPoint

Source§

impl Serializable for DOMPointReadOnly

Source§

impl Serializable for DOMQuad

Source§

impl Serializable for DOMRect

Source§

impl Serializable for DOMRectReadOnly

Source§

impl Serializable for File

Source§

impl Serializable for FileList

Source§

impl Serializable for QuotaExceededError