diff options
author | sanine <sanine.not@pm.me> | 2022-04-16 11:55:09 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-04-16 11:55:09 -0500 |
commit | db81b925d776103326128bf629cbdda576a223e7 (patch) | |
tree | 58bea8155c686733310009f6bed7363f91fbeb9d /libs/assimp/port/assimp_rs/src/structs/string | |
parent | 55860037b14fb3893ba21cf2654c83d349cc1082 (diff) |
move 3rd-party librarys into libs/ and add built-in honeysuckle
Diffstat (limited to 'libs/assimp/port/assimp_rs/src/structs/string')
-rw-r--r-- | libs/assimp/port/assimp_rs/src/structs/string/mod.rs | 3 | ||||
-rw-r--r-- | libs/assimp/port/assimp_rs/src/structs/string/string.rs | 41 |
2 files changed, 44 insertions, 0 deletions
diff --git a/libs/assimp/port/assimp_rs/src/structs/string/mod.rs b/libs/assimp/port/assimp_rs/src/structs/string/mod.rs new file mode 100644 index 0000000..f599ba7 --- /dev/null +++ b/libs/assimp/port/assimp_rs/src/structs/string/mod.rs @@ -0,0 +1,3 @@ +mod string; +pub use self::string::MAXLEN; +pub use self::string::Str; diff --git a/libs/assimp/port/assimp_rs/src/structs/string/string.rs b/libs/assimp/port/assimp_rs/src/structs/string/string.rs new file mode 100644 index 0000000..b88457d --- /dev/null +++ b/libs/assimp/port/assimp_rs/src/structs/string/string.rs @@ -0,0 +1,41 @@ +pub const MAXLEN: usize = 1024; + +/// Want to consider replacing `Vec<char>` +/// with a comparable definition at +/// https://doc.rust-lang.org/src/alloc/string.rs.html#415-417 +#[derive(Clone, Debug)] +struct Str { + length: usize, + data: Vec<char> +} + +impl Str { + pub fn new(len_u32: usize, data_string: String) -> Str { + Str { + length: len_u32, + data: data_string.chars().collect() + } + } +} + +/// MaterialPropertyStr +/// The size of length is truncated to 4 bytes on a 64-bit platform when used as a +/// material property (see MaterialSystem.cpp, as aiMaterial::AddProperty() ). +#[derive(Clone, Debug)] +struct MaterialPropertyStr { + length: usize, + data: Vec<char> +} + + +impl MaterialPropertyStr { + pub fn new(len_u32: usize, data_string: String) -> MaterialPropertyStr { + MaterialPropertyStr { + length: len_u32, + data: data_string.chars().collect() + } + } +} + + + |