Struct ByteSerializer

Source
pub struct ByteSerializer { /* private fields */ }
Expand description

Binary data serializer

§Note

  • All of these fixups are from the __data__ section.

Trait Implementations§

Source§

impl Debug for ByteSerializer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ByteSerializer

Source§

fn default() -> ByteSerializer

Returns the “default value” for a type. Read more
Source§

impl SerializeFlags for &mut ByteSerializer

Source§

fn serialize_field<T>(&mut self, _key: &str, _value: &T) -> Result<()>
where T: ?Sized + Serialize,

Ignore this method because it is an XML method.

Source§

type Ok = ()

Must match the Ok type of our Serializer.
Source§

type Error = Error

Must match the Error type of our Serializer.
Source§

fn serialize_bits<T>(&mut self, value: &T) -> Result<()>
where T: ?Sized + Serialize,

Serialize all bits of a flag.(Only used by binary serializer.) Read more
Source§

fn end(self) -> Result<Self::Ok>

Finish serializing flags.
Source§

fn serialize_empty_bit(&mut self) -> Result<(), Self::Error>

Serialization process when the flag is 0bits.(Only used by XML serializer.) Read more
Source§

impl SerializeSeq for &mut ByteSerializer

Source§

fn serialize_class_element<T>(&mut self, value: &T) -> Result<()>
where T: ?Sized + Serialize,

This method is called on HavokClasses array.(Write start)

Therefore, it is necessary to record the write position of this in virtual_fixup.

Source§

type Ok = ()

Must match the Ok type of our Serializer.
Source§

type Error = Error

Must match the Error type of our Serializer.
Source§

fn serialize_primitive_element<T>( &mut self, value: &T, _index: usize, _len: usize, ) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize a primitive sequence element. (e.g. char, bool u8..u64, i8..i64, f32, Pointer) Read more
Source§

fn serialize_math_element<T>(&mut self, value: &T) -> Result<()>
where T: ?Sized + Serialize,

Serialize a math sequence element.(e.g. Matrix3)
Source§

fn serialize_cstring_element(&mut self, value: &CString<'_>) -> Result<()>

Serialize a cstring sequence element.
Source§

fn serialize_stringptr_element(&mut self, value: &StringPtr<'_>) -> Result<()>

Serialize a stringptr sequence element.
Source§

fn end(self) -> Result<()>

Finish serializing a sequence.
Source§

impl<'a> Serializer for &'a mut ByteSerializer

Source§

fn serialize_char(self, v: char) -> Result<Self::Ok, Self::Error>

Assume that the characters are ASCII charactersc_char. In that case, i8 is used to fit into 128 characters.

Source§

fn serialize_struct( self, name: &'static str, class_meta: Option<(Pointer, Signature)>, sizes: (u64, u64), ) -> Result<Self::SerializeStruct, Self::Error>

This is called in the Havok Class array or HashMap, or in a serializer in a field. Classes in the field may be inlined, in which case class_meta will be None.

§what’s class_meta?

If class_meta exists, it is when writing an hkobject with the name attribute in XML. This must be written to virtual_fixup so that the constructor can be called.

Source§

fn serialize_stringptr(self, v: &StringPtr<'_>) -> Result<Self::Ok, Self::Error>

In the binary serialization of hkx, this is the actual data writing process beyond the pointer that is called only after all fields of the structure have been written.

Source§

type Ok = ()

The output type produced by this Serializer during successful serialization. Most serializers that produce text or binary output should set Ok = () and serialize into an io::Write or buffer contained within the Serializer instance. Serializers that build in-memory data structures may be simplified by using Ok to propagate the data structure around.
Source§

type Error = Error

The error type when some error occurs during serialization.
Source§

type SerializeSeq = &'a mut ByteSerializer

Type returned from serialize_seq for serializing the content of the sequence.
Source§

type SerializeStruct = StructSerializer<'a>

Source§

type SerializeFlags = &'a mut ByteSerializer

Type returned from serialize_enum_flags for serializing the content of the struct variant.
Source§

fn serialize_void(self, _: ()) -> Result<Self::Ok, Self::Error>

Serialize a Void value. Read more
Source§

fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error>

Serialize a bool value.
Source§

fn serialize_int8(self, v: i8) -> Result<Self::Ok, Self::Error>

Serialize an i8 value. Read more
Source§

fn serialize_uint8(self, v: u8) -> Result<Self::Ok, Self::Error>

Serialize an u8 value.
Source§

fn serialize_int16(self, v: i16) -> Result<Self::Ok, Self::Error>

Serialize an i16 value.
Source§

fn serialize_uint16(self, v: u16) -> Result<Self::Ok, Self::Error>

Serialize an u16 value.
Source§

fn serialize_int32(self, v: i32) -> Result<Self::Ok, Self::Error>

Serialize an i32 value.
Source§

fn serialize_uint32(self, v: u32) -> Result<Self::Ok, Self::Error>

Serialize an u32 value.
Source§

fn serialize_int64(self, v: i64) -> Result<Self::Ok, Self::Error>

Serialize an u64 value.
Source§

fn serialize_uint64(self, v: u64) -> Result<Self::Ok, Self::Error>

Serialize an i64 value.
Source§

fn serialize_real(self, v: f32) -> Result<Self::Ok, Self::Error>

Serialize an f32 value.
Source§

fn serialize_vector4(self, v: &Vector4) -> Result<Self::Ok, Self::Error>

Serialize an Vector4 value.
Source§

fn serialize_quaternion(self, v: &Quaternion) -> Result<Self::Ok, Self::Error>

Serialize an Quaternion value.
Source§

fn serialize_matrix3(self, v: &Matrix3) -> Result<Self::Ok, Self::Error>

Serialize an Matrix3 value.
Source§

fn serialize_rotation(self, v: &Rotation) -> Result<Self::Ok, Self::Error>

Serialize an Rotation value.
Source§

fn serialize_matrix4(self, v: &Matrix4) -> Result<Self::Ok, Self::Error>

Serialize an Matrix4 value.
Source§

fn serialize_qstransform(self, v: &QsTransform) -> Result<Self::Ok, Self::Error>

Serialize an QsTransform value.
Source§

fn serialize_transform(self, v: &Transform) -> Result<Self::Ok, Self::Error>

Serialize an Transform value.
Source§

fn serialize_pointer(self, ptr: Pointer) -> Result<Self::Ok, Self::Error>

Serialize an Pointer value.
Source§

fn serialize_array( self, _len: Option<usize>, ) -> Result<Self::SerializeSeq, Self::Error>

Serialize an Array value.
Source§

fn serialize_variant(self, v: &Variant) -> Result<Self::Ok, Self::Error>

Serialize an Variant value. Read more
Source§

fn serialize_cstring(self, v: &CString<'_>) -> Result<Self::Ok, Self::Error>

Serialize an CString value.
Source§

fn serialize_ulong(self, v: Ulong) -> Result<Self::Ok, Self::Error>

Serialize an ULong(pointer size(u32 or u64)) value.
Source§

fn serialize_enum_flags(self) -> Result<Self::SerializeFlags, Self::Error>

Serialize an enum or Flags value.
Source§

fn serialize_half(self, v: f16) -> Result<Self::Ok, Self::Error>

Serialize an Half(f16) value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoResult<T> for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more