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.
parent
38b80f6c6b
commit
e6837f7394
|
@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue