About 50 results
Open links in new tab
  1. rust - Is there any way to return a reference to a variable created in ...

    This is what Rust's lifetimes prevent - you aren't allowed to use a reference beyond how long the referred-to value is valid at its current memory location. See also: Is it possible to return either a …

  2. rust - How do I borrow a reference to what is inside an Option<T ...

    How do I pull a reference out of an Option and pass it back with the specific lifespan of the caller? Specifically, I want to borrow a reference to a Box&lt;Foo&gt; from a Bar that has an Option&...

  3. What are the differences between a pointer and a reference in Rust?

    Jun 6, 2020 · Rust references are just a pointer, but the compiler endows them with borrowing semantics. When you take an immutable reference to an object, the compiler ensures that you can't …

  4. rust - Why can a mutable reference variable be mutated-through even ...

    May 15, 2025 · A newcomer to Rust might stumble upon what could be considered a slightly unfortunate choice of words. Rust uses mut is several situations, and they are not the same: We say "this is a …

  5. rust - cannot borrow as mutable, as it is behind a `&` reference ...

    Aug 9, 2019 · From the error, I can see that the issue is that Row should be mutable so I can edit it (which makes sense, since I am mutating it's String). I can't figure out a) how to be able to mutate the …

  6. rust - Why can't I store a value and a reference to that value in the ...

    Aug 31, 2015 · How to store a reference without having to deal with lifetimes? In other cases, you may wish to move to some type of reference-counting, such as by using Rc or Arc. More information After …

  7. What do the ampersand '&' and star '*' symbols mean in Rust?

    Despite thoroughly reading the documentation, I'm rather confused about the meaning of the &amp; and * symbol in Rust, and more generally about what is a Rust reference exactly. In this example, it

  8. How to pass a Reference / Pointer to a Rust Struct to a C ffi interface?

    Feb 14, 2021 · How to pass a Reference / Pointer to a Rust Struct to a C ffi interface? Asked 5 years, 2 months ago Modified 3 years, 1 month ago Viewed 14k times

  9. rust - Is it more conventional to pass-by-value or pass-by-reference ...

    17 When I'm passing a object by reference to a struct's new() method, and the struct will own the object, is it more conventional to: pass the object by reference, and do to_owned() in the new() clone the …

  10. rust - How to convert a String into a &'static str - Stack Overflow

    May 31, 2014 · How do I convert a String into a &amp;str? More specifically, I would like to convert it into a str with the static lifetime (&amp;'static str).