Questions tagged [lifetime-scoping]
97 questions
0
votes
1 answer
Boxed Fn requires lifetime 'static only when testing?
Using rustc 1.10.0, I'm trying to write some code which passes around boxed closures--the eventual goal is to procedurally generate an animation of fractals. Right now I have some function signatures like this:
pub fn interpolate_rectilinear(width:…

coriolinus
- 879
- 2
- 8
- 18
0
votes
1 answer
Python Lifetimes Module Error
I was trying to load the Lifetimes Module on my Linux AMI server.
I installed it just fine and everything seemed to work with no error.
However when I went to use it I got the error below. (tried to do a few things that I thought would fix it but…

ddewber
- 47
- 1
- 5
0
votes
0 answers
Dynamic modules loading with SimpleInjector
I have a WPF application which uses Caliburn.Micro and provides a frame for different types of shells. All these shells are implementing the interface IShell.
As an example lets take a main window which acts as the host and a tabcontrol to host the…

Khh
- 2,521
- 1
- 25
- 42
0
votes
1 answer
Autofac - Components ignore dependency defined in lifetime scope
I could well be misunderstanding something here, so perhaps there is a simple answer here but I'm currently scratching my head.
I have a class UnitOfWork that implements IUnitOfWork (yes yes I know). The constructor for unit of work takes an…

beyond-code
- 1,423
- 1
- 12
- 20
0
votes
1 answer
Rust (+SFML) - How to avoid extra object construction when limited by lifetime parameters?
I'm using rust-sfml (rsfml::graphics) to, at the moment, draw pixels to the screen. (I'm just starting with both Rust and the project.) I'm storing the data in an Image, then copying to a Texture.
This Texture is used to create a Sprite<'s>; herein…

Kai Ninomiya
- 156
- 2
- 6
0
votes
1 answer
Variable lifetime in static list
this code adds a new object to a static list, within a function. the list is passed by reference to the function.
what in the lifetime of the new object in the list?
code sample:
#include
-
#include

user1438233
- 1,153
- 1
- 14
- 30
-2
votes
2 answers
FizzBuzz Function in Rust
This is my code:
fn main() {
fn fizz_buzz<'a>(i: i32) -> &'a str {
if i % 15 == 0 {
"FizzBuzz"
} else if i % 5 == 0 {
"Buzz"
} else if i % 3 == 0 {
"Fizz"
} else {
&i.to_string()
}
}
…

dpokey
- 64
- 6