fixed a couple of things. Adding MaterialPropertyString
parent
e6837f7394
commit
a286506c23
|
@ -1,13 +1,16 @@
|
||||||
pub const MAXLEN: u32 = 1024;
|
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)]
|
#[derive(Clone, Debug)]
|
||||||
struct Str {
|
struct Str {
|
||||||
length: u32,
|
length: usize,
|
||||||
data: Vec<char>
|
data: Vec<char>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Str {
|
impl Str {
|
||||||
pub fn new(len_u32: u32, data_string: String) -> Str {
|
pub fn new(len_u32: usize, data_string: String) -> Str {
|
||||||
Str {
|
Str {
|
||||||
length: len_u32,
|
length: len_u32,
|
||||||
data: data_string.chars().collect()
|
data: data_string.chars().collect()
|
||||||
|
@ -15,3 +18,24 @@ impl Str {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue