Explorar o código

Need to consider different implementations of String kinds in Rust, and additionally how we may want to `impl Copy for Str`, i.e. `std::mem::swap` with placeholders to keep performance up.

David Golembiowski %!s(int64=5) %!d(string=hai) anos
pai
achega
e6837f7394
Modificáronse 1 ficheiros con 17 adicións e 0 borrados
  1. 17 0
      port/assimp_rs/src/structs/string.rs

+ 17 - 0
port/assimp_rs/src/structs/string.rs

@@ -0,0 +1,17 @@
+pub const MAXLEN: u32 = 1024;
+
+#[derive(Clone, Debug)]
+struct Str {
+    length: u32,
+    data: Vec<char>
+}
+
+impl Str {
+    pub fn new(len_u32: u32, data_string: String) -> Str {
+        Str {
+            length: len_u32,
+            data: data_string.chars().collect()
+        }
+    }
+}
+