Add an API for forking the current hub as a convenience wrapper around new_from_top on the current hub, while avoiding Arc-cloning.
This supports the common pattern of creating a per-message scope/hub so information does not bleed between processed messages.
Possible naming mentioned in discussion included Hub::new_from_current or Hub::fork_current.
Relevant context: the existing Hub::with pattern is deprecated in favor of Hub::current(), but Hub::current() returns Arc<Hub> while new_from_top takes AsRef<Hub>.
Add an API for forking the current hub as a convenience wrapper around
new_from_topon the current hub, while avoiding Arc-cloning.This supports the common pattern of creating a per-message scope/hub so information does not bleed between processed messages.
Possible naming mentioned in discussion included
Hub::new_from_currentorHub::fork_current.Relevant context: the existing
Hub::withpattern is deprecated in favor ofHub::current(), butHub::current()returnsArc<Hub>whilenew_from_toptakesAsRef<Hub>.