Skip to content

Specify lifetimes in system arguments #7837

Answered by dimvoly
dimvoly asked this question in Q&A
Discussion options

You must be logged in to vote

Why do these things decide to work immediately after me asking the question? Have just tried the following:

fn unwrap_everything<'a, 'b, 'c, 'd>(
    raycast_source_query: &'a Query<'b, 'c, &'d RaycastSource<PickingRaycastSet>>,
) -> Option<(
    &'a IntersectionData,
)> {
  // ... retrieves the IntersectionData, which comes back as a reference
}

That compiles. No doubt a bunch of these are redundant so I'll play around with it further.

This does not require lifetime parameters on the system itself, only this function. Presumably they're inferred by the compiler for the system.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dimvoly
Comment options

Answer selected by dimvoly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant