remove exclamation mark from string-program
This commit is contained in:
parent
da24cc1f50
commit
0facc24fa7
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -204,6 +204,10 @@ dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "refcell-program"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.21"
|
||||
@ -273,6 +277,10 @@ version = "0.1.0"
|
||||
name = "stack-program"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "str-program"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "string-dhat"
|
||||
version = "0.1.0"
|
||||
|
@ -1,2 +1,2 @@
|
||||
[workspace]
|
||||
members = ["stack-program", "stack-and-heap-program", "string-program", "box-str-program", "string-dhat", "box-str-dhat"]
|
||||
members = ["stack-program", "stack-and-heap-program", "string-program", "box-str-program", "string-dhat", "box-str-dhat", "refcell-program", "str-program"]
|
||||
|
4
refcell-program/Cargo.toml
Normal file
4
refcell-program/Cargo.toml
Normal file
@ -0,0 +1,4 @@
|
||||
[package]
|
||||
name = "refcell-program"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
9
refcell-program/src/main.rs
Normal file
9
refcell-program/src/main.rs
Normal file
@ -0,0 +1,9 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
fn main() {
|
||||
let refcell_str: RefCell<&str> = RefCell::new("hello");
|
||||
|
||||
println!("refcell_str");
|
||||
let second = refcell_str.clone();
|
||||
println!("refcell_str second:");
|
||||
}
|
4
str-program/Cargo.toml
Normal file
4
str-program/Cargo.toml
Normal file
@ -0,0 +1,4 @@
|
||||
[package]
|
||||
name = "str-program"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
13
str-program/src/main.rs
Normal file
13
str-program/src/main.rs
Normal file
@ -0,0 +1,13 @@
|
||||
const NAME: &str = "asqar";
|
||||
|
||||
fn hello() -> u8 {
|
||||
let hello = NAME;
|
||||
println!("hello {}", hello);
|
||||
0
|
||||
}
|
||||
|
||||
fn main() {
|
||||
for _ in 1..5 {
|
||||
let v = hello();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fn main() {
|
||||
let s = String::from("hello!");
|
||||
let s = String::from("hello");
|
||||
println!("{}", s);
|
||||
println!("size of string on stack: {}", std::mem::size_of_val(&s));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user