pub trait EventToken {
    fn as_raw_token(&self) -> u64;
    fn from_raw_token(data: u64) -> Self;
}
Expand description

Trait that can be used to associate events with arbitrary enums when using WaitContext.

Simple enums that have no or primitive variant data data can use the #[derive(EventToken)] custom derive to implement this trait. See event_token_derive::event_token for details.

Required Methods§

Converts this token into a u64 that can be turned back into a token via from_raw_token.

Converts a raw token as returned from as_raw_token back into a token.

It is invalid to give a raw token that was not returned via as_raw_token from the same Self. The implementation can expect that this will never happen as a result of its usage in WaitContext.

Implementations on Foreign Types§

Implementors§

Implement token for implementations that wish to use this struct as such