pub struct Field {
pub name: String,
pub value: Box<Schema>,
/* private fields */
}
Expand description
A field is serialized according to its value. The name is just for diagnostics.
Fields§
§name: String
Field name
value: Box<Schema>
Field type
Implementations§
source§impl Field
impl Field
sourcepub fn new(name: String, value: Box<Schema>) -> Field
pub fn new(name: String, value: Box<Schema>) -> Field
Create a new instance of field, with the given name and type
sourcepub unsafe fn unsafe_new(
name: String,
value: Box<Schema>,
offset: Option<usize>
) -> Field
pub unsafe fn unsafe_new( name: String, value: Box<Schema>, offset: Option<usize> ) -> Field
Create a new instance of field, with the given name and type. The offset is the offset of the field within its struct.
§Safety
The offset must be the correct offset of the field within its struct.
sourcepub fn layout_compatible(&self, other: &Field) -> bool
pub fn layout_compatible(&self, other: &Field) -> bool
Determine if the two fields are laid out identically in memory, in their parent objects.
Trait Implementations§
source§impl Deserialize for Field
impl Deserialize for Field
source§fn deserialize(
deserializer: &mut Deserializer<'_, impl Read>
) -> Result<Self, SavefileError>
fn deserialize( deserializer: &mut Deserializer<'_, impl Read> ) -> Result<Self, SavefileError>
Deserialize and return an instance of Self from the given deserializer.
source§impl Packed for Field
impl Packed for Field
source§unsafe fn repr_c_optimization_safe(_version: u32) -> IsPacked
unsafe fn repr_c_optimization_safe(_version: u32) -> IsPacked
This method returns true if the optimization is allowed
for the protocol version given as an argument.
This may return true if and only if the given protocol version
has a serialized format identical to the memory layout of the given protocol version.
Note, the only memory layout existing is that of the most recent version, so
Packed-optimization only works when disk-format is identical to memory version. Read more
source§impl PartialEq for Field
impl PartialEq for Field
source§impl Serialize for Field
impl Serialize for Field
source§fn serialize(
&self,
serializer: &mut Serializer<'_, impl Write>
) -> Result<(), SavefileError>
fn serialize( &self, serializer: &mut Serializer<'_, impl Write> ) -> Result<(), SavefileError>
Serialize self into the given serializer.
In versions prior to 0.15, ‘Serializer’ did not accept a type parameter.
It now requires a type parameter with the type of writer expected.
source§impl WithSchema for Field
impl WithSchema for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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