Vague about service life
I have a type structure SCGI
that has a property Netstring
that itself is another structure:
struct SCGI<'a> { content_length:uint, scgi:bool, request_method:RequestMethod, request_uri:&'a str, body:&'a str, original:Netstring } impl<'a> SCGI<'a> { … }
If this was C ++ I would like it to Netstring
be a new object, not a reference to another object. But if I try to build my code, I always get the following error:
error: wrong number of time-to-live parameters: expected 1, found 0
Adding the lifetime to original
doesn't help: it original:&'a Netstring
leads to the same error.
What am I missing here?
I don't have your complete example, but I think you got the wrong syntax (check type <'a>
after type).
This code compiles for me:
struct Netstring<'a> {
a: &'a str
}
struct SCGI<'a>{
content_length: uint,
scgi: bool,
body: &'a str,
original: Netstring<'a>
}
Hope this helped.