Skip to content

set_global_default use #1641

Answered by foresterre
kellytk asked this question in Q&A
Oct 14, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Without the code this is difficult to answer, however it may be that a guard returned from a writer does not live long enough. By moving the guard into another function f, it will at most live as long as f and be dropped at the end of the scope of f. If that's the case, you may want to look at this answer: #1494 (comment)

Driving into the code behind set_global_default [1], I would not expect this to occur because of moving just set_global_default. The set_global_default set the default Dispatch as a static field for the whole process.

[1]

pub fn set_global_default(dispatcher: Dispatch) -> Result<(), SetGlobalDefaultError>

Replies: 1 comment 1 reply

Comment options

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

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