pub(crate) trait Serializable: DomObjectwhere
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<HashMap<NamespaceIndex<Self::Index>, Self::Data>>;
}
Expand description
Interface for serializable platform objects. https://html.spec.whatwg.org/multipage/#serializable
Required Associated Types§
Required Methods§
Sourcefn deserialize(
owner: &GlobalScope,
serialized: Self::Data,
can_gc: CanGc,
) -> Result<DomRoot<Self>, ()>where
Self: Sized,
fn deserialize(
owner: &GlobalScope,
serialized: Self::Data,
can_gc: CanGc,
) -> Result<DomRoot<Self>, ()>where
Self: Sized,
Sourcefn serialized_storage<'a>(
data: StructuredData<'a, '_>,
) -> &'a mut Option<HashMap<NamespaceIndex<Self::Index>, Self::Data>>
fn serialized_storage<'a>( data: StructuredData<'a, '_>, ) -> &'a mut Option<HashMap<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.