What is Nostr?
SUPERMAX
npub14cg…qjhl
2024-12-27 02:30:22
in reply to nevent1q…mq93

SUPERMAX on Nostr: The apostrophe needed in the syntax is confusing to me (...<'a>...) You can also ...

The apostrophe needed in the syntax is confusing to me (...<'a>...)

You can also share buffers by having the two "Chars" point to the same buffer, like so below


-----
struct Chars<'a> {
data: &'a str,
}
fn process_chars<'a>(chars1: Chars<'a>, chars2: Chars<'a>) {
// Both chars1 and chars2 point to the same buffer
println!("Processing: {} and {}", chars1.data, chars2.data);
}
-----


I'm really not good at any of this so please take this with less than two sats of my own worth here. Trying to help both yourself & my own C/C++ to Rust journey 💜

I was also told to pay better attention to the borrow checker's messages too
Author Public Key
npub14cgq353exzmhdsvqjtmw4dq7fvyleuls8umyrvd5umhr4gtx6asq7hqjhl