[][src]Trait pui_core::Identifier

pub unsafe trait Identifier {
    type Token: Token;
    pub fn token(&self) -> Self::Token;

    pub fn owns_token(&self, token: &Self::Token) -> bool { ... }
}

An Identifier is a process unique identifier

you are guaranteed that two instances of this identifier will never compare equal You can also get a token that this identifier recognizes, which you can use to mark other types as logically owned by the identifier. No other identifier will recognize tokens made be a different identifier while both identifiers are live.

Safety

  • ident.owns(&token) must return true for any token returned from ident.token() regardless of when the token was created.
  • If two tokens compare equal, then Identifier::owns must act the same for both of them
    • i.e. it must return false for both tokens, or it must return true for both tokens
  • Two instances of Identifier must never return true for the same token if either the two identifier or the tokens they generate can both exist on the same thread.

Associated Types

type Token: Token[src]

The tokens that this Identifier generates

Loading content...

Required methods

pub fn token(&self) -> Self::Token[src]

Create a new token

Loading content...

Provided methods

pub fn owns_token(&self, token: &Self::Token) -> bool[src]

Check if this token was created by this identifier

Loading content...

Implementations on Foreign Types

impl<I: ?Sized + Identifier> Identifier for &mut I[src]

type Token = I::Token

impl<I: ?Sized + Identifier> Identifier for Box<I>[src]

type Token = I::Token

Loading content...

Implementors

impl<'a> Identifier for Scoped<'a>[src]

type Token = ScopedToken<'a>

impl<A: ScalarAllocator, P: PoolMut<A>> Identifier for Dynamic<A, P>[src]

type Token = DynamicToken<A>

impl<T> Identifier for Type<T>[src]

type Token = TypeToken<T>

Loading content...