pub struct DeclaredGuard { /* private fields */ }Expand description
Holds declared aspects installed until released.
Not Send: it restores the thread it was created on, and the WOW64 revert
token is meaningless anywhere else. Moving one to another thread would
revert that thread’s redirection using a cookie minted for a different
one.
As with TransactionGuard, that property is a consequence of a field
type rather than an explicit bound – redirection is a raw pointer, and
raw pointers are not Send. Replacing it with an integer newtype would
silently make this guard Send and this paragraph false, so the claim is
pinned by a test rather than left as prose:
fn assert_send<T: Send>() {}
assert_send::<windows_thread_ambient_sys::declared::DeclaredGuard>();Implementations§
Source§impl DeclaredGuard
impl DeclaredGuard
Sourcepub fn release(self) -> Result<(), DeclaredError>
pub fn release(self) -> Result<(), DeclaredError>
Restore every installed aspect, in exact reverse order.
§Errors
Returns the first DeclaredError encountered, having still
attempted every remaining restoration – stopping early would leave more
of the thread contaminated than necessary.