pub struct SerializationRegistry { /* private fields */ }
Implementations§
Source§impl SerializationRegistry
impl SerializationRegistry
pub fn with_basic_types(self) -> Self
pub fn with_serde<T: Serialize + DeserializeOwned>(self) -> Self
pub fn register_serde<T: Serialize + DeserializeOwned>(&mut self)
pub fn register<T>( &mut self, serialize_from: impl Fn(&T) -> Result<Intermediate, Box<dyn Error>> + Send + Sync + 'static, deserialize_to: impl Fn(&mut T, &Intermediate) -> Result<(), Box<dyn Error>> + Send + Sync + 'static, )
Sourcepub unsafe fn register_raw(
&mut self,
type_hash: TypeHash,
serialize_from: impl Fn(*const u8) -> Result<Intermediate, Box<dyn Error>> + Send + Sync + 'static,
deserialize_to: impl Fn(*mut u8, &Intermediate) -> Result<(), Box<dyn Error>> + Send + Sync + 'static,
)
pub unsafe fn register_raw( &mut self, type_hash: TypeHash, serialize_from: impl Fn(*const u8) -> Result<Intermediate, Box<dyn Error>> + Send + Sync + 'static, deserialize_to: impl Fn(*mut u8, &Intermediate) -> Result<(), Box<dyn Error>> + Send + Sync + 'static, )
§Safety
pub fn unregister<T>(&mut self)
pub fn unregister_raw(&mut self, type_hash: TypeHash)
pub fn serialize_from<T>( &self, data: &T, ) -> Result<Intermediate, Box<dyn Error>>
Sourcepub unsafe fn dynamic_serialize_from(
&self,
type_hash: TypeHash,
data: *const u8,
) -> Result<Intermediate, Box<dyn Error>>
pub unsafe fn dynamic_serialize_from( &self, type_hash: TypeHash, data: *const u8, ) -> Result<Intermediate, Box<dyn Error>>
§Safety
pub fn deserialize_to<T: Default>( &self, value: &Intermediate, ) -> Result<T, Box<dyn Error>>
Trait Implementations§
Source§impl Default for SerializationRegistry
impl Default for SerializationRegistry
Source§fn default() -> SerializationRegistry
fn default() -> SerializationRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SerializationRegistry
impl !RefUnwindSafe for SerializationRegistry
impl Send for SerializationRegistry
impl Sync for SerializationRegistry
impl Unpin for SerializationRegistry
impl !UnwindSafe for SerializationRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more