Begin documenting properties, move them to the top-level module
This commit is contained in:
parent
3b26da6b57
commit
930aeb6956
27 changed files with 57 additions and 39 deletions
|
@ -54,8 +54,8 @@ pub fn serialized_struct(_metadata: TokenStream, input: TokenStream)
|
||||||
// Add "None" field
|
// Add "None" field
|
||||||
let none_field_stream = quote! {
|
let none_field_stream = quote! {
|
||||||
#[br(temp)]
|
#[br(temp)]
|
||||||
#[bw(calc = crate::property::generic_property::GenericProperty { property_name: "None".to_string(), type_name: "".to_string(), key: None } )]
|
#[bw(calc = crate::property::GenericProperty { property_name: "None".to_string(), type_name: "".to_string(), key: None } )]
|
||||||
none_field: crate::property::generic_property::GenericProperty
|
none_field: crate::property::GenericProperty
|
||||||
};
|
};
|
||||||
let buffer = ::syn::parse::Parser::parse2(
|
let buffer = ::syn::parse::Parser::parse2(
|
||||||
syn::Field::parse_named,
|
syn::Field::parse_named,
|
||||||
|
|
|
@ -141,6 +141,7 @@ fn calc_key_data_size_in_bytes(key_data: &ArrayKeyData) -> u32 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An array.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ArrayProperty {
|
pub struct ArrayProperty {
|
||||||
|
|
|
@ -3,6 +3,7 @@ use binrw::binrw;
|
||||||
|
|
||||||
use super::PropertyBase;
|
use super::PropertyBase;
|
||||||
|
|
||||||
|
/// A boolean.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct BoolProperty {
|
pub struct BoolProperty {
|
||||||
|
|
|
@ -3,6 +3,7 @@ use binrw::binrw;
|
||||||
|
|
||||||
use super::PropertyBase;
|
use super::PropertyBase;
|
||||||
|
|
||||||
|
/// A enum.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct EnumProperty {
|
pub struct EnumProperty {
|
||||||
|
|
|
@ -2,6 +2,7 @@ use binrw::binrw;
|
||||||
|
|
||||||
use super::PropertyBase;
|
use super::PropertyBase;
|
||||||
|
|
||||||
|
/// A float.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FloatProperty {
|
pub struct FloatProperty {
|
||||||
|
|
|
@ -5,6 +5,7 @@ use crate::{
|
||||||
save_object::generic::Property,
|
save_object::generic::Property,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A generic property that has no name or type requirements.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct GenericProperty {
|
pub struct GenericProperty {
|
||||||
|
|
|
@ -2,6 +2,7 @@ use binrw::binrw;
|
||||||
|
|
||||||
use super::PropertyBase;
|
use super::PropertyBase;
|
||||||
|
|
||||||
|
/// A integer.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct IntProperty {
|
pub struct IntProperty {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::{
|
||||||
structure::{Struct, guid::Guid},
|
structure::{Struct, guid::Guid},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{PropertyBase, generic_property::GenericProperty};
|
use super::{GenericProperty, PropertyBase};
|
||||||
|
|
||||||
// parse until we can't parse no more. kind of a hack for how we run into the end of Persistent.Sav
|
// parse until we can't parse no more. kind of a hack for how we run into the end of Persistent.Sav
|
||||||
#[binrw::parser(reader, endian)]
|
#[binrw::parser(reader, endian)]
|
||||||
|
@ -270,6 +270,7 @@ fn calc_entry_size_in_bytes(prop: &MapProperty) -> u32 {
|
||||||
size
|
size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A map.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct MapProperty {
|
pub struct MapProperty {
|
||||||
|
|
|
@ -1,14 +1,32 @@
|
||||||
pub mod array_property;
|
pub mod array_property;
|
||||||
pub mod bool_property;
|
|
||||||
pub mod enum_property;
|
mod bool_property;
|
||||||
pub mod float_property;
|
pub use self::bool_property::BoolProperty;
|
||||||
pub mod generic_property;
|
|
||||||
pub mod int_property;
|
mod enum_property;
|
||||||
|
pub use self::enum_property::EnumProperty;
|
||||||
|
|
||||||
|
mod float_property;
|
||||||
|
pub use float_property::FloatProperty;
|
||||||
|
|
||||||
|
mod generic_property;
|
||||||
|
pub use self::generic_property::GenericProperty;
|
||||||
|
|
||||||
|
mod int_property;
|
||||||
|
pub use self::int_property::IntProperty;
|
||||||
|
|
||||||
pub mod map_property;
|
pub mod map_property;
|
||||||
pub mod name_property;
|
|
||||||
|
mod name_property;
|
||||||
|
pub use self::name_property::NameProperty;
|
||||||
|
|
||||||
pub mod set_property;
|
pub mod set_property;
|
||||||
pub mod str_property;
|
|
||||||
pub mod struct_property;
|
mod str_property;
|
||||||
|
pub use self::str_property::StrProperty;
|
||||||
|
|
||||||
|
mod struct_property;
|
||||||
|
pub use self::struct_property::StructProperty;
|
||||||
|
|
||||||
pub(crate) trait PropertyBase {
|
pub(crate) trait PropertyBase {
|
||||||
fn type_name() -> &'static str;
|
fn type_name() -> &'static str;
|
||||||
|
|
|
@ -3,6 +3,7 @@ use binrw::binrw;
|
||||||
|
|
||||||
use super::PropertyBase;
|
use super::PropertyBase;
|
||||||
|
|
||||||
|
/// A name.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct NameProperty {
|
pub struct NameProperty {
|
||||||
|
|
|
@ -2,8 +2,7 @@ use crate::common::{read_string_with_length, write_string_with_length};
|
||||||
use binrw::{BinRead, BinResult, binrw};
|
use binrw::{BinRead, BinResult, binrw};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
PropertyBase,
|
GenericProperty, PropertyBase,
|
||||||
generic_property::GenericProperty,
|
|
||||||
map_property::{KeyType, MapSubStrProperty},
|
map_property::{KeyType, MapSubStrProperty},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,6 +72,7 @@ fn custom_parser(
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A set.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SetProperty {
|
pub struct SetProperty {
|
||||||
|
|
|
@ -3,6 +3,7 @@ use binrw::binrw;
|
||||||
|
|
||||||
use super::PropertyBase;
|
use super::PropertyBase;
|
||||||
|
|
||||||
|
/// A string.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct StrProperty {
|
pub struct StrProperty {
|
||||||
|
|
|
@ -4,6 +4,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use binrw::binrw;
|
use binrw::binrw;
|
||||||
|
|
||||||
|
/// A structure.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct StructProperty {
|
pub struct StructProperty {
|
||||||
|
|
|
@ -3,9 +3,8 @@ use binrw::{BinRead, BinResult, BinWrite, binrw};
|
||||||
use crate::{
|
use crate::{
|
||||||
common::{read_string_with_length, write_string_with_length},
|
common::{read_string_with_length, write_string_with_length},
|
||||||
property::{
|
property::{
|
||||||
array_property::ArrayProperty, bool_property::BoolProperty, float_property::FloatProperty,
|
BoolProperty, FloatProperty, IntProperty, NameProperty, StrProperty, StructProperty,
|
||||||
int_property::IntProperty, map_property::MapProperty, name_property::NameProperty,
|
array_property::ArrayProperty, map_property::MapProperty, set_property::SetProperty,
|
||||||
set_property::SetProperty, str_property::StrProperty, struct_property::StructProperty,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use crate::property::{
|
use crate::property::{BoolProperty, IntProperty, StrProperty, map_property::MapProperty};
|
||||||
bool_property::BoolProperty, int_property::IntProperty, map_property::MapProperty,
|
|
||||||
str_property::StrProperty,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[paramacro::serialized_struct("Transform")]
|
#[paramacro::serialized_struct("Transform")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -2,9 +2,8 @@ use binrw::binrw;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
property::{
|
property::{
|
||||||
array_property::ArrayProperty, bool_property::BoolProperty, int_property::IntProperty,
|
BoolProperty, IntProperty, NameProperty, StrProperty, array_property::ArrayProperty,
|
||||||
map_property::MapProperty, name_property::NameProperty, set_property::SetProperty,
|
map_property::MapProperty, set_property::SetProperty,
|
||||||
str_property::StrProperty,
|
|
||||||
},
|
},
|
||||||
structure::{
|
structure::{
|
||||||
build_data::DABuildDataStruct, da_tuning_point_data::DATuningPointData,
|
build_data::DABuildDataStruct, da_tuning_point_data::DATuningPointData,
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
property::{
|
property::{BoolProperty, FloatProperty, IntProperty, NameProperty, StrProperty},
|
||||||
bool_property::BoolProperty, float_property::FloatProperty, int_property::IntProperty,
|
|
||||||
name_property::NameProperty, str_property::StrProperty,
|
|
||||||
},
|
|
||||||
structure::{
|
structure::{
|
||||||
da_load_option::DALoadOptionStruct, datetime::DateTimeStruct,
|
da_load_option::DALoadOptionStruct, datetime::DateTimeStruct,
|
||||||
save_slot_info::SaveSlotInfoStruct,
|
save_slot_info::SaveSlotInfoStruct,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use crate::property::str_property::StrProperty;
|
use crate::property::StrProperty;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
da_assemble_id_data::DAAssembleIdDataStruct,
|
da_assemble_id_data::DAAssembleIdDataStruct,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::bool_property::BoolProperty;
|
use crate::property::BoolProperty;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
da_humanoid_coloring_data::DAHumanoidColoringDataStruct,
|
da_humanoid_coloring_data::DAHumanoidColoringDataStruct,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::float_property::FloatProperty;
|
use crate::property::FloatProperty;
|
||||||
|
|
||||||
#[paramacro::serialized_struct("DAHumanoidFigureData")]
|
#[paramacro::serialized_struct("DAHumanoidFigureData")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::int_property::IntProperty;
|
use crate::property::IntProperty;
|
||||||
|
|
||||||
#[paramacro::serialized_struct("DALoadOption")]
|
#[paramacro::serialized_struct("DALoadOption")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::int_property::IntProperty;
|
use crate::property::IntProperty;
|
||||||
|
|
||||||
#[paramacro::serialized_struct("DAModuleItemData")]
|
#[paramacro::serialized_struct("DAModuleItemData")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::enum_property::EnumProperty;
|
use crate::property::EnumProperty;
|
||||||
|
|
||||||
#[paramacro::serialized_struct("DATriggerData")]
|
#[paramacro::serialized_struct("DATriggerData")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::int_property::IntProperty;
|
use crate::property::IntProperty;
|
||||||
|
|
||||||
#[paramacro::serialized_struct("DATuningPointData")]
|
#[paramacro::serialized_struct("DATuningPointData")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::name_property::NameProperty;
|
use crate::property::NameProperty;
|
||||||
|
|
||||||
use super::primary_asset_type::PrimaryAssetTypeStruct;
|
use super::primary_asset_type::PrimaryAssetTypeStruct;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::property::name_property::NameProperty;
|
use crate::property::NameProperty;
|
||||||
|
|
||||||
#[paramacro::serialized_struct("PrimaryAssetType")]
|
#[paramacro::serialized_struct("PrimaryAssetType")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::property::{
|
use crate::property::{NameProperty, StrProperty, array_property::ArrayProperty};
|
||||||
array_property::ArrayProperty, name_property::NameProperty, str_property::StrProperty,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::datetime::DateTimeStruct;
|
use super::datetime::DateTimeStruct;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue