Expand description
alox-48 (short for aluminum oxide 48)
alox-48 is a crate using serde designed to deserialize ruby marshal data.
It uses the currently nightly feature min_specialization
to extend serde’s data model,
preventing the loss of information in (de)serialization.
alox-48 supports both serialization and deserialization, but some types present in rust’s type system and ruby’s marshal format are unsupported.
Most notably, alox-48 does NOT support object links. Object links are marshal’s way of saving space, if an object was serialized already a “link” indicating when it was serialized is serialized instead.
class MyClass
def initialize
@var = 1
@string = "hiya!"
end
end
a = MyClass.new
Marshal.dump([a, a, a])
# The array here has 3 indices all "pointing" to the same object.
# Instead of serializing MyClass 3 times, Marshal will serialize it once and replace the other 2 occurences with object links.
# When deserializing, Marshal will preserve object links and all 3 elements in the array will point to the same object.
# In alox-48, this is not the case. Each index will be a "unique" ""object"".
This does not map well to rust, as it inherently requires a garbage collector. alox-48 will still deserialize object links, however it will simply deserialize them as a copy instead.
Re-exports
pub use de::Deserializer;
pub use de::Error as DeError;
pub use de::VisitorExt;
pub use ser::Error as SerError;
pub use ser::SerializeExt;
pub use ser::Serializer;
pub use value::from_value;
pub use value::to_value;
pub use value::Object;
pub use value::RbArray;
pub use value::RbHash;
pub use value::RbString;
pub use value::Symbol;
pub use value::Userdata;
pub use value::Value;
Modules
- Deserialization via marshal.
- Marshal serialization.
- Untyped ruby values and rust equivalents of some ruby types (Hash, Array, etc).
Functions
- Deserialize data from some bytes. It’s a convenience function over
Deserializer::new
andserde::Deserialize
. - Serialize the type into bytes.